[blivet:master 3/6] Specify regular expressions containing backslashes as raw strings
mulhern
amulhern at redhat.com
Fri Mar 21 20:17:12 UTC 2014
From: David Shea <dshea at redhat.com>
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/devicetree.py | 2 +-
blivet/udev.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 3fe71ba..c7a82d6 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -547,7 +547,7 @@ class DeviceTree(object):
md_name = udev_device_get_md_name(info)
# mdadm may have appended _<digit>+ if the current hostname
# does not match the one in the array metadata
- alt_name = re.sub("_\d+$", "", md_name)
+ alt_name = re.sub(r"_\d+$", "", md_name)
raw_pattern = "isw_[a-z]*_%s"
# XXX FIXME: This is completely insane.
for i in range(0, len(self.exclusiveDisks)):
diff --git a/blivet/udev.py b/blivet/udev.py
index e71da12..c20d2e7 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -620,7 +620,7 @@ def udev_device_get_iscsi_session(info):
# The position of sessionX part depends on device
# (e.g. offload vs. sw; also varies for different offload devs)
session = None
- match = re.match('/.*/(session\d+)', info["sysfs_path"])
+ match = re.match(r'/.*/(session\d+)', info["sysfs_path"])
if match:
session = match.groups()[0]
else:
@@ -639,7 +639,7 @@ def udev_device_get_iscsi_nic(info):
def udev_device_get_iscsi_initiator(info):
initiator = None
if udev_device_is_partoff_iscsi(info):
- host = re.match('.*/(host\d+)', info["sysfs_path"]).groups()[0]
+ host = re.match(r'.*/(host\d+)', info["sysfs_path"]).groups()[0]
if host:
initiator_file = "/sys/class/iscsi_host/%s/initiatorname" % host
if os.access(initiator_file, os.R_OK):
@@ -682,7 +682,7 @@ def udev_device_get_iscsi_initiator(info):
# Ethernet interface.
def _detect_broadcom_fcoe(info):
- re_pci_host=re.compile('/(.*)/(host\d+)')
+ re_pci_host=re.compile(r'/(.*)/(host\d+)')
match = re_pci_host.match(info["sysfs_path"])
if match:
sysfs_pci, host = match.groups()
--
1.8.3.1
More information about the anaconda-patches
mailing list