diff --git a/pyutil/iputil.py b/pyutil/iputil.py index f99cbc0..1054074 100644 --- a/pyutil/iputil.py +++ b/pyutil/iputil.py @@ -177,16 +177,16 @@ class UnsupportedPlatformError(Exception): # ... thus wrote Greg Smith in time immemorial... _win32_path = 'route.exe' _win32_args = ('print',) -_win32_re = re.compile('^\s*\d+\.\d+\.\d+\.\d+\s.+\s(?P
\d+\.\d+\.\d+\.\d+)\s+(?P\d+)\s*$', flags=re.M|re.I|re.S) +_win32_re = re.compile(r'^\s*\d+\.\d+\.\d+\.\d+\s.+\s(?P
\d+\.\d+\.\d+\.\d+)\s+(?P\d+)\s*$', flags=re.M|re.I|re.S) # These work in Redhat 6.x and Debian 2.2 potato _linux_path = '/sbin/ifconfig' -_linux_re = re.compile('^\s*inet [a-zA-Z]*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) +_linux_re = re.compile(r'^\s*inet [a-zA-Z]*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) # NetBSD 1.4 (submitted by Rhialto), Darwin, Mac OS X _netbsd_path = '/sbin/ifconfig' _netbsd_args = ('-a',) -_netbsd_re = re.compile('^\s+inet [a-zA-Z]*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) +_netbsd_re = re.compile(r'^\s+inet [a-zA-Z]*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) # Irix 6.5 _irix_path = '/usr/etc/ifconfig' diff --git a/pyutil/platformutil.py b/pyutil/platformutil.py index 17b146c..de7a73b 100644 --- a/pyutil/platformutil.py +++ b/pyutil/platformutil.py @@ -3,11 +3,11 @@ # Thanks to Daenyth for help porting this to Arch Linux. import os, platform, re, subprocess -_distributor_id_cmdline_re = re.compile("(?:Distributor ID:)\s*(.*)", re.I) -_release_cmdline_re = re.compile("(?:Release:)\s*(.*)", re.I) +_distributor_id_cmdline_re = re.compile(r"(?:Distributor ID:)\s*(.*)", re.I) +_release_cmdline_re = re.compile(r"(?:Release:)\s*(.*)", re.I) -_distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I) -_release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I) +_distributor_id_file_re = re.compile(r"(?:DISTRIB_ID\s*=)\s*(.*)", re.I) +_release_file_re = re.compile(r"(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I) global _distname,_version _distname = None diff --git a/pyutil/test/current/test_iputil.py b/pyutil/test/current/test_iputil.py index 4bd96bf..64c15b9 100644 --- a/pyutil/test/current/test_iputil.py +++ b/pyutil/test/current/test_iputil.py @@ -15,7 +15,7 @@ from pyutil import iputil, testutil import re - DOTTED_QUAD_RE=re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$") + DOTTED_QUAD_RE=re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$") class ListAddresses(testutil.SignalMixin): def test_get_local_ip_for(self): diff --git a/pyutil/test/deprecated/test_dictutil.py b/pyutil/test/deprecated/test_dictutil.py index 156239e..2042a90 100644 --- a/pyutil/test/deprecated/test_dictutil.py +++ b/pyutil/test/deprecated/test_dictutil.py @@ -79,11 +79,11 @@ def _help_test_eq_but_notis(self, klass): d[fake3] = fake7 d[3] = 7 d[3] = 8 - _assert(any(x for x in d.values() if x is 8)) + _assert(any(x for x in d.values() if x == 8)) _assert(any(x for x in d.values() if x is fake7)) - _assert(not any(x for x in d.values() if x is 7)) # The real 7 should have been ejected by the d[3] = 8. + _assert(not any(x for x in d.values() if x == 7)) # The real 7 should have been ejected by the d[3] = 8. _assert(any(x for x in d if x is fake3)) - _assert(any(x for x in d if x is 3)) + _assert(any(x for x in d if x == 3)) d[fake3] = 8 d.clear() @@ -92,11 +92,11 @@ def _help_test_eq_but_notis(self, klass): fake7 = EqButNotIs(7) d[fake3] = fake7 d[3] = 8 - _assert(any(x for x in d.values() if x is 8)) + _assert(any(x for x in d.values() if x == 8)) _assert(any(x for x in d.values() if x is fake7)) - _assert(not any(x for x in d.values() if x is 7)) # The real 7 should have been ejected by the d[3] = 8. + _assert(not any(x for x in d.values() if x == 7)) # The real 7 should have been ejected by the d[3] = 8. _assert(any(x for x in d if x is fake3)) - _assert(any(x for x in d if x is 3)) + _assert(any(x for x in d if x == 3)) d[fake3] = 8 def test_em(self): diff --git a/pyutil/version_class.py b/pyutil/version_class.py index 9b307d9..ee883bd 100644 --- a/pyutil/version_class.py +++ b/pyutil/version_class.py @@ -79,8 +79,8 @@ # applied since the last version number tag was applied. The revision number is # the count of all patches that have been applied in the history. -VERSION_BASE_RE_STR="(\d+)(\.(\d+)(\.(\d+))?)?((a|b|c)(\d+))?(\.dev(\d+))?" -VERSION_SUFFIX_RE_STR="(-(\d+|r\d+)|.post\d+)?" +VERSION_BASE_RE_STR=r"(\d+)(\.(\d+)(\.(\d+))?)?((a|b|c)(\d+))?(\.dev(\d+))?" +VERSION_SUFFIX_RE_STR=r"(-(\d+|r\d+)|.post\d+)?" VERSION_RE_STR=VERSION_BASE_RE_STR + VERSION_SUFFIX_RE_STR VERSION_RE=re.compile("^" + VERSION_RE_STR + "$")