Skip to content

Commit fb0b88e

Browse files
committed
Fix invalid escape sequence warning
Summary: Python starts warning in 3.6+ about invalid escape sequences in strings. These regexes currently trigger that warning, but we can fix that easily by converting them to raw strings instead. Test Plan: For each string changed, tested that '$str' == r'$str' in the python shell. ran tox and confirmed it still passed for py37, py38, py39 and py310
1 parent c1855c5 commit fb0b88e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

titlecase/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def titlecase(text, callback=None, small_first_last=True, preserve_blank_lines=F
167167
# too short (like "St", don't apply this)
168168
CONSONANTS = ''.join(set(string.ascii_lowercase)
169169
- {'a', 'e', 'i', 'o', 'u', 'y'})
170-
is_all_consonants = regex.search('\A[' + CONSONANTS + ']+\Z', word,
170+
is_all_consonants = regex.search(r'\A[' + CONSONANTS + r']+\Z', word,
171171
flags=regex.IGNORECASE)
172172
if is_all_consonants and len(word) > 2:
173173
tc_line.append(word.upper())

0 commit comments

Comments
 (0)