From: Thorsten Alteholz Date: Fri, 5 Jun 2026 19:41:49 +0200 Subject: fix invalid escape sequences --- base/imagesize.py | 6 +++--- base/queues.py | 2 +- check.py | 2 +- fax/ledmfax.py | 2 +- fax/soapfax.py | 2 +- makeuri.py | 2 +- probe.py | 4 ++-- scan.py | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base/imagesize.py b/base/imagesize.py index e8a8ea7..8ccdcbb 100644 --- a/base/imagesize.py +++ b/base/imagesize.py @@ -183,10 +183,10 @@ TYPE_MAP = {re.compile('^GIF8[7,9]a') : ('image/gif', gifsize), re.compile("^\xFF\xD8") : ('image/jpeg', jpegsize), re.compile("^\x89PNG\x0d\x0a\x1a\x0a") : ('image/png', pngsize), re.compile("^P[1-7]") : ('image/x-portable-pixmap', ppmsize), - re.compile('\#define\s+\S+\s+\d+') : ('image/x-xbitmap', xbmsize), - re.compile('\/\* XPM \*\/') : ('image/x-xpixmap', xpmsize), + re.compile(r'#define\s+\S+\s+\d+') : ('image/x-xbitmap', xbmsize), + re.compile(r'/\* XPM \*/') : ('image/x-xpixmap', xpmsize), re.compile('^MM\x00\x2a') : ('image/tiff', tiffsize), - re.compile('^II\*\x00') : ('image/tiff', tiffsize), + re.compile('^II\\*\x00') : ('image/tiff', tiffsize), re.compile('^BM') : ('image/x-bitmap', bmpsize), re.compile("^\x8aMNG\x0d\x0a\x1a\x0a") : ('image/png', pngsize), } diff --git a/base/queues.py b/base/queues.py index 33a8d65..b1ecfb0 100755 --- a/base/queues.py +++ b/base/queues.py @@ -46,7 +46,7 @@ HPPS = 3 HPOTHER = 4 DEVICE_URI_PATTERN = re.compile(r"""(.*):/(.*?)/(\S*?)\?(?:serial=(\S*)|device=(\S*)|ip=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}[^&]*)|zc=(\S+))(?:&port=(\d))?""", re.I) -NICKNAME_PATTERN = re.compile(b'''\*NickName:\s*\"(.*)"''', re.MULTILINE) +NICKNAME_PATTERN = re.compile(r'''\*NickName:\s*\"(.*)"''', re.MULTILINE) NET_PATTERN = re.compile(r"""(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") NET_ZC_PATTERN = re.compile(r'''zc=(.*)''',re.IGNORECASE) NET_OTHER_PATTERN = re.compile(r'''(.*)://(.*)''',re.IGNORECASE) diff --git a/check.py b/check.py index abc0180..f27058e 100755 --- a/check.py +++ b/check.py @@ -627,7 +627,7 @@ class DependenciesCheck(object): status, output = utils.run("%s -d03f0:" % lsusb) if output: - lsusb_pat = re.compile("""^Bus\s([0-9a-fA-F]{3,3})\sDevice\s([0-9a-fA-F]{3,3}):\sID\s([0-9a-fA-F]{4,4}):([0-9a-fA-F]{4,4})(.*)""", re.IGNORECASE) + lsusb_pat = re.compile(r"""^Bus\s([0-9a-fA-F]{3,3})\sDevice\s([0-9a-fA-F]{3,3}):\sID\s([0-9a-fA-F]{4,4}):([0-9a-fA-F]{4,4})(.*)""", re.IGNORECASE) log.debug(output) try: hpmudext = utils.import_ext('hpmudext') diff --git a/fax/ledmfax.py b/fax/ledmfax.py index 6520bf3..074261c 100644 --- a/fax/ledmfax.py +++ b/fax/ledmfax.py @@ -43,7 +43,7 @@ from .fax import * # **************************************************************************** # -http_result_pat = re.compile(b"""HTTP/\d.\d\s(\d+)""", re.I) +http_result_pat = re.compile(r"HTTP/\d.\d\s(\d+)", re.I) HTTP_OK = 200 HTTP_ACCEPTED = 202 diff --git a/fax/soapfax.py b/fax/soapfax.py index ee3e152..a68e73c 100644 --- a/fax/soapfax.py +++ b/fax/soapfax.py @@ -42,7 +42,7 @@ from base.sixext import to_bytes_utf8 # **************************************************************************** # -http_result_pat = re.compile("""HTTP/\d.\d\s(\d+)""", re.I) +http_result_pat = re.compile(r"""HTTP/\d.\d\s(\d+)""", re.I) TIME_FORMAT_AM_PM = 1 diff --git a/makeuri.py b/makeuri.py index 2838f57..cce7c97 100755 --- a/makeuri.py +++ b/makeuri.py @@ -46,7 +46,7 @@ USAGE = [ (__doc__, "", "name", True), ("DEVNODE (parallel only):", '"/dev/parportX", X=0,1,2,...', "option", False), ("SERIAL NO. (usb and parallel only):", '"serial no."', "option", True), utils.USAGE_OPTIONS, - ("To specify the port on a multi-port JetDirect:", "-p or --port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), + ("To specify the port on a multi-port JetDirect:", r"-p or --port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), ("Show the CUPS URI only (quiet mode):", "-c or --cups", "option", False), ("Show the SANE URI only (quiet mode):", "-s or --sane", "option", False), ("Show the HP Fax URI only (quiet mode):", "-f or --fax", "option", False), diff --git a/probe.py b/probe.py index 82e5de9..375f6f1 100755 --- a/probe.py +++ b/probe.py @@ -42,11 +42,11 @@ USAGE = [(__doc__, "", "name", True), ("Usage: %s [OPTIONS]" % __mod__, "", "summary", True), utils.USAGE_OPTIONS, ("Bus to probe:", "-b or --bus=", "option", False), - ("", ": cups, usb\*, net, bt, fw, par (\*default) (Note: bt and fw not supported in this release.)", "option", False), + ("", r": cups, usb\*, net, bt, fw, par (\*default) (Note: bt and fw not supported in this release.)", "option", False), ("Set Time to Live (TTL):", "-t or --ttl= (Default is 4).", "option", False), ("Set timeout:", "-o or --timeout=", "option", False), ("Filter by functionality:", "-e or --filter=", "option", False), - ("", ": comma separated list of one or more of: scan, pcard, fax, copy, or none\*. (\*none is the default)", "option", False), + ("", r": comma separated list of one or more of: scan, pcard, fax, copy, or none\*. (\*none is the default)", "option", False), ("Search:", "-s or --search=", "option", False), ("", " must be a valid regular expression (not case sensitive)", "option", False), ("Network discovery method:", "-m or --method=: is 'slp'* or 'mdns'.", "option", False), diff --git a/scan.py b/scan.py index b0e78e3..c1450bf 100755 --- a/scan.py +++ b/scan.py @@ -281,7 +281,7 @@ try: ("Scan destinations:", "-s or --dest=", "option", False), ("", "where is a comma separated list containing one or more of: 'file'", "option", False), ("", ", 'viewer', 'editor', 'pdf', or 'print'. Use only commas between values, no spaces.", "option", False), - ("Scan mode:", "-m or --mode=. Where is 'gray'\*, 'color' or 'lineart'.", "option", False), + ("Scan mode:", r"-m or --mode=. Where is 'gray'\*, 'color' or 'lineart'.", "option", False), ("Scanning resolution:", "-r or --res= or --resolution=", "option", False), ("", "where 300 is default.", "option", False), ("Image resize:", "--resize= (min=1%, max=400%, default=100%)", "option", False),