pythonwrench.jsonl module¶
-
pythonwrench.jsonl.dump_jsonl(data: list, file: str | Path | None | TextIOBase =
None, /, *, overwrite: bool =True, make_parents: bool =True, to_builtins: bool =False, ensure_ascii: bool =False, **json_dumps_kwds) str[source]¶ Dump content to JSONL format into a string and/or file.
- Args:
data: Data to dump to JSONL. file: Optional filepath to save dumped data. Not used if None. defaults to None. overwrite: If True, overwrite target filepath. defaults to True. make_parents: Build intermediate directories to filepath. defaults to True. to_builtins: If True, converts data to builtin equivalent before saving. defaults to False. ensure_ascii: Ensure only ASCII characters. defaults to False. **json_dump_kwds: Other args passed to json.dumps.
- Returns:
Dumped content as string.
-
pythonwrench.jsonl.dumps_jsonl(data: list, /, *, to_builtins: bool =
False, ensure_ascii: bool =False, **json_dumps_kwds) str[source]¶
- pythonwrench.jsonl.load_jsonl(file: str | Path | PathLike | TextIOBase, /, **json_loads_kwds) list[source]¶
- pythonwrench.jsonl.read_jsonl(file: str | Path | PathLike | TextIOBase, /, **json_loads_kwds) Any¶
-
pythonwrench.jsonl.save_jsonl(data: list, file: str | Path | PathLike | TextIOBase, /, *, overwrite: bool =
True, make_parents: bool =True, to_builtins: bool =False, ensure_ascii: bool =False, **json_dumps_kwds) None[source]¶