Tue, 21 Jan 2025 10:33:37 -0600
Use raw strings for Python regular expressions
Testing Done:
Linted without warnings about invalid escapes.
Reviewed at https://reviews.imfreedom.org/r/3774/
| libpurple/dbus-analyze-functions.py | file | annotate | diff | comparison | revisions | |
| libpurple/dbus-analyze-signals.py | file | annotate | diff | comparison | revisions |
--- a/libpurple/dbus-analyze-functions.py Tue Jan 21 10:31:34 2025 -0600 +++ b/libpurple/dbus-analyze-functions.py Tue Jan 21 10:33:37 2025 -0600 @@ -534,8 +534,8 @@ def __init__(self, inputfile, fprefix): self.inputiter = iter(inputfile) self.functionregexp = \ - re.compile("^%s(\w[^()]*)\(([^()]*)\)\s*;\s*$" % fprefix) - self.typeregexp = re.compile("^\w+\s*\*?\s*$") + re.compile(r"^%s(\w[^()]*)\(([^()]*)\)\s*;\s*$" % fprefix) + self.typeregexp = re.compile(r"^\w+\s*\*?\s*$") @@ -636,7 +636,7 @@ options[command] = None if "export-only" in options: - fprefix = "DBUS_EXPORT\s+" + fprefix = r"DBUS_EXPORT\s+" else: fprefix = "" @@ -648,7 +648,3 @@ else: bindings = ServerBindingSet(sys.stdin, fprefix) bindings.process() - - - -
--- a/libpurple/dbus-analyze-signals.py Tue Jan 21 10:31:34 2025 -0600 +++ b/libpurple/dbus-analyze-signals.py Tue Jan 21 10:33:37 2025 -0600 @@ -20,8 +20,8 @@ "dbus-method-called", ] -registerregex = re.compile("purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;") -nameregex = re.compile('[-_][a-z]') +registerregex = re.compile(r"purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;") +nameregex = re.compile(r'[-_][a-z]') print("/* Generated by %s. Do not edit! */" % sys.argv[0]) print("const char *dbus_signals = ") @@ -57,4 +57,3 @@ print("\" </signal>\\n\"") print(";") -