mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
setup to reduce code duplication
This commit is contained in:
parent
e053af589e
commit
3cbf0e82b1
10 changed files with 271 additions and 267 deletions
|
|
@ -94,9 +94,11 @@ def rewrite_lines(
|
|||
new_lines = old_lines[:]
|
||||
found_patterns = set()
|
||||
|
||||
for match in parse.iter_matches(old_lines, pattern_strs):
|
||||
found_patterns.add(match.pattern)
|
||||
replacement = v1version.format_version(new_vinfo, match.pattern)
|
||||
patterns = [v1patterns.compile_pattern(p) for p in pattern_strs]
|
||||
matches = parse.iter_matches(old_lines, patterns)
|
||||
for match in matches:
|
||||
found_patterns.add(match.pattern.raw)
|
||||
replacement = v1version.format_version(new_vinfo, match.pattern.raw)
|
||||
span_l, span_r = match.span
|
||||
new_line = match.line[:span_l] + replacement + match.line[span_r:]
|
||||
new_lines[match.lineno] = new_line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue