Skip to content

Commit 9c4773e

Browse files
committed
Fix all DeprecationWarning: invalid escape sequence
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
1 parent 7ba9d35 commit 9c4773e

File tree

13 files changed

+17
-17
lines changed

13 files changed

+17
-17
lines changed

source_py2/python_toolbox/address_tools/shared.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88

99
_address_pattern = re.compile(
10-
"^(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)$"
10+
r"^(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)$"
1111
)
1212
'''Pattern for Python addresses, like 'email.encoders'.'''
1313

1414

1515
_contained_address_pattern = re.compile(
16-
"(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)"
16+
r"(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)"
1717
)
1818
'''
1919
Pattern for strings containing Python addresses, like '{email.encoders: 1}'.

source_py2/python_toolbox/address_tools/string_to_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def resolve(string, root=None, namespace={}):
7373

7474

7575
def get_object_by_address(address, root=None, namespace={}):
76-
'''
76+
r'''
7777
Get an object by its address.
7878
7979
For example:

source_py2/python_toolbox/third_party/decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def getargspec(f):
7777
spec = getfullargspec(f)
7878
return ArgSpec(spec.args, spec.varargs, spec.varkw, spec.defaults)
7979

80-
DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(')
80+
DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
8181

8282

8383
# basic functionality

source_py2/test_python_toolbox/test_cute_testing/test_raise_assertor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ def test_regex():
8282
'''
8383
Test using `RaiseAssertor` specifying regex pattern for exception message.
8484
'''
85-
with RaiseAssertor(Exception, re.compile('^123\w*?456$')):
85+
with RaiseAssertor(Exception, re.compile(r'^123\w*?456$')):
8686
raise TypeError('123qwerty456')
8787

8888
with RaiseAssertor(Failure):
8989
with RaiseAssertor(Exception, re.compile('^ooga b?ooga$')):
9090
raise TypeError('123qwerty456')
9191

9292
with RaiseAssertor(Failure):
93-
with RaiseAssertor(OSError, re.compile('^123\w*?456$')):
93+
with RaiseAssertor(OSError, re.compile(r'^123\w*?456$')):
9494
raise SyntaxError('123qwerty456')
9595

9696

source_py2/test_python_toolbox/test_nifty_collections/test_bagging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_common(self):
7979
with cute_testing.RaiseAssertor(TypeError):
8080
- bag
8181

82-
assert re.match('^(Frozen)?(Ordered)?Bag\(.*$', repr(bag))
82+
assert re.match(r'^(Frozen)?(Ordered)?Bag\(.*$', repr(bag))
8383

8484
assert bag.copy() == bag
8585

source_py2/test_python_toolbox/test_re_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
def test_searchall():
1313
'''Test the basic workings of `searchall`.'''
1414
s = 'asdf df sfg s'
15-
result = searchall('(\w+)', s)
15+
result = searchall(r'(\w+)', s)
1616
assert len(result) == 4

source_py3/python_toolbox/address_tools/shared.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88

99
_address_pattern = re.compile(
10-
"^(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)$"
10+
r"^(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)$"
1111
)
1212
'''Pattern for Python addresses, like 'email.encoders'.'''
1313

1414

1515
_contained_address_pattern = re.compile(
16-
"(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)"
16+
r"(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)"
1717
)
1818
'''
1919
Pattern for strings containing Python addresses, like '{email.encoders: 1}'.

source_py3/python_toolbox/address_tools/string_to_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def resolve(string, root=None, namespace={}):
7373

7474

7575
def get_object_by_address(address, root=None, namespace={}):
76-
'''
76+
r'''
7777
Get an object by its address.
7878
7979
For example:

source_py3/python_toolbox/file_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _get_next_path(path):
4848

4949

5050
def iterate_file_paths(path):
51-
'''
51+
r'''
5252
Iterate over file paths, hoping to find one that's available.
5353
5454
For example, when given "c:\example.ogg", would first yield

source_py3/python_toolbox/third_party/decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def getargspec(f):
7777
spec = getfullargspec(f)
7878
return ArgSpec(spec.args, spec.varargs, spec.varkw, spec.defaults)
7979

80-
DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(')
80+
DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
8181

8282

8383
# basic functionality

0 commit comments

Comments
 (0)