mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 22:40:09 +01:00
cleanup
This commit is contained in:
parent
f11c8c89f8
commit
851b302112
2 changed files with 33 additions and 32 deletions
|
|
@ -185,34 +185,35 @@ FULL_PART_FORMATS = {
|
|||
}
|
||||
|
||||
|
||||
PART_FORMATS = {
|
||||
'major' : "[0-9]+",
|
||||
'minor' : "[0-9]{3,}",
|
||||
'patch' : "[0-9]{3,}",
|
||||
'bid' : "[0-9]{4,}",
|
||||
'MAJOR' : "[0-9]+",
|
||||
'MINOR' : "[0-9]+",
|
||||
'MM' : "[0-9]{2,}",
|
||||
'MMM' : "[0-9]{3,}",
|
||||
'MMMM' : "[0-9]{4,}",
|
||||
'MMMMM' : "[0-9]{5,}",
|
||||
'MMMMMM' : "[0-9]{6,}",
|
||||
'MMMMMMM': "[0-9]{7,}",
|
||||
'PATCH' : "[0-9]+",
|
||||
'PP' : "[0-9]{2,}",
|
||||
'PPP' : "[0-9]{3,}",
|
||||
'PPPP' : "[0-9]{4,}",
|
||||
'PPPPP' : "[0-9]{5,}",
|
||||
'PPPPPP' : "[0-9]{6,}",
|
||||
'PPPPPPP': "[0-9]{7,}",
|
||||
'BID' : "[1-9][0-9]*",
|
||||
'BB' : "[1-9][0-9]{1,}",
|
||||
'BBB' : "[1-9][0-9]{2,}",
|
||||
'BBBB' : "[1-9][0-9]{3,}",
|
||||
'BBBBB' : "[1-9][0-9]{4,}",
|
||||
'BBBBBB' : "[1-9][0-9]{5,}",
|
||||
'BBBBBBB': "[1-9][0-9]{6,}",
|
||||
}
|
||||
# TODO (mb 2020-09-17): I think this is garbage
|
||||
# PART_FORMATS = {
|
||||
# 'major' : "[0-9]+",
|
||||
# 'minor' : "[0-9]{3,}",
|
||||
# 'patch' : "[0-9]{3,}",
|
||||
# 'bid' : "[0-9]{4,}",
|
||||
# 'MAJOR' : "[0-9]+",
|
||||
# 'MINOR' : "[0-9]+",
|
||||
# 'MM' : "[0-9]{2,}",
|
||||
# 'MMM' : "[0-9]{3,}",
|
||||
# 'MMMM' : "[0-9]{4,}",
|
||||
# 'MMMMM' : "[0-9]{5,}",
|
||||
# 'MMMMMM' : "[0-9]{6,}",
|
||||
# 'MMMMMMM': "[0-9]{7,}",
|
||||
# 'PATCH' : "[0-9]+",
|
||||
# 'PP' : "[0-9]{2,}",
|
||||
# 'PPP' : "[0-9]{3,}",
|
||||
# 'PPPP' : "[0-9]{4,}",
|
||||
# 'PPPPP' : "[0-9]{5,}",
|
||||
# 'PPPPPP' : "[0-9]{6,}",
|
||||
# 'PPPPPPP': "[0-9]{7,}",
|
||||
# 'BID' : "[1-9][0-9]*",
|
||||
# 'BB' : "[1-9][0-9]{1,}",
|
||||
# 'BBB' : "[1-9][0-9]{2,}",
|
||||
# 'BBBB' : "[1-9][0-9]{3,}",
|
||||
# 'BBBBB' : "[1-9][0-9]{4,}",
|
||||
# 'BBBBBB' : "[1-9][0-9]{5,}",
|
||||
# 'BBBBBBB': "[1-9][0-9]{6,}",
|
||||
# }
|
||||
|
||||
|
||||
class Pattern(typ.NamedTuple):
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ def _parse_pattern_groups(pattern_groups: PatternGroups) -> FieldValues:
|
|||
if any(duplicate_fields):
|
||||
err_msg = f"Multiple parts for same field {duplicate_fields}."
|
||||
raise PatternError(err_msg)
|
||||
|
||||
return dict(field_value_items)
|
||||
else:
|
||||
return dict(field_value_items)
|
||||
|
||||
|
||||
def _parse_version_info(pattern_groups: PatternGroups) -> VersionInfo:
|
||||
|
|
@ -289,8 +289,8 @@ def parse_version_info(version_str: str, pattern: str = "{pycalver}") -> Version
|
|||
f"for pattern '{pattern}'/'{pattern_tup.regexp.pattern}'"
|
||||
)
|
||||
raise PatternError(err_msg)
|
||||
|
||||
return _parse_version_info(match.groupdict())
|
||||
else:
|
||||
return _parse_version_info(match.groupdict())
|
||||
|
||||
|
||||
def is_valid(version_str: str, pattern: str = "{pycalver}") -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue