fix bad regular expressions and docstrings with '\'

This commit is contained in:
Todd Gamblin
2018-11-02 23:09:27 -07:00
parent 1137b183e3
commit a41bce2148
2 changed files with 4 additions and 4 deletions

View File

@@ -460,11 +460,11 @@ def pretty_string_to_date(date_str, now=None):
now = now or datetime.now()
# datetime formats
pattern[re.compile('^\d{4}$')] = lambda x: datetime.strptime(x, '%Y')
pattern[re.compile('^\d{4}-\d{2}$')] = lambda x: datetime.strptime(
pattern[re.compile(r'^\d{4}$')] = lambda x: datetime.strptime(x, '%Y')
pattern[re.compile(r'^\d{4}-\d{2}$')] = lambda x: datetime.strptime(
x, '%Y-%m'
)
pattern[re.compile('^\d{4}-\d{2}-\d{2}$')] = lambda x: datetime.strptime(
pattern[re.compile(r'^\d{4}-\d{2}-\d{2}$')] = lambda x: datetime.strptime(
x, '%Y-%m-%d'
)