MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / _write_output

Function _write_output

scripts/embed_python_api.py:7–23  ·  view source on GitHub ↗
(filename, content)

Source from the content-addressed store, hash-verified

5
6
7def _write_output(filename, content):
8 if os.path.exists(filename):
9 with open(filename, 'rt') as strm:
10 orig_content = strm.read()
11
12 if orig_content == content:
13 return False
14
15 dirpath = os.path.dirname(filename)
16 if not os.path.isdir(dirpath):
17 os.makedirs(dirpath)
18
19 with open(filename, 'wt') as strm:
20 strm.write(content)
21 strm.flush()
22
23 return True
24
25
26def _main():

Callers 1

_mainFunction · 0.70

Calls 3

writeMethod · 0.80
flushMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected