MCPcopy Index your code
hub / github.com/data-apis/python-record-api / write

Function write

record_api/jsonl.py:40–50  ·  view source on GitHub ↗
(path: str, **kwargs)

Source from the content-addressed store, hash-verified

38
39@contextlib.contextmanager
40def write(path: str, **kwargs) -> typing.Iterator[typing.Callable[[dict], None]]:
41 file = io.FileIO(path, "w")
42 buffer = io.BufferedWriter(file)
43
44 def write_line(o: dict, buffer=buffer) -> None:
45 buffer.write(orjson.dumps(o, **kwargs))
46 buffer.write(b"\n")
47
48 yield write_line
49 buffer.close()
50 file.close()
51
52
53def lines_in_file(filename: str) -> int:

Callers 1

__main__Function · 0.85

Calls 1

closeMethod · 0.80

Tested by

no test coverage detected