MCPcopy Index your code
hub / github.com/KnowledgeXLab/LeanRAG / write_yaml

Function write_yaml

tools/io_file.py:567–579  ·  view source on GitHub ↗

写入YAML文件。 参数: - file_path (str): 文件路径。 - data (dict): 要写入的YAML数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - encoding (str): 写入文件的编码格式,默认为 'utf-8'。

(file_path, data, mode, encoding='utf-8')

Source from the content-addressed store, hash-verified

565
566
567def write_yaml(file_path, data, mode, encoding='utf-8'):
568 """
569 写入YAML文件。
570
571 参数:
572 - file_path (str): 文件路径。
573 - data (dict): 要写入的YAML数据。
574 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
575 - encoding (str): 写入文件的编码格式,默认为 'utf-8'
576 """
577 logger.info(f"写入YAML文件: {file_path}")
578 with open(file_path, mode, encoding=encoding) as f:
579 yaml.dump(data, f, allow_unicode=True)
580
581
582def write_csv(file_path, data, mode, chunk_size, encoding='utf-8'):

Callers 1

writeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected