MCPcopy Index your code
hub / github.com/numpy/numpy / write_file

Function write_file

numpy/_core/code_generators/genapi.py:315–326  ·  view source on GitHub ↗

Write data to filename Only write changed data to avoid updating timestamps unnecessarily

(filename, data)

Source from the content-addressed store, hash-verified

313
314
315def write_file(filename, data):
316 """
317 Write data to filename
318 Only write changed data to avoid updating timestamps unnecessarily
319 """
320 if os.path.exists(filename):
321 with open(filename) as f:
322 if data == f.read():
323 return
324
325 with open(filename, 'w') as fid:
326 fid.write(data)
327
328
329# Those *Api classes instances know how to output strings for the generated code

Callers

nothing calls this directly

Calls 4

openFunction · 0.85
existsMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…