jsonyx 2.2.0__tar.gz → 2.2.1__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.
Files changed (33) hide show
  1. {jsonyx-2.2.0/src/jsonyx.egg-info → jsonyx-2.2.1}/PKG-INFO +20 -20
  2. {jsonyx-2.2.0 → jsonyx-2.2.1}/README.md +75 -75
  3. {jsonyx-2.2.0 → jsonyx-2.2.1}/setup.py +54 -54
  4. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/__init__.py +2 -2
  5. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/__main__.py +2 -1
  6. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/_decoder.py +5 -1
  7. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/_encoder.py +9 -11
  8. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/_speedups.c +2260 -2255
  9. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_dumps.py +682 -682
  10. {jsonyx-2.2.0 → jsonyx-2.2.1/src/jsonyx.egg-info}/PKG-INFO +20 -20
  11. {jsonyx-2.2.0 → jsonyx-2.2.1}/LICENSE +0 -0
  12. {jsonyx-2.2.0 → jsonyx-2.2.1}/setup.cfg +0 -0
  13. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/_differ.py +0 -0
  14. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/_manipulator.py +0 -0
  15. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/allow.py +0 -0
  16. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/py.typed +0 -0
  17. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/__init__.py +0 -0
  18. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/conftest.py +0 -0
  19. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_apply_filter.py +0 -0
  20. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_apply_patch.py +0 -0
  21. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_dump.py +0 -0
  22. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_jsonyx.py +0 -0
  23. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_load_query_value.py +0 -0
  24. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_loads.py +0 -0
  25. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_make_patch.py +0 -0
  26. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_paste_values.py +0 -0
  27. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_select_nodes.py +0 -0
  28. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_syntax_error.py +0 -0
  29. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx/test/test_write.py +0 -0
  30. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx.egg-info/SOURCES.txt +0 -0
  31. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx.egg-info/dependency_links.txt +0 -0
  32. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx.egg-info/entry_points.txt +0 -0
  33. {jsonyx-2.2.0 → jsonyx-2.2.1}/src/jsonyx.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jsonyx
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: Customizable JSON library for Python
5
5
  Author: Nice Zombies
6
6
  Author-email: nineteendo19d0@gmail.com
@@ -88,31 +88,31 @@ The documentation for `jsonyx` is available online at: https://jsonyx.readthedoc
88
88
  ```
89
89
  - Dedicated functions for reading and writing files and pretty printing
90
90
 
91
- ## Benchmark (Mar 31, 2025)
91
+ ## Benchmark (Apr 20, 2025)
92
92
 
93
93
  We recommend to use [`orjson`](https://pypi.org/project/orjson),
94
94
  [`msgspec`](https://pypi.org/project/msgspec) or
95
95
  [`pysimdjson`](https://pypi.org/project/pysimdjson) for performance critical
96
96
  applications:
97
97
 
98
- | encode | json | jsonyx | msgspec | orjson | fastest time |
99
- |:--------------------------------------------|-------:|-------:|--------:|--------:|-------------:|
100
- | List of 256 booleans | 4.56x | 5.33x | 1.00x | 1.06x | 1.90 μs |
101
- | List of 256 ASCII strings | 12.12x | 13.65x | 1.50x | 1.00x | 3.95 μs |
102
- | List of 256 floats | 23.41x | 25.95x | 1.30x | 1.00x | 8.03 μs |
103
- | List of 256 dicts with 1 int | 11.10x | 13.61x | 1.32x | 1.00x | 7.75 μs |
104
- | Medium complex object | 10.76x | 11.80x | 1.16x | 1.00x | 13.30 μs |
105
- | List of 256 strings | 23.08x | 19.66x | 2.04x | 1.00x | 14.42 μs |
106
- | Complex object | 7.36x | 7.95x | 1.00x | DNF | 209.74 μs |
107
- | Dict with 256 lists of 256 dicts with 1 int | 9.23x | 11.34x | 1.21x | 1.00x | 2361.90 μs |
98
+ | encode | json | jsonyx | msgspec | orjson | fastest time |
99
+ |:--------------------------------------------|-------:|-------:|--------:|-------:|-------------:|
100
+ | List of 256 booleans | 4.54x | 4.06x | 1.04x | 1.00x | 1.85 μs |
101
+ | List of 256 ASCII strings | 11.76x | 10.42x | 1.33x | 1.00x | 4.34 μs |
102
+ | List of 256 floats | 24.82x | 25.10x | 1.30x | 1.00x | 8.09 μs |
103
+ | List of 256 dicts with 1 int | 11.10x | 11.50x | 1.34x | 1.00x | 7.92 μs |
104
+ | Medium complex object | 10.25x | 11.05x | 1.14x | 1.00x | 13.77 μs |
105
+ | List of 256 strings | 22.19x | 17.00x | 1.86x | 1.00x | 15.81 μs |
106
+ | Complex object | 7.54x | 7.41x | 1.00x | DNF | 215.37 μs |
107
+ | Dict with 256 lists of 256 dicts with 1 int | 9.34x | 9.74x | 1.29x | 1.00x | 2394.91 μs |
108
108
 
109
109
  | decode | json | jsonyx | msgspec | orjson | simdjson | fastest time |
110
110
  |:--------------------------------------------|-------:|-------:|--------:|-------:|---------:|-------------:|
111
- | List of 256 booleans | 4.40x | 6.26x | 2.60x | 1.28x | 1.00x | 1.54 μs |
112
- | List of 256 ASCII strings | 9.08x | 12.57x | 5.43x | 5.03x | 1.00x | 2.89 μs |
113
- | List of 256 floats | 10.99x | 12.47x | 2.32x | 1.78x | 1.00x | 6.14 μs |
114
- | List of 256 dicts with 1 int | 12.11x | 15.16x | 6.87x | 5.08x | 1.00x | 6.17 μs |
115
- | Medium complex object | 12.65x | 17.63x | 5.26x | 4.40x | 1.00x | 7.62 μs |
116
- | List of 256 strings | 5.68x | 4.38x | 9.92x | 8.00x | 1.00x | 16.76 μs |
117
- | Complex object | 8.58x | 7.54x | 8.32x | 7.56x | 1.00x | 136.79 μs |
118
- | Dict with 256 lists of 256 dicts with 1 int | 17.65x | 19.13x | 12.07x | 10.78x | 1.00x | 1658.37 μs |
111
+ | List of 256 booleans | 4.36x | 5.26x | 2.76x | 1.40x | 1.00x | 1.46 μs |
112
+ | List of 256 ASCII strings | 8.54x | 6.93x | 4.28x | 3.96x | 1.00x | 3.46 μs |
113
+ | List of 256 floats | 10.85x | 11.25x | 2.23x | 1.74x | 1.00x | 6.05 μs |
114
+ | List of 256 dicts with 1 int | 12.79x | 11.43x | 7.12x | 5.19x | 1.00x | 6.12 μs |
115
+ | Medium complex object | 12.70x | 12.01x | 5.16x | 4.60x | 1.00x | 7.98 μs |
116
+ | List of 256 strings | 7.11x | 3.82x | 9.70x | 7.80x | 1.00x | 16.52 μs |
117
+ | Complex object | 9.87x | 7.74x | 8.90x | 7.94x | 1.00x | 130.28 μs |
118
+ | Dict with 256 lists of 256 dicts with 1 int | 17.84x | 15.18x | 12.08x | 10.32x | 1.00x | 1674.28 μs |
@@ -1,75 +1,75 @@
1
- # jsonyx
2
-
3
- [![pypi](https://img.shields.io/pypi/v/jsonyx.svg)](http://pypi.org/project/jsonyx)
4
- [![conda-forge](https://img.shields.io/conda/vn/conda-forge/jsonyx.svg)](https://anaconda.org/conda-forge/jsonyx)
5
- [![python](https://img.shields.io/pypi/pyversions/jsonyx.svg)](http://pypi.org/project/jsonyx)
6
- [![license](https://img.shields.io/pypi/l/jsonyx.svg)](http://pypi.org/project/jsonyx)
7
- [![pytest](https://github.com/nineteendo/jsonyx/actions/workflows/pytest.yml/badge.svg?branch=2.2.x)](https://github.com/nineteendo/jsonyx/actions/workflows/pytest.yml)
8
- [![docs](https://readthedocs.org/projects/jsonyx/badge/?version=stable)](https://jsonyx.readthedocs.io/en/stable/?badge=stable)
9
- [![downloads](https://img.shields.io/pypi/dm/jsonyx.svg)](http://pypi.org/project/jsonyx)
10
-
11
- `jsonyx` is a customizable [JSON](http://json.org) library for Python 3.8+. It
12
- is written in pure Python with an optional C extension for better performance
13
- and no dependencies.
14
-
15
- The documentation for `jsonyx` is available online at: https://jsonyx.readthedocs.io
16
-
17
- ## Key Features
18
-
19
- - JSON decoding, encoding and patching
20
- - Pretty printing:
21
- ```json
22
- {
23
- "foo": [1, 2, 3],
24
- "bar": {"a": 1, "b": 2, "c": 3}
25
- }
26
- ```
27
- - Optionally supports these JSON deviations (specified in the documentation):
28
- ```javascript
29
- {
30
- /* Block */ // and line comments
31
- "Missing commas": [1 2 3],
32
- "NaN and infinity": [NaN, Infinity, -Infinity],
33
- "Surrogates": "\ud800",
34
- "Trailing comma": [0,],
35
- "Unquoted keys": {key: "value"}
36
- }
37
- ```
38
- - Detailed error messages:
39
- ```none
40
- Traceback (most recent call last):
41
- File "/Users/wannes/Downloads/broken.json", line 1, column 99-381
42
- ...sList": {"GlossEntry": {"ID": "SGM..."GML", "XML"]}, "GlossSee": "markup"
43
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
- jsonyx.JSONSyntaxError: Unterminated object
45
- ```
46
- - Dedicated functions for reading and writing files and pretty printing
47
-
48
- ## Benchmark (Mar 31, 2025)
49
-
50
- We recommend to use [`orjson`](https://pypi.org/project/orjson),
51
- [`msgspec`](https://pypi.org/project/msgspec) or
52
- [`pysimdjson`](https://pypi.org/project/pysimdjson) for performance critical
53
- applications:
54
-
55
- | encode | json | jsonyx | msgspec | orjson | fastest time |
56
- |:--------------------------------------------|-------:|-------:|--------:|--------:|-------------:|
57
- | List of 256 booleans | 4.56x | 5.33x | 1.00x | 1.06x | 1.90 μs |
58
- | List of 256 ASCII strings | 12.12x | 13.65x | 1.50x | 1.00x | 3.95 μs |
59
- | List of 256 floats | 23.41x | 25.95x | 1.30x | 1.00x | 8.03 μs |
60
- | List of 256 dicts with 1 int | 11.10x | 13.61x | 1.32x | 1.00x | 7.75 μs |
61
- | Medium complex object | 10.76x | 11.80x | 1.16x | 1.00x | 13.30 μs |
62
- | List of 256 strings | 23.08x | 19.66x | 2.04x | 1.00x | 14.42 μs |
63
- | Complex object | 7.36x | 7.95x | 1.00x | DNF | 209.74 μs |
64
- | Dict with 256 lists of 256 dicts with 1 int | 9.23x | 11.34x | 1.21x | 1.00x | 2361.90 μs |
65
-
66
- | decode | json | jsonyx | msgspec | orjson | simdjson | fastest time |
67
- |:--------------------------------------------|-------:|-------:|--------:|-------:|---------:|-------------:|
68
- | List of 256 booleans | 4.40x | 6.26x | 2.60x | 1.28x | 1.00x | 1.54 μs |
69
- | List of 256 ASCII strings | 9.08x | 12.57x | 5.43x | 5.03x | 1.00x | 2.89 μs |
70
- | List of 256 floats | 10.99x | 12.47x | 2.32x | 1.78x | 1.00x | 6.14 μs |
71
- | List of 256 dicts with 1 int | 12.11x | 15.16x | 6.87x | 5.08x | 1.00x | 6.17 μs |
72
- | Medium complex object | 12.65x | 17.63x | 5.26x | 4.40x | 1.00x | 7.62 μs |
73
- | List of 256 strings | 5.68x | 4.38x | 9.92x | 8.00x | 1.00x | 16.76 μs |
74
- | Complex object | 8.58x | 7.54x | 8.32x | 7.56x | 1.00x | 136.79 μs |
75
- | Dict with 256 lists of 256 dicts with 1 int | 17.65x | 19.13x | 12.07x | 10.78x | 1.00x | 1658.37 μs |
1
+ # jsonyx
2
+
3
+ [![pypi](https://img.shields.io/pypi/v/jsonyx.svg)](http://pypi.org/project/jsonyx)
4
+ [![conda-forge](https://img.shields.io/conda/vn/conda-forge/jsonyx.svg)](https://anaconda.org/conda-forge/jsonyx)
5
+ [![python](https://img.shields.io/pypi/pyversions/jsonyx.svg)](http://pypi.org/project/jsonyx)
6
+ [![license](https://img.shields.io/pypi/l/jsonyx.svg)](http://pypi.org/project/jsonyx)
7
+ [![pytest](https://github.com/nineteendo/jsonyx/actions/workflows/pytest.yml/badge.svg?branch=2.2.x)](https://github.com/nineteendo/jsonyx/actions/workflows/pytest.yml)
8
+ [![docs](https://readthedocs.org/projects/jsonyx/badge/?version=stable)](https://jsonyx.readthedocs.io/en/stable/?badge=stable)
9
+ [![downloads](https://img.shields.io/pypi/dm/jsonyx.svg)](http://pypi.org/project/jsonyx)
10
+
11
+ `jsonyx` is a customizable [JSON](http://json.org) library for Python 3.8+. It
12
+ is written in pure Python with an optional C extension for better performance
13
+ and no dependencies.
14
+
15
+ The documentation for `jsonyx` is available online at: https://jsonyx.readthedocs.io
16
+
17
+ ## Key Features
18
+
19
+ - JSON decoding, encoding and patching
20
+ - Pretty printing:
21
+ ```json
22
+ {
23
+ "foo": [1, 2, 3],
24
+ "bar": {"a": 1, "b": 2, "c": 3}
25
+ }
26
+ ```
27
+ - Optionally supports these JSON deviations (specified in the documentation):
28
+ ```javascript
29
+ {
30
+ /* Block */ // and line comments
31
+ "Missing commas": [1 2 3],
32
+ "NaN and infinity": [NaN, Infinity, -Infinity],
33
+ "Surrogates": "\ud800",
34
+ "Trailing comma": [0,],
35
+ "Unquoted keys": {key: "value"}
36
+ }
37
+ ```
38
+ - Detailed error messages:
39
+ ```none
40
+ Traceback (most recent call last):
41
+ File "/Users/wannes/Downloads/broken.json", line 1, column 99-381
42
+ ...sList": {"GlossEntry": {"ID": "SGM..."GML", "XML"]}, "GlossSee": "markup"
43
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
+ jsonyx.JSONSyntaxError: Unterminated object
45
+ ```
46
+ - Dedicated functions for reading and writing files and pretty printing
47
+
48
+ ## Benchmark (Apr 20, 2025)
49
+
50
+ We recommend to use [`orjson`](https://pypi.org/project/orjson),
51
+ [`msgspec`](https://pypi.org/project/msgspec) or
52
+ [`pysimdjson`](https://pypi.org/project/pysimdjson) for performance critical
53
+ applications:
54
+
55
+ | encode | json | jsonyx | msgspec | orjson | fastest time |
56
+ |:--------------------------------------------|-------:|-------:|--------:|-------:|-------------:|
57
+ | List of 256 booleans | 4.54x | 4.06x | 1.04x | 1.00x | 1.85 μs |
58
+ | List of 256 ASCII strings | 11.76x | 10.42x | 1.33x | 1.00x | 4.34 μs |
59
+ | List of 256 floats | 24.82x | 25.10x | 1.30x | 1.00x | 8.09 μs |
60
+ | List of 256 dicts with 1 int | 11.10x | 11.50x | 1.34x | 1.00x | 7.92 μs |
61
+ | Medium complex object | 10.25x | 11.05x | 1.14x | 1.00x | 13.77 μs |
62
+ | List of 256 strings | 22.19x | 17.00x | 1.86x | 1.00x | 15.81 μs |
63
+ | Complex object | 7.54x | 7.41x | 1.00x | DNF | 215.37 μs |
64
+ | Dict with 256 lists of 256 dicts with 1 int | 9.34x | 9.74x | 1.29x | 1.00x | 2394.91 μs |
65
+
66
+ | decode | json | jsonyx | msgspec | orjson | simdjson | fastest time |
67
+ |:--------------------------------------------|-------:|-------:|--------:|-------:|---------:|-------------:|
68
+ | List of 256 booleans | 4.36x | 5.26x | 2.76x | 1.40x | 1.00x | 1.46 μs |
69
+ | List of 256 ASCII strings | 8.54x | 6.93x | 4.28x | 3.96x | 1.00x | 3.46 μs |
70
+ | List of 256 floats | 10.85x | 11.25x | 2.23x | 1.74x | 1.00x | 6.05 μs |
71
+ | List of 256 dicts with 1 int | 12.79x | 11.43x | 7.12x | 5.19x | 1.00x | 6.12 μs |
72
+ | Medium complex object | 12.70x | 12.01x | 5.16x | 4.60x | 1.00x | 7.98 μs |
73
+ | List of 256 strings | 7.11x | 3.82x | 9.70x | 7.80x | 1.00x | 16.52 μs |
74
+ | Complex object | 9.87x | 7.74x | 8.90x | 7.94x | 1.00x | 130.28 μs |
75
+ | Dict with 256 lists of 256 dicts with 1 int | 17.84x | 15.18x | 12.08x | 10.32x | 1.00x | 1674.28 μs |
@@ -1,54 +1,54 @@
1
- """jsonyx setup."""
2
- from __future__ import annotations
3
-
4
- __all__: list[str] = []
5
-
6
- from pathlib import Path
7
-
8
- # pylint: disable-next=E0401
9
- from setuptools import Extension, setup # type: ignore
10
-
11
- if __name__ == "__main__":
12
- setup(
13
- name="jsonyx",
14
- version="2.2.0",
15
- description="Customizable JSON library for Python",
16
- long_description=Path("README.md").read_text(encoding="utf-8"),
17
- long_description_content_type="text/markdown",
18
- author="Nice Zombies",
19
- author_email="nineteendo19d0@gmail.com",
20
- maintainer="Nice Zombies",
21
- maintainer_email="nineteendo19d0@gmail.com",
22
- packages=["jsonyx", "jsonyx.test"],
23
- ext_modules=[
24
- Extension("_jsonyx", ["src/jsonyx/_speedups.c"], optional=True),
25
- ],
26
- classifiers=[
27
- "Development Status :: 5 - Production/Stable",
28
- "Intended Audience :: Developers",
29
- "Operating System :: OS Independent",
30
- "Programming Language :: Python :: 3 :: Only",
31
- "Programming Language :: Python :: 3.8",
32
- "Programming Language :: Python :: 3.9",
33
- "Programming Language :: Python :: 3.10",
34
- "Programming Language :: Python :: 3.11",
35
- "Programming Language :: Python :: 3.12",
36
- "Programming Language :: Python :: 3.13",
37
- "Programming Language :: Python :: 3.14",
38
- ],
39
- license="GPL-3.0",
40
- keywords=["python", "json", "json-parser"],
41
- package_dir={"": "src"},
42
- # setuptools arguments
43
- entry_points={"console_scripts": ["jsonyx = jsonyx.__main__:main"]},
44
- python_requires=">=3.8",
45
- project_urls={
46
- "Homepage": "https://github.com/nineteendo/jsonyx",
47
- "Changelog": (
48
- "https://jsonyx.readthedocs.io/en/latest/changelog.html"
49
- ),
50
- "Documentation": "https://jsonyx.readthedocs.io",
51
- "Issues": "https://github.com/nineteendo/jsonyx/issues",
52
- "Sponser": "https://paypal.me/nineteendo",
53
- },
54
- )
1
+ """jsonyx setup."""
2
+ from __future__ import annotations
3
+
4
+ __all__: list[str] = []
5
+
6
+ from pathlib import Path
7
+
8
+ # pylint: disable-next=E0401
9
+ from setuptools import Extension, setup # type: ignore
10
+
11
+ if __name__ == "__main__":
12
+ setup(
13
+ name="jsonyx",
14
+ version="2.2.1",
15
+ description="Customizable JSON library for Python",
16
+ long_description=Path("README.md").read_text(encoding="utf-8"),
17
+ long_description_content_type="text/markdown",
18
+ author="Nice Zombies",
19
+ author_email="nineteendo19d0@gmail.com",
20
+ maintainer="Nice Zombies",
21
+ maintainer_email="nineteendo19d0@gmail.com",
22
+ packages=["jsonyx", "jsonyx.test"],
23
+ ext_modules=[
24
+ Extension("_jsonyx", ["src/jsonyx/_speedups.c"], optional=True),
25
+ ],
26
+ classifiers=[
27
+ "Development Status :: 5 - Production/Stable",
28
+ "Intended Audience :: Developers",
29
+ "Operating System :: OS Independent",
30
+ "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3.8",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Programming Language :: Python :: 3.14",
38
+ ],
39
+ license="GPL-3.0",
40
+ keywords=["python", "json", "json-parser"],
41
+ package_dir={"": "src"},
42
+ # setuptools arguments
43
+ entry_points={"console_scripts": ["jsonyx = jsonyx.__main__:main"]},
44
+ python_requires=">=3.8",
45
+ project_urls={
46
+ "Homepage": "https://github.com/nineteendo/jsonyx",
47
+ "Changelog": (
48
+ "https://jsonyx.readthedocs.io/en/latest/changelog.html"
49
+ ),
50
+ "Documentation": "https://jsonyx.readthedocs.io",
51
+ "Issues": "https://github.com/nineteendo/jsonyx/issues",
52
+ "Sponser": "https://paypal.me/nineteendo",
53
+ },
54
+ )
@@ -21,7 +21,7 @@ __all__: list[str] = [
21
21
  "select_nodes",
22
22
  "write",
23
23
  ]
24
- __version__: str = "2.2.0"
24
+ __version__: str = "2.2.1"
25
25
 
26
26
  from typing import TYPE_CHECKING, Any, Protocol, TypeVar
27
27
 
@@ -135,7 +135,7 @@ def read(
135
135
  >>> with TemporaryDirectory() as tmpdir:
136
136
  ... filename = Path(tmpdir) / "file.json"
137
137
  ... _ = filename.write_text('["filesystem API"]', "utf-8")
138
- ... json.Decoder().read(filename)
138
+ ... json.read(filename)
139
139
  ...
140
140
  ['filesystem API']
141
141
 
@@ -242,7 +242,8 @@ def _run(args: _Namespace) -> None:
242
242
  stderr.write("".join(format_syntax_error(exc)))
243
243
  sys.exit(1)
244
244
  except (
245
- AssertionError, LookupError, RecursionError, TypeError, ValueError,
245
+ AssertionError, LookupError, OSError, RecursionError, TypeError,
246
+ ValueError,
246
247
  ) as exc:
247
248
  stderr.write("".join(format_exception_only(None, exc)))
248
249
  sys.exit(1)
@@ -126,6 +126,8 @@ def _unescape_unicode(filename: str, s: str, end: int) -> int:
126
126
  class TruncatedSyntaxError(SyntaxError):
127
127
  """Truncated syntax error.
128
128
 
129
+ .. versionadded:: 2.0
130
+
129
131
  :param msg: an error message
130
132
  :param filename: the path to the file
131
133
  :param doc: a string
@@ -262,6 +264,7 @@ def detect_encoding(b: bytes) -> str:
262
264
  # XX 00 XX -- - utf-16-le
263
265
  encoding = "utf-16-le" if b[2] or b[3] else "utf-32-le"
264
266
  elif len(b) == 2:
267
+ # check for cut off json
265
268
  if not b[0]:
266
269
  # 00 -- - utf-16-be
267
270
  encoding = "utf-16-be"
@@ -679,10 +682,11 @@ class Decoder:
679
682
  >>> import jsonyx as json
680
683
  >>> from pathlib import Path
681
684
  >>> from tempfile import TemporaryDirectory
685
+ >>> decoder = json.Decoder()
682
686
  >>> with TemporaryDirectory() as tmpdir:
683
687
  ... filename = Path(tmpdir) / "file.json"
684
688
  ... _ = filename.write_text('["filesystem API"]', "utf-8")
685
- ... json.Decoder().read(filename)
689
+ ... decoder.read(filename)
686
690
  ...
687
691
  ['filesystem API']
688
692
 
@@ -220,22 +220,20 @@ except ImportError:
220
220
  first: bool = True
221
221
  items: ItemsView[object, object] = mapping.items()
222
222
  for key, value in sorted(items) if sort_keys else items:
223
- new_key = hook(key)
224
- if isinstance(new_key, (str, str_types)):
225
- s = str(new_key)
223
+ key = hook(key) # noqa: PLW2901
224
+ if isinstance(key, (str, str_types)):
225
+ s = str(key)
226
226
  else:
227
- if new_key is None:
227
+ if key is None:
228
228
  s = "null"
229
- elif isinstance(new_key, (bool, bool_types)):
230
- s = "true" if new_key else "false"
231
- elif isinstance(new_key, (
232
- float, int, float_types, int_types,
233
- )):
234
- s = encode_float(new_key) # type: ignore
229
+ elif isinstance(key, (bool, bool_types)):
230
+ s = "true" if key else "false"
231
+ elif isinstance(key, (float, int, float_types, int_types)):
232
+ s = encode_float(key) # type: ignore
235
233
  elif skipkeys:
236
234
  continue
237
235
  else:
238
- msg = f"Keys must be str, not {type(new_key).__name__}"
236
+ msg = f"Keys must be str, not {type(key).__name__}"
239
237
  raise TypeError(msg)
240
238
 
241
239
  if not allow_non_str_keys: