Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning due to invalid escape sequences #1034

Closed
tirkarthi opened this issue May 20, 2020 · 1 comment
Closed

Deprecation warning due to invalid escape sequences #1034

tirkarthi opened this issue May 20, 2020 · 1 comment

Comments

@tirkarthi
Copy link
Contributor

Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/

find . -iname '*.py' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./lib/jnpr/junos/factory/optable.py:24: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/factory/cmdtable.py:49: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/factory/state_machine.py:242: DeprecationWarning: invalid escape sequence \s
  delimiter = self._table.DELIMITER or '\s\s+'
./lib/jnpr/junos/factory/state_machine.py:247: DeprecationWarning: invalid escape sequence \s
  if re.match(pre_space_delimit + '\s+', line):
./lib/jnpr/junos/factory/state_machine.py:256: DeprecationWarning: invalid escape sequence \d
  regex = '(\d+)\s(.*)' if item_types[
./lib/jnpr/junos/factory/state_machine.py:258: DeprecationWarning: invalid escape sequence \s
  '.*)\s(\d+)'
./lib/jnpr/junos/factory/state_machine.py:396: DeprecationWarning: invalid escape sequence \s
  items = re.split('\s\s+', self._lines[1].strip())
./lib/jnpr/junos/factory/state_machine.py:404: DeprecationWarning: invalid escape sequence \s
  items = re.split('\s\s+', line.strip())
./lib/jnpr/junos/factory/state_machine.py:521: DeprecationWarning: invalid escape sequence \s
  items = re.split('\s\s+', line.strip())
./lib/jnpr/junos/factory/state_machine.py:552: DeprecationWarning: invalid escape sequence \s
  obj = re.search('(\s+).*', line)
./lib/jnpr/junos/factory/state_machine.py:633: DeprecationWarning: invalid escape sequence \s
  delimiter = self._table.DELIMITER or '\s\s+'
./lib/jnpr/junos/factory/state_machine.py:636: DeprecationWarning: invalid escape sequence \s
  if re.match(pre_space_delimit + '\s+', line):
./lib/jnpr/junos/factory/state_machine.py:650: DeprecationWarning: invalid escape sequence \d
  regex = '(\d+)\s(.*)' if item_types[0] == int else '(' \
./lib/jnpr/junos/factory/state_machine.py:651: DeprecationWarning: invalid escape sequence \s
  '.*)\s(\d+)'
./lib/jnpr/junos/factory/state_machine.py:665: DeprecationWarning: invalid escape sequence \d
  """
./lib/jnpr/junos/factory/state_machine.py:748: DeprecationWarning: invalid escape sequence \s
  """
./lib/jnpr/junos/factory/state_machine.py:854: DeprecationWarning: invalid escape sequence \s
  delimiter = self._table.DELIMITER or '\s\s+'
./lib/jnpr/junos/factory/state_machine.py:862: DeprecationWarning: invalid escape sequence \s
  obj = re.search('^(\s+).*', self._lines[1])
./lib/jnpr/junos/factory/state_machine.py:914: DeprecationWarning: invalid escape sequence \s
  """
./lib/jnpr/junos/ofacts/routing_engines.py:70: DeprecationWarning: invalid escape sequence \d
  m = RE.search('(\d)', x_re_name[0].text)
./lib/jnpr/junos/ofacts/personality.py:12: DeprecationWarning: invalid escape sequence \d
  if re.match("^RE\d", fact):
./lib/jnpr/junos/ofacts/personality.py:39: DeprecationWarning: invalid escape sequence \s
  elif re.match("SRX\s?(\d){3}", examine):
./lib/jnpr/junos/ofacts/personality.py:37: DeprecationWarning: invalid escape sequence \s
  elif re.match("SRX\s?(\d){4}", examine):
./lib/jnpr/junos/exception.py:312: DeprecationWarning: invalid escape sequence \d
  obj = re.search('line (\d+)', self.ex_msg)
./lib/jnpr/junos/rpcmeta.py:145: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if model and filter_xml is None and options.get('format') \
./lib/jnpr/junos/device.py:393: DeprecationWarning: invalid escape sequence \d
  match = re.search('^re\d+$', re_state)
./lib/jnpr/junos/device.py:843: DeprecationWarning: invalid escape sequence \s
  re.sub('\s?{\s?}\s?', '', rpc_rsp_e.text))
./lib/jnpr/junos/device.py:869: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if rpc_rsp_e.text is not None and rpc_rsp_e.text.strip() is not '':
./lib/jnpr/junos/device.py:1276: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if auto_probe is not 0:
./lib/jnpr/junos/utils/sw.py:104: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/utils/sw.py:117: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/utils/sw.py:130: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/utils/sw.py:143: DeprecationWarning: invalid escape sequence \*
  """
./lib/jnpr/junos/utils/sw.py:924: DeprecationWarning: invalid escape sequence \d
  '(\d+)',
./lib/jnpr/junos/utils/sw.py:1035: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if output_msg is not '':
./lib/jnpr/junos/utils/start_shell.py:7: DeprecationWarning: invalid escape sequence \$
  _SHELL_PROMPT = '(%|#|\$)\s'
./lib/jnpr/junos/utils/start_shell.py:137: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  self.last_ok = got is not ''
./lib/jnpr/junos/utils/ftp.py:61: DeprecationWarning: invalid escape sequence \.
  re.search('\.\w+$', remote_path):
./lib/jnpr/junos/utils/config.py:459: DeprecationWarning: invalid escape sequence \s
  '|annotate|copy|protect|unprotect)\s', rpc):
./lib/jnpr/junos/transport/tty.py:46: DeprecationWarning: invalid escape sequence \s
  _re_pat_login = '(?P<login>ogin:\s*$)'
./lib/jnpr/junos/transport/tty.py:49: DeprecationWarning: invalid escape sequence \s
  '(?P<loader>oader>\s*$)',
./lib/jnpr/junos/transport/tty.py:51: DeprecationWarning: invalid escape sequence \s
  '(?P<passwd>assword:\s*$)',
./lib/jnpr/junos/transport/tty.py:53: DeprecationWarning: invalid escape sequence \s
  '(?P<netconf_closed><!-- session end at .*-->\s*)',
./lib/jnpr/junos/transport/tty.py:54: DeprecationWarning: invalid escape sequence \$
  '(?P<shell>%|#|(~\$)\s*$)',
./lib/jnpr/junos/transport/tty.py:55: DeprecationWarning: invalid escape sequence \s
  '(?P<cli>[^\\-"]>\s*$)',
./lib/jnpr/junos/transport/tty.py:56: DeprecationWarning: invalid escape sequence \s
  '(?P<option>Enter your option:\s*$)',
./lib/jnpr/junos/facts/personality.py:74: DeprecationWarning: invalid escape sequence \s
  elif re.match('SRX\s?(\d){3}', model):
./lib/jnpr/junos/facts/personality.py:67: DeprecationWarning: invalid escape sequence \s
  elif re.match('SRX\s?(\d){4}', model):
./lib/jnpr/junos/facts/swver.py:17: DeprecationWarning: invalid escape sequence \d
  xm = re.match("(\d+)-(\w)(\d+)", self.minor)
./tests/unit/factory/test_cmdtable.py:293: DeprecationWarning: invalid escape sequence \[
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:371: DeprecationWarning: invalid escape sequence \s
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:544: DeprecationWarning: invalid escape sequence \w
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:721: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:758: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:839: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:933: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1013: DeprecationWarning: invalid escape sequence \.
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1106: DeprecationWarning: invalid escape sequence \.
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1139: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1352: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1417: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/factory/test_cmdtable.py:1945: DeprecationWarning: invalid escape sequence \d
  yaml_data = """
./tests/unit/test_console.py:31: DeprecationWarning: invalid escape sequence \s
  mock_expect.side_effect = [(1, re.search('(?P<login>ogin:\s*$)',
./tests/unit/test_console.py:34: DeprecationWarning: invalid escape sequence \s
  (2, re.search('(?P<passwd>assword:\s*$)',
./tests/unit/test_console.py:37: DeprecationWarning: invalid escape sequence \s
  (3, re.search('(?P<shell>%|#\s*$)',
./tests/unit/test_console.py:77: DeprecationWarning: invalid escape sequence \s
  re.search('(?P<login>ogin:\s*$)',
./tests/unit/test_console.py:81: DeprecationWarning: invalid escape sequence \s
  re.search('(?P<passwd>assword:\s*$)',
./tests/unit/test_console.py:103: DeprecationWarning: invalid escape sequence \s
  mock_expect.side_effect = [(1, re.search('(?P<login>ogin:\s*$)',
./tests/unit/test_console.py:107: DeprecationWarning: invalid escape sequence \s
  re.search('(?P<passwd>assword:\s*$)',
./tests/unit/test_console.py:110: DeprecationWarning: invalid escape sequence \s
  (3, re.search('(?P<shell>%|#\s*$)',
./tests/unit/utils/test_start_shell.py:74: DeprecationWarning: invalid escape sequence \(
  self.assertTrue(self.shell.wait_for('---\(more\s?\d*%?\)---\n\s*|%')[0]
./tests/unit/utils/test_start_shell.py:95: DeprecationWarning: invalid escape sequence \(
  '---\(more\s?\d*%?\)---\n\s*|%')[0])
./tests/unit/test_rpcmeta.py:221: DeprecationWarning: invalid escape sequence \(
  "Expecting \'?,\'? delimiter: line 17 column 39 \(char 516\)",
@chidanandpujar
Copy link
Collaborator

Fixed compilation errors issue#1034 #1169
Except one issue ./junos/transport/tty.py:56,
find . -iname '.py' | xargs -P4 -I{} python3.9 -Wall -m py_compile {}
./junos/transport/tty.py:56: DeprecationWarning: invalid escape sequence \s
'(?P[^\\-"]>\s
$)',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants