MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / update_version_in_file

Function update_version_in_file

diffusers/utils/release.py:37–45  ·  view source on GitHub ↗

Update the version in one file using a specific pattern.

(fname, version, pattern)

Source from the content-addressed store, hash-verified

35
36
37def 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
48def update_version_in_examples(version):

Callers 2

global_version_updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected