kselftest/devices/probe: Fix SyntaxWarning in regex strings for Python3
PATCH v3 1/1 kselftest/devices/probe: Fix SyntaxWarning in regex strings for Python3
Insert raw strings to prevent Python3 from interpreting string literals as Unicode strings and "\d" as invalid escaped sequence.
Fix the warnings:
tools/testing/selftests/devices/probe/test_discoverable_devices.py:48:
SyntaxWarning: invalid escape sequence '\d' usb_controller_sysfs_dir = "usb[\d]+"
tools/testing/selftests/devices/probe/test_discoverable_devices.py: 94:
SyntaxWarning: invalid escape sequence '\d' re_usb_version = re.compile("PRODUCT=.*/(\d)/.*")
discoverable buses")
---
Notes:
v3: Reduce changelog lines lengthy, add warning messages
v2: Imperative mode description, add previous commit tag fix
.../selftests/devices/probe/test_discoverable_devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/devices/probe/test_discoverable_devices.py +2 -2
@@ -45,7 +45,7 @@ def find_pci_controller_dirs(): def find_usb_controller_dirs(): - usb_controller_sysfs_dir = "usb[\d]+" + usb_controller_sysfs_dir = r"usb[\d]+" dir_regex = re.compile(usb_controller_sysfs_dir) for d in os.scandir(sysfs_usb_devices):
@@ -91,7 +91,7 @@ def get_acpi_uid(sysfs_dev_dir): def get_usb_version(sysfs_dev_dir): - re_usb_version = re.compile("PRODUCT=.*/(\d)/.*") + re_usb_version = re.compile(r"PRODUCT=.*/(\d)/.*") with open(os.path.join(sysfs_dev_dir, "uevent")) as f: return int(re_usb_version.search(f.read()).group(1))
Signature · 1 line
2.43.0
Hello,
this email is just a friendly reminder to know if the present patch is going to be applied or not.
Thank you.
Best Regards,
Alessandro Zanni
Quoted 52 lines · Alessandro Zanni
Insert raw strings to prevent Python3 from interpreting string literals as Unicode strings and "\d" as invalid escaped sequence.
Fix the warnings:
tools/testing/selftests/devices/probe/test_discoverable_devices.py:48:
SyntaxWarning: invalid escape sequence '\d'usb_controller_sysfs_dir= "usb[\d]+"
tools/testing/selftests/devices/probe/test_discoverable_devices.py: 94:
SyntaxWarning: invalid escape sequence '\d're_usb_version= re.compile("PRODUCT=.*/(\d)/.*")Fixes dacf1d7a78bf ("kselftest: Add test to verify probe of devices fromdiscoverable buses")
Reviewed-by Nícolas F. R. A. Prado <[email protected]>Signed-off-by Alessandro Zanni <[email protected]>---
Notes:
v3: Reduce changelog lines lengthy, add warning messages
v2: Imperative mode description, add previous commit tag fix.../selftests/devices/probe/test_discoverable_devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/devices/probe/test_discoverable_devices.py +2
-2@@ -45,7 +45,7 @@ def find_pci_controller_dirs(): def find_usb_controller_dirs(): - usb_controller_sysfs_dir = "usb[\d]+" + usb_controller_sysfs_dir = r"usb[\d]+" dir_regex = re.compile(usb_controller_sysfs_dir) for d in os.scandir(sysfs_usb_devices):@@ -91,7 +91,7 @@ def get_acpi_uid(sysfs_dev_dir): def get_usb_version(sysfs_dev_dir): - re_usb_version = re.compile("PRODUCT=.*/(\d)/.*") + re_usb_version = re.compile(r"PRODUCT=.*/(\d)/.*") with open(os.path.join(sysfs_dev_dir, "uevent")) as f: return int(re_usb_version.search(f.read()).group(1))Signature · 1 line
2.43.0
Shuah Khan
maintainerQuoted 8 lines · Alessandro Zanni
Hello,
this email is just a friendly reminder to know if the present patch is going to be applied or not.
Thank you.
Best Regards,
Alessandro Zanni
No top posting please.
Quoted 10 lines · Alessandro Zanni
Quoted 9 lines
Insert raw strings to prevent Python3 from interpreting string literals as Unicode strings and "\d" as invalid escaped sequence.
Fix the warnings:
tools/testing/selftests/devices/probe/test_discoverable_devices.py:48:
SyntaxWarning: invalid escape sequence '\d'usb_controller_sysfs_dir= "usb[\d]+"
Quoted 7 lines
Quoted 7 lines
tools/testing/selftests/devices/probe/test_discoverable_devices.py: 94:
SyntaxWarning: invalid escape sequence '\d're_usb_version= re.compile("PRODUCT=.*/(\d)/.*")Fixes dacf1d7a78bf ("kselftest: Add test to verify probe of devices fromdiscoverable buses")
checkpatch complained about
WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 160c826b4dd0 ("selftest: hid: add missing run-hid-tools-tests.sh")' #110:
Quoted 2 lines
Quoted 2 lines
Reviewed-by Nícolas F. R. A. Prado <[email protected]>Signed-off-by Alessandro Zanni <[email protected]>
Run checkpatch before sending the patch. I fixed the problem and applied to linux-kselftest fixes branch for next rc.
Sorry for the delay.
thanks,
-- Shuah