Skip to content

Commit aabe9e6

Browse files
author
Markus Tauchnitz
committed
fix: use r in front of strings with escape seqs
Python 3.12 emits warnings
1 parent 2caa0b6 commit aabe9e6

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

athenacli/completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, smart_completion=True, supported_formats=(), keyword_casing='
2828
self.reserved_words = set()
2929
for x in self.keywords:
3030
self.reserved_words.update(x.split())
31-
self.name_pattern = compile("^[_a-z][_a-z0-9\$]*$")
31+
self.name_pattern = compile(r"^[_a-z][_a-z0-9\$]*$")
3232

3333
self.special_commands = []
3434
self.table_formats = supported_formats

athenacli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def connect(self, aws_config, database):
204204
)
205205

206206
def handle_editor_command(self, text):
207-
"""
207+
r"""
208208
Editor command is any query that is prefixed or suffixed
209209
by a '\e'. The reason for a while loop is because a user
210210
might edit a query multiple times.

athenacli/packages/parseutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
def last_word(text, include='alphanum_underscore'):
18-
"""
18+
r"""
1919
Find the last word in a sentence.
2020
>>> last_word('abc')
2121
'abc'

athenacli/packages/special/iocommands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_editor_query(sql):
117117
# The reason we can't simply do .strip('\e') is that it strips characters,
118118
# not a substring. So it'll strip "e" in the end of the sql also!
119119
# Ex: "select * from style\e" -> "select * from styl".
120-
pattern = re.compile('(^\\\e|\\\e$)')
120+
pattern = re.compile(r'(^\\\e|\\\e$)')
121121
while pattern.search(sql):
122122
sql = pattern.sub('', sql)
123123

@@ -213,7 +213,7 @@ def subst_favorite_query_args(query, args):
213213

214214
query = query.replace(subst_var, val)
215215

216-
match = re.search('\\$\d+', query)
216+
match = re.search(r'\\$\d+', query)
217217
if match:
218218
return[None, 'missing substitution for ' + match.group(0) + ' in query:\n ' + query]
219219

0 commit comments

Comments
 (0)