forked from Github/date2name
Complete regex grouping
The regexes are easier to read if their elements are grouped in parentheses. Some already were organized this way, so this commit only extends the pattern to cover all of them. Pytest does not identify a functional change.
This commit is contained in:
parent
d63b004b66
commit
116a0a3aa3
1 changed files with 7 additions and 7 deletions
|
|
@ -31,13 +31,13 @@ FORMATSTRING_MONTH = "%Y-%m"
|
|||
FORMATSTRING_WITHTIME = "%Y-%m-%dT%H.%M.%S"
|
||||
REGEX_PATTERNS = {
|
||||
'NODATESTAMP': re.compile('^\D'),
|
||||
'SHORT': re.compile('^\d{2,2}[01]\d[0123]\d[- _]'),
|
||||
'COMPACT': re.compile('^\d{4,4}[01]\d[0123]\d[- _]'),
|
||||
'STANDARD': re.compile('^\d{4,4}-[01]\d-[0123]\d[- _]'),
|
||||
'MONTH': re.compile('^\d{4,4}-[01]\d[- _]'),
|
||||
'WITHTIME_AND_SECONDS': re.compile('^\d{4,4}-[01]\d-[0123]\d([T :_-])([012]\d)([:.-])([012345]\d)([:.-])([012345]\d)[- _.]'),
|
||||
'WITHTIME_NO_SECONDS': re.compile('^\d{4,4}-[01]\d-[0123]\d([T :_-])([012]\d)([:.-])([012345]\d)[- _.]'),
|
||||
'WITHSECONDS': re.compile('^\d{4,4}-[01]\d-[0123]\d[T :_-][012]\d[:.-][012345]\d[:.-][012345]\d[- _]'),
|
||||
'SHORT': re.compile('^(\d{2,2})([01]\d)([0123]\d)([- _])'),
|
||||
'COMPACT': re.compile('^(\d{4,4})([01]\d)([0123]\d)([- _])'),
|
||||
'STANDARD': re.compile('^(\d{4,4})-([01]\d)-([0123]\d)([- _])'),
|
||||
'MONTH': re.compile('^(\d{4,4})-([01]\d)([- _])'),
|
||||
'WITHTIME_AND_SECONDS': re.compile('^(\d{4,4})-([01]\d)-([0123]\d)([T :_-])([012]\d)([:.-])([012345]\d)([:.-])([012345]\d)([- _.])'),
|
||||
'WITHTIME_NO_SECONDS': re.compile('^(\d{4,4})-([01]\d)-([0123]\d)([T :_-])([012]\d)([:.-])([012345]\d)([- _.])'),
|
||||
'WITHSECONDS': re.compile('^(\d{4,4})-([01]\d)-([0123]\d)([T :_-])([012]\d)([:.-])([012345]\d)([:.-])([012345]\d)([- _])'),
|
||||
}
|
||||
MAX_PATHLENGTH = 255 # os.pathconf('/', 'PC_PATH_MAX') may be longer but os.rename() seems to have hard-coded 256
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue