mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
cleanup and formatting
This commit is contained in:
parent
70c2b27157
commit
f980139e82
4 changed files with 13 additions and 8 deletions
|
|
@ -58,7 +58,7 @@ class PatternMatch(typ.NamedTuple):
|
|||
PatternMatches = typ.Iterable[PatternMatch]
|
||||
|
||||
|
||||
def compile_pattern(pattern: str) -> typ.Pattern[str] :
|
||||
def compile_pattern(pattern: str) -> typ.Pattern[str]:
|
||||
pattern_tmpl = pattern
|
||||
|
||||
for char, escaped in PATTERN_ESCAPES:
|
||||
|
|
@ -66,7 +66,9 @@ def compile_pattern(pattern: str) -> typ.Pattern[str] :
|
|||
|
||||
# undo escaping only for valid part names
|
||||
for part_name in RE_PATTERN_PARTS.keys():
|
||||
pattern_tmpl = pattern_tmpl.replace("\u005c{{" + part_name + "\u005c}}", "{" + part_name + "}")
|
||||
pattern_tmpl = pattern_tmpl.replace(
|
||||
"\u005c{{" + part_name + "\u005c}}", "{" + part_name + "}"
|
||||
)
|
||||
|
||||
pattern_str = pattern_tmpl.format(**RE_PATTERN_PARTS)
|
||||
return re.compile(pattern_str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue