xlin 0.1.23__py2.py3-none-any.whl → 0.1.24__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
xlin/jsonl.py
CHANGED
@@ -224,11 +224,16 @@ def generator_from_paths(paths: List[Path], load_data: Callable[[Path], List[Dic
|
|
224
224
|
|
225
225
|
|
226
226
|
|
227
|
-
def append_to_json_list(data: list[dict], file_path: str):
|
227
|
+
def append_to_json_list(data: list[dict], file_path: Union[str, Path]):
|
228
228
|
"""Append a list of dictionaries to a JSON file."""
|
229
|
-
|
229
|
+
file_path = Path(file_path)
|
230
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
231
|
+
if file_path.exists() and file_path.is_dir():
|
232
|
+
print(f"{file_path} is a directory, not a file.")
|
233
|
+
return
|
234
|
+
with open(file_path, "a", encoding="utf-8") as f:
|
230
235
|
for item in data:
|
231
|
-
f.write(json.dumps(item) + "\n")
|
236
|
+
f.write(json.dumps(item, ensure_ascii=False, separators=(",", ":")) + "\n")
|
232
237
|
|
233
238
|
|
234
239
|
def row_to_json(row: dict) -> dict:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
xlin/__init__.py,sha256=MWWCNPgJFS_oV2US52ULa4yg4Ku61qjn40NVKqcp9-c,248
|
2
2
|
xlin/ischinese.py,sha256=Ia9IMQ6q-UHkdLwqS70L1fTnfSPbluFrv_I1UqsKquo,293
|
3
|
-
xlin/jsonl.py,sha256=
|
3
|
+
xlin/jsonl.py,sha256=IDRydHh2x-8iAGCxt9ScK2wfNLNA40PxNxR5hhr4v6k,7903
|
4
4
|
xlin/metric.py,sha256=N7wJ35y-C-IaBr1I1CJ_37lTG7gA69zmn9Xg6xSwKoI,1690
|
5
5
|
xlin/multiprocess_mapping.py,sha256=dRXQoLaG1dK_qZ8B3bJblV0RKM2gqIeSW1EaOZbIdD0,14251
|
6
6
|
xlin/read_as_dataframe.py,sha256=MqY57L7Wp9UoWTRlZLSBKQNaZa-dKw51-ufrKvHKf8s,9041
|
@@ -9,7 +9,7 @@ xlin/timing.py,sha256=XMT8dMcMolOMohDvAZOIM_BAiPMREhGQKnO1kc5s6PU,998
|
|
9
9
|
xlin/util.py,sha256=TTWJaqF5D_r-gAZ_fj0kyHomvCagjwHXQZ2OPSgwd54,10976
|
10
10
|
xlin/xls2xlsx.py,sha256=uSmXcDvIhi5Sq0LGidMXy0wErNBXdjaoa6EftYVjTXs,947
|
11
11
|
xlin/yaml.py,sha256=kICi7G3Td5q2MaSXXt85qNTWoHMgjzt7pvn7r3C4dME,183
|
12
|
-
xlin-0.1.
|
13
|
-
xlin-0.1.
|
14
|
-
xlin-0.1.
|
15
|
-
xlin-0.1.
|
12
|
+
xlin-0.1.24.dist-info/LICENSE,sha256=60ys6rRtc1dZOP8UjSUr9fAqhZudT3WpKe5WbMCralM,1066
|
13
|
+
xlin-0.1.24.dist-info/METADATA,sha256=Xm8lU2owbTVPZt1G9baKLiWMIqUZB3THuoCgGGJrQ58,1098
|
14
|
+
xlin-0.1.24.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
|
15
|
+
xlin-0.1.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|