From eccdf07ae387765c377d29eb3ebfad4d7bc2fcf6 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sun, 28 Oct 2018 01:44:57 +0300 Subject: [PATCH] python fix lint warnings flake8 started to report warnings like this: test/zdtm.py:1337:6: W605 invalid escape sequence '\S' Signed-off-by: Andrei Vagin --- scripts/flake8.cfg | 3 ++- test/zdtm.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/flake8.cfg b/scripts/flake8.cfg index 492129eca..9e98787a8 100644 --- a/scripts/flake8.cfg +++ b/scripts/flake8.cfg @@ -5,4 +5,5 @@ # E251 unexpected spaces around keyword / parameter equals # E101 indentation contains mixed spaces and tabs # E126 continuation line over-indented for hanging indent -ignore = W191,E128,E501,E251,E101,E126 +# W504 line break after binary operator +ignore = W191,E128,E501,E251,E101,E126,W504 diff --git a/test/zdtm.py b/test/zdtm.py index 19e362cd8..fc549c146 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -122,7 +122,7 @@ def check_core_files(): if not reports: return False - while subprocess.Popen("ps axf | grep 'abrt\.sh'", shell = True).wait() == 0: + while subprocess.Popen(r"ps axf | grep 'abrt\.sh'", shell = True).wait() == 0: time.sleep(1) for i in reports: @@ -189,7 +189,7 @@ class ns_flavor: def __copy_libs(self, binary): ldd = subprocess.Popen(["ldd", binary], stdout = subprocess.PIPE) - xl = re.compile('^(linux-gate.so|linux-vdso(64)?.so|not a dynamic|.*\s*ldd\s)') + xl = re.compile(r'^(linux-gate.so|linux-vdso(64)?.so|not a dynamic|.*\s*ldd\s)') # This Mayakovsky-style code gets list of libraries a binary # needs minus vdso and gate .so-s @@ -1334,7 +1334,7 @@ def get_visible_state(test): cmounts = [] try: - r = re.compile("^\S+\s\S+\s\S+\s(\S+)\s(\S+)\s\S+\s[^-]*?(shared)?[^-]*?(master)?[^-]*?-") + r = re.compile(r"^\S+\s\S+\s\S+\s(\S+)\s(\S+)\s\S+\s[^-]*?(shared)?[^-]*?(master)?[^-]*?-") with open("/proc/%s/root/proc/%s/mountinfo" % (test.getpid(), pid)) as mountinfo: for m in mountinfo: cmounts.append(r.match(m).groups())