Skip to content

Commit 2eba747

Browse files
authored
Merge pull request #53 from layfellow/master
Switch regexes to raw strings and fix escaping
2 parents a7fe1a8 + 79f0169 commit 2eba747

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

imapbackup38.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def pretty_byte_count(num):
105105

106106

107107
# Regular expressions for parsing
108-
MSGID_RE = re.compile("^Message\-Id\: (.+)", re.IGNORECASE + re.MULTILINE)
108+
MSGID_RE = re.compile(r"^Message-Id: (.+)", re.IGNORECASE + re.MULTILINE)
109109
BLANKS_RE = re.compile(r'\s+', re.MULTILINE)
110110

111111
# Constants
@@ -340,7 +340,7 @@ def parse_paren_list(row):
340340
result = []
341341

342342
# NOTE: RFC3501 doesn't fully define the format of name attributes
343-
name_attrib_re = re.compile("^\s*(\\\\[a-zA-Z0-9_]+)\s*")
343+
name_attrib_re = re.compile(r"^\s*(\\[a-zA-Z0-9_]+)\s*")
344344

345345
# eat name attributes until ending paren
346346
while row[0] != ')':
@@ -367,7 +367,7 @@ def parse_paren_list(row):
367367

368368
def parse_string_list(row):
369369
"""Parses the quoted and unquoted strings at the end of a LIST response"""
370-
slist = re.compile('\s*(?:"([^"]+)")\s*|\s*(\S+)\s*').split(row)
370+
slist = re.compile(r'\s*"([^"]+)"\s*|\s*(\S+)\s*').split(row)
371371
return [s for s in slist if s]
372372

373373

0 commit comments

Comments
 (0)