Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyutil/iputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<address>\d+\.\d+\.\d+\.\d+)\s+(?P<metric>\d+)\s*$', flags=re.M|re.I|re.S)
_win32_re = re.compile(r'^\s*\d+\.\d+\.\d+\.\d+\s.+\s(?P<address>\d+\.\d+\.\d+\.\d+)\s+(?P<metric>\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<address>\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S)
_linux_re = re.compile(r'^\s*inet [a-zA-Z]*:?(?P<address>\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<address>\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S)
_netbsd_re = re.compile(r'^\s+inet [a-zA-Z]*:?(?P<address>\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S)

# Irix 6.5
_irix_path = '/usr/etc/ifconfig'
Expand Down
8 changes: 4 additions & 4 deletions pyutil/platformutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyutil/test/current/test_iputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 6 additions & 6 deletions pyutil/test/deprecated/test_dictutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions pyutil/version_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "$")

Expand Down