MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / write_file

Function write_file

task.py:40–53  ·  view source on GitHub ↗
(path: str, content: str, mode='w')

Source from the content-addressed store, hash-verified

38
39
40def write_file(path: str, content: str, mode='w'):
41 try:
42 fp = open(path, mode)
43 fp.write(content)
44 fp.close()
45 return True
46 except:
47 try:
48 fp = open(path, mode, encoding="utf-8")
49 fp.write(content)
50 fp.close()
51 return True
52 except:
53 return False
54
55
56def read_file(filename: str):

Callers 7

write_logFunction · 0.70
startMethod · 0.70
can_write_fileMethod · 0.70
stop_syssafeMethod · 0.70
startMethod · 0.70
_rebuild_dbMethod · 0.70
mainFunction · 0.70

Calls 3

openFunction · 0.85
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected