MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / write

Function write

scripts/pull-templates.py:40–50  ·  view source on GitHub ↗
(path, text)

Source from the content-addressed store, hash-verified

38
39
40def write(path, text):
41 print("saving", path)
42
43 dir = os.path.dirname(path)
44 if not os.path.exists(dir):
45 os.makedirs(dir)
46
47 text = text.replace("\r\n", "\n").replace("\r", "\n")
48
49 with open(path, "w") as f:
50 f.write(text.encode("utf-8"))
51
52
53def delete(path):

Callers 2

mainFunction · 0.70
save_manyMethod · 0.70

Calls 2

existsMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected