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

Function read_file

task.py:56–68  ·  view source on GitHub ↗
(filename: str)

Source from the content-addressed store, hash-verified

54
55
56def read_file(filename: str):
57 fp = None
58 try:
59 fp = open(filename, "rb")
60 f_body_bytes: bytes = fp.read()
61 f_body = f_body_bytes.decode("utf-8", errors='ignore')
62 fp.close()
63 return f_body
64 except Exception as ex:
65 return False
66 finally:
67 if fp and not fp.closed:
68 fp.close()
69
70
71def write_log(*args, _level='INFO', color="debug"):

Callers 8

do_onceMethod · 0.70
proc_workerMethod · 0.70
daemon_panelMethod · 0.70
get_panel_pidMethod · 0.70
can_write_fileMethod · 0.70
check_install_statusMethod · 0.70
data_dayMethod · 0.70
get_next_timeMethod · 0.70

Calls 4

openFunction · 0.85
readMethod · 0.45
decodeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected