This commit is contained in:
Manuel Barkhau 2020-09-17 23:46:55 +00:00
parent f11c8c89f8
commit 851b302112
2 changed files with 33 additions and 32 deletions

View file

@ -185,34 +185,35 @@ FULL_PART_FORMATS = {
} }
PART_FORMATS = { # TODO (mb 2020-09-17): I think this is garbage
'major' : "[0-9]+", # PART_FORMATS = {
'minor' : "[0-9]{3,}", # 'major' : "[0-9]+",
'patch' : "[0-9]{3,}", # 'minor' : "[0-9]{3,}",
'bid' : "[0-9]{4,}", # 'patch' : "[0-9]{3,}",
'MAJOR' : "[0-9]+", # 'bid' : "[0-9]{4,}",
'MINOR' : "[0-9]+", # 'MAJOR' : "[0-9]+",
'MM' : "[0-9]{2,}", # 'MINOR' : "[0-9]+",
'MMM' : "[0-9]{3,}", # 'MM' : "[0-9]{2,}",
'MMMM' : "[0-9]{4,}", # 'MMM' : "[0-9]{3,}",
'MMMMM' : "[0-9]{5,}", # 'MMMM' : "[0-9]{4,}",
'MMMMMM' : "[0-9]{6,}", # 'MMMMM' : "[0-9]{5,}",
'MMMMMMM': "[0-9]{7,}", # 'MMMMMM' : "[0-9]{6,}",
'PATCH' : "[0-9]+", # 'MMMMMMM': "[0-9]{7,}",
'PP' : "[0-9]{2,}", # 'PATCH' : "[0-9]+",
'PPP' : "[0-9]{3,}", # 'PP' : "[0-9]{2,}",
'PPPP' : "[0-9]{4,}", # 'PPP' : "[0-9]{3,}",
'PPPPP' : "[0-9]{5,}", # 'PPPP' : "[0-9]{4,}",
'PPPPPP' : "[0-9]{6,}", # 'PPPPP' : "[0-9]{5,}",
'PPPPPPP': "[0-9]{7,}", # 'PPPPPP' : "[0-9]{6,}",
'BID' : "[1-9][0-9]*", # 'PPPPPPP': "[0-9]{7,}",
'BB' : "[1-9][0-9]{1,}", # 'BID' : "[1-9][0-9]*",
'BBB' : "[1-9][0-9]{2,}", # 'BB' : "[1-9][0-9]{1,}",
'BBBB' : "[1-9][0-9]{3,}", # 'BBB' : "[1-9][0-9]{2,}",
'BBBBB' : "[1-9][0-9]{4,}", # 'BBBB' : "[1-9][0-9]{3,}",
'BBBBBB' : "[1-9][0-9]{5,}", # 'BBBBB' : "[1-9][0-9]{4,}",
'BBBBBBB': "[1-9][0-9]{6,}", # 'BBBBBB' : "[1-9][0-9]{5,}",
} # 'BBBBBBB': "[1-9][0-9]{6,}",
# }
class Pattern(typ.NamedTuple): class Pattern(typ.NamedTuple):

View file

@ -245,7 +245,7 @@ def _parse_pattern_groups(pattern_groups: PatternGroups) -> FieldValues:
if any(duplicate_fields): if any(duplicate_fields):
err_msg = f"Multiple parts for same field {duplicate_fields}." err_msg = f"Multiple parts for same field {duplicate_fields}."
raise PatternError(err_msg) raise PatternError(err_msg)
else:
return dict(field_value_items) return dict(field_value_items)
@ -289,7 +289,7 @@ def parse_version_info(version_str: str, pattern: str = "{pycalver}") -> Version
f"for pattern '{pattern}'/'{pattern_tup.regexp.pattern}'" f"for pattern '{pattern}'/'{pattern_tup.regexp.pattern}'"
) )
raise PatternError(err_msg) raise PatternError(err_msg)
else:
return _parse_version_info(match.groupdict()) return _parse_version_info(match.groupdict())