Fix more warnings

This commit is contained in:
Zdenek Dohnal 2023-07-27 17:12:37 +02:00
parent a15ae7afb4
commit f9aafff426

View File

@ -1,3 +1,16 @@
diff --git a/base/LedmWifi.py b/base/LedmWifi.py
index f63a050..074d5a2 100644
--- a/base/LedmWifi.py
+++ b/base/LedmWifi.py
@@ -31,7 +31,7 @@ from .g import *
from . import device, utils
from .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)
HTTP_OK = 200
HTTP_ACCEPTED = 202
HTTP_NOCONTENT = 204
diff --git a/base/device.py b/base/device.py
index fbe6c34..a551403 100644
--- a/base/device.py
@ -124,6 +137,28 @@ index 259bf82..a4ed107 100644
self.__password_prompt_str = cb
try:
diff --git a/base/queues.py b/base/queues.py
index 0818574..8625f53 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)
@@ -149,7 +149,7 @@ def parseQueues(mode):
desc=''
else:
try:
- desc = to_string_utf8( NICKNAME_PATTERN.search(fileptr).group(1) )
+ desc = to_string_utf8( NICKNAME_PATTERN.search(fileptr.decode('utf-8')).group(1) )
except AttributeError:
desc = ''
diff --git a/base/status.py b/base/status.py
index 37c774e..01f455d 100644
--- a/base/status.py
@ -215,6 +250,41 @@ index 2b631ce..2fb57c4 100644
try:
while cnt <len(installed_array) and cnt <len(available_array):
diff --git a/check.py b/check.py
index 284b88e..86ca832 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')
@@ -682,7 +682,7 @@ class DependenciesCheck(object):
out =''
for g in getfacl_out_list:
- if 'getfacl' not in g and '' is not g and 'file' not in g:
+ if 'getfacl' not in g and '' != g and 'file' not in g:
pat = re.compile('''.*:(.*)''')
if pat.search(g):
out = out +' '+ pat.search(g).group(1)
diff --git a/fax/soapfax.py b/fax/soapfax.py
index 9865726..344cb34 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/installer/dcheck.py b/installer/dcheck.py
index a1a4f02..4dbee59 100644
--- a/installer/dcheck.py
@ -239,6 +309,19 @@ index a1a4f02..4dbee59 100644
xsane_ver_info = output.splitlines()[0]
if xsane_ver_pat.search(xsane_ver_info):
installed_ver = xsane_ver_pat.search(xsane_ver_info).group(1)
diff --git a/makeuri.py b/makeuri.py
index 4a10de8..6343e31 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<port> or --port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
+ ("To specify the port on a multi-port JetDirect:", r"-p<port> or --port=<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/prnt/cups.py b/prnt/cups.py
index 1ea3099..78b8adc 100644
--- a/prnt/cups.py
@ -270,8 +353,33 @@ index 2041fb6..2b43ece 100755
("Search:", "-s<search re> or --search=<search re>", "option", False),
("", "<search re> must be a valid regular expression (not case sensitive)", "option", False),
("Network discovery method:", "-m<method> or --method=<method>: <method> is 'slp'* or 'mdns'.", "option", False),
diff --git a/scan.py b/scan.py
index 0bfa6f5..27b8c2e 100755
--- a/scan.py
+++ b/scan.py
@@ -249,9 +249,9 @@ try:
extra_options=[utils.USAGE_SPACE,
("[OPTIONS] (General)", "", "header", False),
("Scan destinations:", "-s<dest_list> or --dest=<dest_list>", "option", False),
- ("", "where <dest_list> is a comma separated list containing one or more of: 'file'\*, ", "option", False),
+ ("", r"where <dest_list> 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<mode> or --mode=<mode>. Where <mode> is 'gray'\*, 'color' or 'lineart'.", "option", False),
+ ("Scan mode:", r"-m<mode> or --mode=<mode>. Where <mode> is 'gray'\*, 'color' or 'lineart'.", "option", False),
("Scanning resolution:", "-r<resolution_in_dpi> or --res=<resolution_in_dpi> or --resolution=<resolution_in_dpi>", "option", False),
("", "where 300 is default.", "option", False),
("Image resize:", "--resize=<scale_in_%> (min=1%, max=400%, default=100%)", "option", False),
@@ -268,7 +268,7 @@ try:
utils.USAGE_SPACE,
("[OPTIONS] (Scan area)", "", "header", False),
("Specify the units for area/box measurements:", "-t<units> or --units=<units>", "option", False),
- ("", "where <units> is 'mm'\*, 'cm', 'in', 'px', or 'pt' ('mm' is default).", "option", False),
+ ("", r"where <units> is 'mm'\*, 'cm', 'in', 'px', or 'pt' ('mm' is default).", "option", False),
("Scan area:", "-a<tlx>,<tly>,<brx>,<bry> or --area=<tlx>,<tly>,<brx>,<bry>", "option", False),
("", "Coordinates are relative to the upper left corner of the scan area.", "option", False),
("", "Units for tlx, tly, brx, and bry are specified by -t/--units (default is 'mm').", "option", False),
diff --git a/setup.py b/setup.py
index 98f57fd..539be50 100755
index 98f57fd..1a74d6d 100755
--- a/setup.py
+++ b/setup.py
@@ -79,11 +79,11 @@ USAGE = [ (__doc__, "", "name", True),
@ -279,12 +387,34 @@ index 98f57fd..539be50 100755
utils.USAGE_OPTIONS,
("Automatic mode:", "-a or --auto (-i mode only)", "option", False),
- ("To specify the port on a multi-port JetDirect:", "--port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
+ (r"To specify the port on a multi-port JetDirect:", "--port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
+ ("To specify the port on a multi-port JetDirect:", r"--port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
("No testpage in automatic mode:", "-x (-i mode only)", "option", False),
("To specify a CUPS printer queue name:", "-p<printer> or --printer=<printer> (-i mode only)", "option", False),
("To specify a CUPS fax queue name:", "-f<fax> or --fax=<fax> (-i mode only)", "option", False),
- ("Type of queue(s) to install:", "-t<typelist> or --type=<typelist>. <typelist>: print*, fax\* (\*default) (-i mode only)", "option", False),
+ (r"Type of queue(s) to install:", "-t<typelist> or --type=<typelist>. <typelist>: print*, fax\* (\*default) (-i mode only)", "option", False),
+ ("Type of queue(s) to install:", r"-t<typelist> or --type=<typelist>. <typelist>: print*, fax\* (\*default) (-i mode only)", "option", False),
("To specify the device URI to install:", "-d<device> or --device=<device> (--qt4 mode only)", "option", False),
("Remove printers or faxes instead of setting-up:", "-r or --rm or --remove", "option", False),
utils.USAGE_LANGUAGE,
diff --git a/ui5/devmgr_ext.py b/ui5/devmgr_ext.py
index 34b4977..6b7a61e 100644
--- a/ui5/devmgr_ext.py
+++ b/ui5/devmgr_ext.py
@@ -12,7 +12,7 @@ class Ui_MainWindow_Derived(object):
self.latest_available_version = latest_available_version
self.Is_autoInstaller_distro = Is_autoInstaller_distro
- if self.latest_available_version is not "":
+ if self.latest_available_version != "":
self.tab_3 = QWidget()
self.tab_3.setObjectName("tab_3")
self.label = QLabel(self.tab_3)
@@ -34,7 +34,7 @@ class Ui_MainWindow_Derived(object):
def retranslateUi(self, MainWindow):
super(Ui_MainWindow_Derived, self).retranslateUi(MainWindow)
- if self.latest_available_version is not "":
+ if self.latest_available_version != "":
self.label.setText(QApplication.translate("MainWindow", "New version of HPLIP-%s is available"%self.latest_available_version, None))
self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), QApplication.translate("MainWindow", "Upgrade", None))
if self.Is_autoInstaller_distro: