Skip to content

Deprecation warning due to invalid escape sequences #16

@tirkarthi

Description

@tirkarthi

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' | grep -Ev 'vendor|example|doc|sphinx' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./telegraf/utils.py:9: DeprecationWarning: invalid escape sequence \)
  """
./telegraf/utils.py:19: DeprecationWarning: invalid escape sequence \,
  key = key.replace(",", "\,")
./telegraf/utils.py:20: DeprecationWarning: invalid escape sequence \ 
  key = key.replace(" ", "\ ")
./telegraf/utils.py:21: DeprecationWarning: invalid escape sequence \=
  key = key.replace("=", "\=")
./telegraf/tests.py:14: DeprecationWarning: invalid escape sequence \,
  self.assertEquals(format_string('foo,bar'), 'foo\,bar')
./telegraf/tests.py:15: DeprecationWarning: invalid escape sequence \ 
  self.assertEquals(format_string('foo bar'), 'foo\ bar')
./telegraf/tests.py:16: DeprecationWarning: invalid escape sequence \ 
  self.assertEquals(format_string('foo ,bar'), 'foo\ \,bar')
./telegraf/tests.py:17: DeprecationWarning: invalid escape sequence \ 
  self.assertEquals(format_string('foo ,bar,baz=foobar'), 'foo\ \,bar\,baz\=foobar')
./telegraf/tests.py:59: DeprecationWarning: invalid escape sequence \ 
  """white\ space,tag\ with\,\ comma=hello\,\ world value\,\ comma="foo\""""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions