MCPcopy
hub / github.com/modelscope/ms-swift / _write_buffer

Method _write_buffer

swift/utils/io_utils.py:84–95  ·  view source on GitHub ↗
(self, text: str)

Source from the content-addressed store, hash-verified

82 self._append(obj, gather_obj=gather_obj)
83
84 def _write_buffer(self, text: str):
85 if not text:
86 return
87 assert self.is_write_rank, f'self.is_write_rank: {self.is_write_rank}'
88 try:
89 os.makedirs(os.path.dirname(self.fpath), exist_ok=True)
90 with open(self.fpath, 'a', encoding=self.encoding) as f:
91 f.write(text)
92 except Exception:
93 if self.strict:
94 raise
95 logger.error(f'Cannot write content to jsonl file. text: {text}')
96
97
98def append_to_jsonl(fpath: str,

Callers 1

_appendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected