summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGinnis <sean.mcginnis@gmail.com>2019-04-09 14:37:52 -0500
committerJakub Stasiak <jakub@stasiak.at>2020-06-14 17:53:47 +0200
commitf132628a4faf897f7fc986b0c07c5525035f7ec4 (patch)
treeba77500db7b90b3e9b9b2c8888af51023ef8f5c2
parentf83cdff77154648da36dbab4d295701693a2e78f (diff)
downloadnetaddr-f132628a4faf897f7fc986b0c07c5525035f7ec4.tar.gz
Use raw strings for escape characters used in regex
There were a couple instances of strings using the '\' character. Starting with Python 3.6, normal strings that contain these types of characters cause DeprecationWarnings to be raised, and presumably will eventually stop allowing them completely. This updates the two cases of using the '\' character to be raw strings to allow it without extra special escaping of the characters. Closes #184 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> (cherry picked from commit 460705fbb8335825df7996163903e1801a9c0163)
-rw-r--r--netaddr/strategy/eui48.py2
-rw-r--r--netaddr/strategy/eui64.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/netaddr/strategy/eui48.py b/netaddr/strategy/eui48.py
index 462afff..5685e34 100644
--- a/netaddr/strategy/eui48.py
+++ b/netaddr/strategy/eui48.py
@@ -120,7 +120,7 @@ RE_MAC_FORMATS = (
# 4 bytes x 3 (Cisco)
'^' + ':'.join(['([0-9A-F]{1,4})'] * 3) + '$',
'^' + '-'.join(['([0-9A-F]{1,4})'] * 3) + '$',
- '^' + '\.'.join(['([0-9A-F]{1,4})'] * 3) + '$',
+ '^' + r'\.'.join(['([0-9A-F]{1,4})'] * 3) + '$',
# 6 bytes x 2 (PostgreSQL)
'^' + '-'.join(['([0-9A-F]{5,6})'] * 2) + '$',
diff --git a/netaddr/strategy/eui64.py b/netaddr/strategy/eui64.py
index 4f7932a..f4b0ba7 100644
--- a/netaddr/strategy/eui64.py
+++ b/netaddr/strategy/eui64.py
@@ -107,7 +107,7 @@ RE_EUI64_FORMATS = (
# 4 bytes x 4 (Cisco like)
'^' + ':'.join(['([0-9A-F]{1,4})'] * 4) + '$',
'^' + '-'.join(['([0-9A-F]{1,4})'] * 4) + '$',
- '^' + '\.'.join(['([0-9A-F]{1,4})'] * 4) + '$',
+ '^' + r'\.'.join(['([0-9A-F]{1,4})'] * 4) + '$',
# 16 bytes (bare, no delimiters)
'^(' + ''.join(['[0-9A-F]'] * 16) + ')$',