We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6f5d32 commit f63abf3Copy full SHA for f63abf3
rotate_backups/__init__.py
@@ -677,12 +677,13 @@ def match_to_datetime(self, match):
677
.. seealso:: :data:`SUPPORTED_DATE_COMPONENTS`
678
"""
679
kw = {}
680
+ captures = match.groupdict()
681
for component, required in SUPPORTED_DATE_COMPONENTS:
- value = match.group(component)
682
+ value = captures.get(component)
683
if value:
684
kw[component] = int(value, 10)
685
elif required:
- raise ValueError("Missing required date component! (%s)!" % component)
686
+ raise ValueError("Missing required date component! (%s)" % component)
687
else:
688
kw[component] = 0
689
return datetime.datetime(**kw)
0 commit comments