diff --git a/litecli/main.py b/litecli/main.py index ebbc5ba..6dc9dff 100644 --- a/litecli/main.py +++ b/litecli/main.py @@ -329,7 +329,7 @@ def _connect(): exit(1) def handle_editor_command(self, text): - """Editor command is any query that is prefixed or suffixed by a '\e'. + R"""Editor command is any query that is prefixed or suffixed by a '\e'. The reason for a while loop is because a user might edit a query multiple times. For eg: diff --git a/litecli/packages/parseutils.py b/litecli/packages/parseutils.py index f5fdc1d..d5fd197 100644 --- a/litecli/packages/parseutils.py +++ b/litecli/packages/parseutils.py @@ -12,12 +12,12 @@ # This matches everything except spaces, parens, colon, comma, and period "most_punctuations": re.compile(r"([^\.():,\s]+)$"), # This matches everything except a space. - "all_punctuations": re.compile("([^\s]+)$"), + "all_punctuations": re.compile(r"([^\s]+)$"), } def last_word(text, include="alphanum_underscore"): - """ + R""" Find the last word in a sentence. >>> last_word('abc') @@ -41,9 +41,9 @@ def last_word(text, include="alphanum_underscore"): >>> last_word('bac $def', include='most_punctuations') '$def' >>> last_word('bac \def', include='most_punctuations') - '\\\\def' + '\\def' >>> last_word('bac \def;', include='most_punctuations') - '\\\\def;' + '\\def;' >>> last_word('bac::def', include='most_punctuations') 'def' """ diff --git a/litecli/packages/special/iocommands.py b/litecli/packages/special/iocommands.py index ee254f0..c1596eb 100644 --- a/litecli/packages/special/iocommands.py +++ b/litecli/packages/special/iocommands.py @@ -121,7 +121,7 @@ def get_editor_query(sql): # The reason we can't simply do .strip('\e') is that it strips characters, # not a substring. So it'll strip "e" in the end of the sql also! # Ex: "select * from style\e" -> "select * from styl". - pattern = re.compile("(^\\\e|\\\e$)") + pattern = re.compile(r"(^\\e|\\e$)") while pattern.search(sql): sql = pattern.sub("", sql) @@ -245,7 +245,7 @@ def subst_favorite_query_args(query, args): + query, ] - match = re.search("\\?|\\$\d+", query) + match = re.search(r"\?|\$\d+", query) if match: return [ None, diff --git a/litecli/sqlcompleter.py b/litecli/sqlcompleter.py index 82b8d87..68252ea 100644 --- a/litecli/sqlcompleter.py +++ b/litecli/sqlcompleter.py @@ -257,7 +257,7 @@ def __init__(self, supported_formats=(), keyword_casing="auto"): self.reserved_words = set() for x in self.keywords: self.reserved_words.update(x.split()) - self.name_pattern = compile("^[_a-z][_a-z0-9\$]*$") + self.name_pattern = compile(r"^[_a-z][_a-z0-9\$]*$") self.special_commands = [] self.table_formats = supported_formats diff --git a/tests/test_sqlexecute.py b/tests/test_sqlexecute.py index 16bad74..cd56683 100644 --- a/tests/test_sqlexecute.py +++ b/tests/test_sqlexecute.py @@ -309,7 +309,7 @@ def test_favorite_query_expanded_output(executor): results = run(executor, "\\fs test-ae select * from test") assert_result_equal(results, status="Saved.") - results = run(executor, "\\f+ test-ae \G") + results = run(executor, R"\f+ test-ae \G") assert is_expanded_output() is True assert_result_equal( results,