Update the version in one file using a specific pattern.
(fname, version, pattern)
| 35 | |
| 36 | |
| 37 | def update_version_in_file(fname, version, pattern): |
| 38 | """Update the version in one file using a specific pattern.""" |
| 39 | with open(fname, "r", encoding="utf-8", newline="\n") as f: |
| 40 | code = f.read() |
| 41 | re_pattern, replace = REPLACE_PATTERNS[pattern] |
| 42 | replace = replace.replace("VERSION", version) |
| 43 | code = re_pattern.sub(replace, code) |
| 44 | with open(fname, "w", encoding="utf-8", newline="\n") as f: |
| 45 | f.write(code) |
| 46 | |
| 47 | |
| 48 | def update_version_in_examples(version): |
no outgoing calls
no test coverage detected