Opened 9 months ago

Last modified 8 months ago

#27270 new defect

Pycodestyle "invalid escape sequence" warnings

Reported by: atagar Owned by: atagar
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Interesting catch from Thomas that pycodestyle is emitting a slew of "invalid escape sequence" warnings. This is pycodestyle 2.4.0 and python 3.7 on netbsd. Seems we might have some cross-version stuff to account for here...

https://bugs.python.org/issue27364
https://github.com/PyCQA/pycodestyle/issues/755

> python3.7 run_tests.py --unit
======================================================================
                             INITIALISING
======================================================================

  checking stem version...                             1.6.0-dev
  checking python version...                           3.7.0
  checking cryptography version...                     2.3.1
  checking pynacl version...                           1.1.2
  checking mock version...                             1.0
  checking pyflakes version...                         2.0.0
  checking pycodestyle version...                      2.4.0
  checking for orphaned .pyc files...                  done (0.0s)
  checking for unused tests...                         done (0.0s)
  importing test modules...                            done (0.1s)
  running pyflakes...                                  done (2.4s)
  running pycodestyle...                               done (12.6s)

======================================================================
                              UNIT TESTS
======================================================================

  util.enum...                                         success (0.00s)
  util.connection...                                   success (0.05s)
  util.conf...                                         success (0.00s)
  util.log...                                          success (0.00s)
  util.proc...                                         success (0.02s)
  util.str_tools...                                    success (0.00s)
  util.system...                                       success (0.02s)
  util.term...                                         success (0.00s)
  util.tor_tools...                                    success (0.00s)
  util.__init__...                                     success (0.00s)
  installation...                                      success (0.00s)
  descriptor.export...                                 success (0.01s)
  descriptor.reader...                                 success (0.11s)
  descriptor.remote...                                 success (0.32s)
  descriptor.server_descriptor...                      success (0.12s)
  descriptor.extrainfo_descriptor...                   success (0.13s)
  descriptor.microdescriptor...                        success (0.01s)
  descriptor.router_status_entry...                    success (0.04s)
  descriptor.tordnsel...                               success (0.00s)
  descriptor.networkstatus.directory_authority...      success (0.02s)
  descriptor.networkstatus.key_certificate...          success (0.02s)
  descriptor.networkstatus.document_v2...              success (0.00s)
  descriptor.networkstatus.document_v3...              success (0.16s)
  descriptor.networkstatus.bridge_document...          success (0.00s)
  descriptor.hidden_service_descriptor...              success (0.02s)
  descriptor.certificate...                            success (0.01s)
  exit_policy.rule...                                  success (0.02s)
  exit_policy.policy...                                success (0.08s)
  endpoint...                                          success (0.00s)
  version...                                           success (0.01s)
  manual...                                            success (0.02s)
  directory.authority...                               success (0.00s)
  directory.fallback...                                success (0.04s)
  tutorial...                                          success (0.02s)
  tutorial_examples...                                 success (0.04s)
  response.add_onion...                                success (0.00s)
  response.control_message...                          success (0.01s)
  response.control_line...                             success (0.00s)
  response.events...                                   success (0.08s)
  response.getinfo...                                  success (0.00s)
  response.getconf...                                  success (0.00s)
  response.singleline...                               success (0.00s)
  response.authchallenge...                            success (0.00s)
  response.protocolinfo...                             success (0.00s)
  response.mapaddress...                               success (0.00s)
  client.size...                                       success (0.00s)
  client.address...                                    success (0.00s)
  client.link_protocol...                              success (0.00s)
  client.certificate...                                success (0.00s)
  client.kdf...                                        success (0.00s)
  client.cell...                                       success (0.02s)
  connection.authentication...                         success (0.10s)
  connection.connect...                                success (0.01s)
  control.controller...                                success (0.40s)
  interpreter.arguments...                             success (0.01s)
  interpreter.autocomplete...                          success (0.00s)
  interpreter.help...                                  success (0.00s)
  interpreter.commands...                              success (0.01s)
  doctest...                                           success (0.08s)

STATIC CHECKS
* /disk/6/archive/foreign/stem/test/unit/control/controller.py
  line 8    - 'time' imported but unused               | import time

* /disk/6/archive/foreign/stem/stem/connection.py
  line 526  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/directory.py
  line 65   - W605 invalid escape sequence '\d'        | AUTHORITY_NAME = re.compile('"(\S+) orport=(\d+) .*"')
  line 65   - W605 invalid escape sequence '\S'        | AUTHORITY_NAME = re.compile('"(\S+) orport=(\d+) .*"')
  line 66   - W605 invalid escape sequence '\d'        | AUTHORITY_V3IDENT = re.compile('"v3ident=([\dA-F]{40}) "')
  line 67   - W605 invalid escape sequence '\d'        | AUTHORITY_IPV6 = re.compile('"ipv6=\[([\da-f:]+)\]:(\d+) "')
  line 67   - W605 invalid escape sequence '\['        | AUTHORITY_IPV6 = re.compile('"ipv6=\[([\da-f:]+)\]:(\d+) "')
  line 67   - W605 invalid escape sequence '\]'        | AUTHORITY_IPV6 = re.compile('"ipv6=\[([\da-f:]+)\]:(\d+) "')
  line 68   - W605 invalid escape sequence '\d'        | AUTHORITY_ADDR = re.compile('"([\d\.]+):(\d+) ([\dA-F ]{49})",')
  line 68   - W605 invalid escape sequence '\.'        | AUTHORITY_ADDR = re.compile('"([\d\.]+):(\d+) ([\dA-F ]{49})",')
  line 71   - W605 invalid escape sequence '\S'        | FALLBACK_MAPPING = re.compile('/\*\s+(\S+)=(\S*)\s+\*/')
  line 71   - W605 invalid escape sequence '\s'        | FALLBACK_MAPPING = re.compile('/\*\s+(\S+)=(\S*)\s+\*/')
  line 71   - W605 invalid escape sequence '\*'        | FALLBACK_MAPPING = re.compile('/\*\s+(\S+)=(\S*)\s+\*/')
  line 73   - W605 invalid escape sequence '\d'        | FALLBACK_ADDR = re.compile('"([\d\.]+):(\d+) orport=(\d+) id=([\dA-F]{40}).*')
  line 73   - W605 invalid escape sequence '\.'        | FALLBACK_ADDR = re.compile('"([\d\.]+):(\d+) orport=(\d+) id=([\dA-F]{40}).*')
  line 74   - W605 invalid escape sequence '\S'        | FALLBACK_NICKNAME = re.compile('/\* nickname=(\S+) \*/')
  line 74   - W605 invalid escape sequence '\*'        | FALLBACK_NICKNAME = re.compile('/\* nickname=(\S+) \*/')
  line 75   - W605 invalid escape sequence '\*'        | FALLBACK_EXTRAINFO = re.compile('/\* extrainfo=([0-1]) \*/')
  line 76   - W605 invalid escape sequence '\d'        | FALLBACK_IPV6 = re.compile('" ipv6=\[([\da-f:]+)\]:(\d+)"')
  line 76   - W605 invalid escape sequence '\]'        | FALLBACK_IPV6 = re.compile('" ipv6=\[([\da-f:]+)\]:(\d+)"')
  line 76   - W605 invalid escape sequence '\['        | FALLBACK_IPV6 = re.compile('" ipv6=\[([\da-f:]+)\]:(\d+)"')

* /disk/6/archive/foreign/stem/stem/exit_policy.py
  line 142  - W605 invalid escape sequence '\d'        | if not re.search(':[\d\-\*]+$', rule):
  line 142  - W605 invalid escape sequence '\*'        | if not re.search(':[\d\-\*]+$', rule):
  line 142  - W605 invalid escape sequence '\-'        | if not re.search(':[\d\-\*]+$', rule):
  line 652  - W605 invalid escape sequence '\*'        | """
  line 716  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/process.py
  line 137  - W605 invalid escape sequence '\]'        | problem_line = re.compile('\[(warn|err)\] (.*)$')
  line 137  - W605 invalid escape sequence '\['        | problem_line = re.compile('\[(warn|err)\] (.*)$')

* /disk/6/archive/foreign/stem/stem/descriptor/__init__.py
  line 246  - W605 invalid escape sequence '\S'        | metrics_header_match = re.match('^@type (\S+) (\d+).(\d+)$', first_line)
  line 246  - W605 invalid escape sequence '\d'        | metrics_header_match = re.match('^@type (\S+) (\d+).(\d+)$', first_line)
  line 259  - W605 invalid escape sequence '\S'        | descriptor_type_match = re.match('^(\S+) (\d+).(\d+)$', descriptor_type)
  line 259  - W605 invalid escape sequence '\d'        | descriptor_type_match = re.match('^(\S+) (\d+).(\d+)$', descriptor_type)

* /disk/6/archive/foreign/stem/stem/descriptor/extrainfo_descriptor.py
  line 68   - W605 invalid escape sequence '\*'        | """
  line 165  - W605 invalid escape sequence '\('        | _timestamp_re = re.compile('^(.*) \(([0-9]+) s\)( .*)?$')
  line 165  - W605 invalid escape sequence '\)'        | _timestamp_re = re.compile('^(.*) \(([0-9]+) s\)( .*)?$')
  line 166  - W605 invalid escape sequence '\?'        | _locale_re = re.compile('^[a-zA-Z0-9\?]{2}$')
  line 694  - W605 invalid escape sequence '\*'        | """
  line 904  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/hidden_service_descriptor.py
  line 214  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/microdescriptor.py
  line 234  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/networkstatus.py
  line 443  - W605 invalid escape sequence '\*'        | """
  line 896  - W605 invalid escape sequence '\*'        | """
  line 1409 - W605 invalid escape sequence '\*'        | """
  line 1614 - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/router_status_entry.py
  line 20   - W605 invalid escape sequence '\*'        | """
  line 405  - W605 invalid escape sequence '\*'        | """
  line 511  - W605 invalid escape sequence '\*'        | """
  line 592  - W605 invalid escape sequence '\*'        | """
  line 685  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/server_descriptor.py
  line 48   - W605 invalid escape sequence '\*'        | """
  line 289  - W605 invalid escape sequence '\S'        | platform_match = re.match('^(?:node-)?Tor (\S*).* on (.*)$', value)
  line 529  - W605 invalid escape sequence '\*'        | """
  line 794  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/descriptor/tordnsel.py
  line 61   - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/stem/response/__init__.py
  line 53   - W605 invalid escape sequence '\S'        | KEY_ARG = re.compile('^(\S+)=')

* /disk/6/archive/foreign/stem/stem/response/events.py
  line 22   - W605 invalid escape sequence '\S'        | KW_ARG = re.compile('^(.*) ([A-Za-z0-9_]+)=(\S*)$')

* /disk/6/archive/foreign/stem/stem/util/connection.py
  line 55   - W605 invalid escape sequence '\*'        | """
  line 124  - W605 invalid escape sequence '\s'        | RESOLVER_FILTER = {
  line 124  - W605 invalid escape sequence '\S'        | RESOLVER_FILTER = {
  line 125  - W605 invalid escape sequence '\s'        | Resolver.PROC: '',
  line 125  - W605 invalid escape sequence '\S'        | Resolver.PROC: '',
  line 128  - W605 invalid escape sequence '\)'        | Resolver.NETSTAT: '^{protocol}\s+.*\s+{local}\s+{remote}\s+ESTABLISHED\s+{pid}/{name}\s*$',
  line 128  - W605 invalid escape sequence '\S'        | Resolver.NETSTAT: '^{protocol}\s+.*\s+{local}\s+{remote}\s+ESTABLISHED\s+{pid}/{name}\s*$',
  line 128  - W605 invalid escape sequence '\('        | Resolver.NETSTAT: '^{protocol}\s+.*\s+{local}\s+{remote}\s+ESTABLISHED\s+{pid}/{name}\s*$',
  line 128  - W605 invalid escape sequence '\s'        | Resolver.NETSTAT: '^{protocol}\s+.*\s+{local}\s+{remote}\s+ESTABLISHED\s+{pid}/{name}\s*$',
  line 245  - W605 invalid escape sequence '\]'        | resolver_regex_str = RESOLVER_FILTER[resolver].format(
  line 245  - W605 invalid escape sequence '\S'        | resolver_regex_str = RESOLVER_FILTER[resolver].format(
  line 245  - W605 invalid escape sequence '\['        | resolver_regex_str = RESOLVER_FILTER[resolver].format(
  line 766  - W504 line break after binary operator    | _hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, x) ==

* /disk/6/archive/foreign/stem/stem/util/system.py
  line 709  - W605 invalid escape sequence '\s'        | tasklist_regex = re.compile('^\s*%s\s+(?P<pid>[0-9]*)' % process_name)

* /disk/6/archive/foreign/stem/stem/util/test_tools.py
  line 333  - W605 invalid escape sequence '\*'        | """

* /disk/6/archive/foreign/stem/test/output.py
  line 150  - W605 invalid escape sequence '\.'        | m = re.match('.*( \(test\..*?\)).*', line_content)
  line 150  - W605 invalid escape sequence '\('        | m = re.match('.*( \(test\..*?\)).*', line_content)
  line 150  - W605 invalid escape sequence '\)'        | m = re.match('.*( \(test\..*?\)).*', line_content)
  line 163  - W605 invalid escape sequence '\.'        | m = re.search('(test\.[^)]*)', line_content)
  line 264  - W605 invalid escape sequence '\.'        | module_match = re.match('.*\((test\.\S+)\.\S+\).*', line_content)
  line 264  - W605 invalid escape sequence '\)'        | module_match = re.match('.*\((test\.\S+)\.\S+\).*', line_content)
  line 264  - W605 invalid escape sequence '\S'        | module_match = re.match('.*\((test\.\S+)\.\S+\).*', line_content)
  line 264  - W605 invalid escape sequence '\('        | module_match = re.match('.*\((test\.\S+)\.\S+\).*', line_content)

* /disk/6/archive/foreign/stem/test/task.py
  line 125  - W605 invalid escape sequence '\S'        | test_match = re.search('^class (\S*)\(unittest.TestCase\):$', file_contents, re.MULTILINE)
  line 125  - W605 invalid escape sequence '\)'        | test_match = re.search('^class (\S*)\(unittest.TestCase\):$', file_contents, re.MULTILINE)
  line 125  - W605 invalid escape sequence '\('        | test_match = re.search('^class (\S*)\(unittest.TestCase\):$', file_contents, re.MULTILINE)

* /disk/6/archive/foreign/stem/test/integ/util/system.py
  line 275  - W504 line break after binary operator    | elif not (stem.util.system.is_available('netstat') or
  line 276  - W504 line break after binary operator    | stem.util.system.is_available('sockstat') or

* /disk/6/archive/foreign/stem/test/unit/installation.py
  line 34   - W605 invalid escape sequence '\['        | modules = json.loads(re.search('packages = (\[.*\])', self.setup_contents).group(1).replace("'", '"'))
  line 34   - W605 invalid escape sequence '\]'        | modules = json.loads(re.search('packages = (\[.*\])', self.setup_contents).group(1).replace("'", '"'))

* /disk/6/archive/foreign/stem/test/unit/directory/fallback.py
  line 134  - W605 invalid escape sequence '\*'        | self.assertRaisesRegexp(IOError, 'Malformed fallback directory header line: /\* version \*/', stem.directory.Fallback.from_remote)

* /disk/6/archive/foreign/stem/cache_manual.py
  line 22   - W605 invalid escape sequence '\?'        | MAN_LOG_LINK = "href='/tor.git/commit/doc/tor.1.txt\?id=([^']*)'"

* /disk/6/archive/foreign/stem/cache_fallback_directories.py
  line 22   - W605 invalid escape sequence '\?'        | FALLBACK_DIR_LINK = "href='/tor.git/commit/src/or/fallback_dirs.inc\?id=([^']*)'"

5 TESTS WERE SKIPPED
TESTING PASSED (17 seconds)

Child Tickets

Change History (1)

comment:1 Changed 8 months ago by atagar

Tried upgrading to pycodestyle 2.4.0 but I don't get these failures. Guess it's a compatibility issue with python 3.7?

Note: See TracTickets for help on using tickets.