jsonjsdb 0.8.2__tar.gz → 0.8.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jsonjsdb
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: Python library for JSONJS database loading
5
5
  Project-URL: Homepage, https://github.com/datannur/jsonjsdb
6
6
  Project-URL: Repository, https://github.com/datannur/jsonjsdb
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "jsonjsdb"
7
- version = "0.8.2"
7
+ version = "0.8.3"
8
8
  description = "Python library for JSONJS database loading"
9
9
  authors = [{ name = "datannur" }]
10
10
  readme = "README.md"
@@ -331,7 +331,7 @@ def load_evolution(path: Path, xlsx_path: Path | None = None) -> list[EvolutionE
331
331
  if not evolution_path.exists():
332
332
  return []
333
333
 
334
- with open(evolution_path) as f:
334
+ with open(evolution_path, encoding="utf-8") as f:
335
335
  data = json.load(f)
336
336
 
337
337
  return [
@@ -410,7 +410,7 @@ def save_evolution(
410
410
  evolution_json_path = path / "evolution.json"
411
411
  data = [entry.to_dict() for entry in entries]
412
412
 
413
- with open(evolution_json_path, "w") as f:
413
+ with open(evolution_json_path, "w", encoding="utf-8") as f:
414
414
  json.dump(data, f, indent=2, ensure_ascii=False)
415
415
  f.write("\n")
416
416
 
@@ -447,7 +447,7 @@ def save_evolution(
447
447
  json_array = json.dumps(rows, ensure_ascii=False, separators=(",", ":"))
448
448
  content = f"jsonjs.data['evolution'] = {json_array}\n"
449
449
 
450
- with open(evolution_jsonjs_path, "w") as f:
450
+ with open(evolution_jsonjs_path, "w", encoding="utf-8") as f:
451
451
  f.write(content)
452
452
 
453
453
  # Write evolution.xlsx if path provided
@@ -1,5 +1,6 @@
1
1
  """Load JSON files into Polars DataFrames."""
2
2
 
3
+ import json
3
4
  from pathlib import Path
4
5
  from typing import Any
5
6
 
@@ -49,7 +50,5 @@ def _convert_ids_column(col_name: str, col_type: pl.DataType) -> pl.Expr:
49
50
 
50
51
  def load_table_index(path: Path) -> list[dict[str, Any]]:
51
52
  """Load __table__.json which contains table metadata."""
52
- import json
53
-
54
- with open(path) as f:
53
+ with open(path, encoding="utf-8") as f:
55
54
  return json.load(f)
@@ -12,7 +12,7 @@ def write_table_json(df: pl.DataFrame, path: Path) -> None:
12
12
  """Write a DataFrame to a JSON file (array of objects)."""
13
13
  prepared_df = _prepare_df_for_write(df)
14
14
  rows = _df_to_json_rows(prepared_df)
15
- with open(path, "w") as f:
15
+ with open(path, "w", encoding="utf-8") as f:
16
16
  json.dump(rows, f, indent=2, ensure_ascii=False)
17
17
  f.write("\n")
18
18
 
@@ -29,7 +29,7 @@ def write_table_jsonjs(df: pl.DataFrame, table_name: str, path: Path) -> None:
29
29
  json_array = json.dumps(rows, ensure_ascii=False, separators=(",", ":"))
30
30
  content = f"jsonjs.data['{table_name}'] = {json_array}\n"
31
31
 
32
- with open(path, "w") as f:
32
+ with open(path, "w", encoding="utf-8") as f:
33
33
  f.write(content)
34
34
 
35
35
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes