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-15 01:16:58 +0200
commit537ddfff50d6822b752e8e9f10a73abae9c2fc27 (patch)
treec277615e21b0c03cd326010509c2996297606fa5
parent3f081328cad7da4b6830bb37c1375f794d803345 (diff)
downloadnetaddr-537ddfff50d6822b752e8e9f10a73abae9c2fc27.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) + ')$',