MCPcopy Index your code
hub / github.com/RustPython/RustPython / update_file

Function update_file

scripts/generate_sre_constants.py:7–16  ·  view source on GitHub ↗
(file, content)

Source from the content-addressed store, hash-verified

5
6
7def update_file(file, content):
8 try:
9 with open(file, "r") as fobj:
10 if fobj.read() == content:
11 return False
12 except (OSError, ValueError):
13 pass
14 with open(file, "w") as fobj:
15 fobj.write(content)
16 return True
17
18
19sre_constants_header = f"""\

Callers 1

mainFunction · 0.85

Calls 3

openFunction · 0.50
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected