Revision 78f99abb

b/lib/backend.py
86 86
_IES_CA_FILE = "ca"
87 87

  
88 88
#: Valid LVS output line regex
89
_LVSLINE_REGEX = re.compile("^ *([^|]+)\|([^|]+)\|([0-9.]+)\|([^|]{6,})\|?$")
89
_LVSLINE_REGEX = re.compile(r"^ *([^|]+)\|([^|]+)\|([0-9.]+)\|([^|]{6,})\|?$")
90 90

  
91 91
# Actions for the master setup script
92 92
_MASTER_START = "start"
b/lib/hypervisor/hv_base.py
514 514
    try:
515 515
      fh = open("/proc/cpuinfo")
516 516
      try:
517
        cpu_total = len(re.findall("(?m)^processor\s*:\s*[0-9]+\s*$",
517
        cpu_total = len(re.findall(r"(?m)^processor\s*:\s*[0-9]+\s*$",
518 518
                                   fh.read()))
519 519
      finally:
520 520
        fh.close()
b/lib/hypervisor/hv_kvm.py
535 535
  _VIRTIO = "virtio"
536 536
  _VIRTIO_NET_PCI = "virtio-net-pci"
537 537

  
538
  _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
538
  _MIGRATION_STATUS_RE = re.compile(r"Migration\s+status:\s+(\w+)",
539 539
                                    re.M | re.I)
540 540
  _MIGRATION_PROGRESS_RE = \
541 541
    re.compile(r"\s*transferred\s+ram:\s+(?P<transferred>\d+)\s+kbytes\s*\n"
b/lib/hypervisor/hv_xen.py
415 415
      if netinfo.mac_prefix:
416 416
        data.write("NETWORK_MAC_PREFIX=%s\n" % netinfo.mac_prefix)
417 417
      if netinfo.tags:
418
        data.write("NETWORK_TAGS=%s\n" % "\ ".join(netinfo.tags))
418
        data.write("NETWORK_TAGS=%s\n" % r"\ ".join(netinfo.tags))
419 419

  
420 420
    data.write("MAC=%s\n" % nic.mac)
421 421
    data.write("IP=%s\n" % nic.ip)
b/lib/objects.py
281 281

  
282 282
  """
283 283
  __slots__ = ["tags"]
284
  VALID_TAG_RE = re.compile("^[\w.+*/:@-]+$")
284
  VALID_TAG_RE = re.compile(r"^[\w.+*/:@-]+$")
285 285

  
286 286
  @classmethod
287 287
  def ValidateTag(cls, tag):
b/lib/ovf.py
833 833
    raw_string = ET.tostring(self.tree)
834 834
    parsed_xml = xml.dom.minidom.parseString(raw_string)
835 835
    xml_string = parsed_xml.toprettyxml(indent="  ")
836
    text_re = re.compile(">\n\s+([^<>\s].*?)\n\s+</", re.DOTALL)
837
    return text_re.sub(">\g<1></", xml_string)
836
    text_re = re.compile(r">\n\s+([^<>\s].*?)\n\s+</", re.DOTALL)
837
    return text_re.sub(r">\g<1></", xml_string)
838 838

  
839 839

  
840 840
class Converter(object):
......
1408 1408
        _, disk_path = self._CompressDisk(disk_path, disk_compression,
1409 1409
                                          DECOMPRESS)
1410 1410
        disk, _ = os.path.splitext(disk)
1411
      if self._GetDiskQemuInfo(disk_path, "file format: (\S+)") != "raw":
1411
      if self._GetDiskQemuInfo(disk_path, r"file format: (\S+)") != "raw":
1412 1412
        logging.info("Conversion to raw format is required")
1413 1413
      ext, new_disk_path = self._ConvertDisk("raw", disk_path)
1414 1414

  
......
1710 1710
    ext, new_disk_path = self._ConvertDisk(self.options.disk_format, disk_path)
1711 1711
    results["format"] = self.options.disk_format
1712 1712
    results["virt-size"] = self._GetDiskQemuInfo(
1713
      new_disk_path, "virtual size: \S+ \((\d+) bytes\)")
1713
      new_disk_path, r"virtual size: \S+ \((\d+) bytes\)")
1714 1714
    if compression:
1715 1715
      ext2, new_disk_path = self._CompressDisk(new_disk_path, "gzip",
1716 1716
                                               COMPRESS)
b/lib/storage/bdev.py
63 63

  
64 64
  """
65 65
  _VALID_NAME_RE = re.compile("^[a-zA-Z0-9+_.-]*$")
66
  _PARSE_PV_DEV_RE = re.compile("^([^ ()]+)\([0-9]+\)$")
66
  _PARSE_PV_DEV_RE = re.compile(r"^([^ ()]+)\([0-9]+\)$")
67 67
  _INVALID_NAMES = compat.UniqueFrozenset([".", "..", "snapshot", "pvmove"])
68 68
  _INVALID_SUBSTRINGS = compat.UniqueFrozenset(["_mlog", "_mimage"])
69 69

  
b/lib/storage/drbd_info.py
41 41
  """
42 42
  UNCONF_RE = re.compile(r"\s*[0-9]+:\s*cs:Unconfigured$")
43 43
  LINE_RE = re.compile(r"\s*[0-9]+:\s*cs:(\S+)\s+(?:st|ro):([^/]+)/(\S+)"
44
                       "\s+ds:([^/]+)/(\S+)\s+.*$")
44
                       r"\s+ds:([^/]+)/(\S+)\s+.*$")
45 45
  SYNC_RE = re.compile(r"^.*\ssync'ed:\s*([0-9.]+)%.*"
46 46
                       # Due to a bug in drbd in the kernel, introduced in
47 47
                       # commit 4b0715f096 (still unfixed as of 2011-08-22)
48
                       "(?:\s|M)"
49
                       "finish: ([0-9]+):([0-9]+):([0-9]+)\s.*$")
48
                       r"(?:\s|M)"
49
                       r"finish: ([0-9]+):([0-9]+):([0-9]+)\s.*$")
50 50

  
51 51
  CS_UNCONFIGURED = "Unconfigured"
52 52
  CS_STANDALONE = "StandAlone"
b/lib/utils/algo.py
31 31

  
32 32

  
33 33
_SORTER_GROUPS = 8
34
_SORTER_RE = re.compile("^%s(.*)$" % (_SORTER_GROUPS * "(\D+|\d+)?"))
34
_SORTER_RE = re.compile("^%s(.*)$" % (_SORTER_GROUPS * r"(\D+|\d+)?"))
35 35

  
36 36

  
37 37
def UniqueSequence(seq):
b/lib/utils/text.py
410 410

  
411 411

  
412 412
def UnescapeAndSplit(text, sep=","):
413
  """Split and unescape a string based on a given separator.
413
  r"""Split and unescape a string based on a given separator.
414 414

  
415 415
  This function splits a string based on a separator where the
416 416
  separator itself can be escape in order to be an element of the

Also available in: Unified diff