MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / write

Method write

client/util/configlib.py:56–80  ·  view source on GitHub ↗

将内容写入文件 :param file_path: :param section_name: :param section_dict: :param comment_str: :return:

(self, file_path, section_name, section_dict, comment_str=None)

Source from the content-addressed store, hash-verified

54
55class ConfigWriter(object):
56 def write(self, file_path, section_name, section_dict, comment_str=None):
57 """
58 将内容写入文件
59 :param file_path:
60 :param section_name:
61 :param section_dict:
62 :param comment_str:
63 :return:
64 """
65 context = ""
66 if comment_str:
67 context += comment_str
68 context += "\n"
69
70 context += "[%s]\n" % section_name
71
72 for key, value in section_dict.items():
73 line = format(key, '<12') + ": "
74 if value:
75 line += value
76 line += "\n"
77 context += line
78
79 with open(file_path, 'w') as wf:
80 wf.write(context)
81
82
83

Callers 15

insert_cacheMethod · 0.45
zip_dirMethod · 0.45
unzip_fileMethod · 0.45
dumpMethod · 0.45
zipfile_compressMethod · 0.45
download_fileMethod · 0.45
download_big_fileMethod · 0.45
analyzeMethod · 0.45
run_luacheckMethod · 0.45
generate_configMethod · 0.45
analyzeMethod · 0.45
analyzeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected