MCPcopy
hub / github.com/psycopg/psycopg / sed_i

Function sed_i

tools/ci/copy_to_binary.py:19–25  ·  view source on GitHub ↗
(pattern: str, repl: str, filename: str | Path)

Source from the content-addressed store, hash-verified

17
18
19def sed_i(pattern: str, repl: str, filename: str | Path) -> None:
20 with open(filename, "rb") as f:
21 data = f.read()
22
23 if (newdata := re.sub(pattern.encode("utf8"), repl.encode("utf8"), data)) != data:
24 with open(filename, "wb") as f:
25 f.write(newdata)
26
27
28shutil.copytree(pdir / "psycopg_c", target)

Callers 1

copy_to_binary.pyFile · 0.85

Calls 2

readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected