json_write 0.0.1.2__tar.gz → 0.0.1.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,34 +1,30 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: json_write
3
- Version: 0.0.1.2
3
+ Version: 0.0.1.3
4
4
  Summary: JSON write tools.
5
- Home-page: https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/json_write
6
5
  License: MIT
6
+ License-File: LICENSE
7
7
  Keywords: json,write
8
8
  Author: ChenyangGao
9
9
  Author-email: wosiwujm@gmail.com
10
+ Requires-Python: >=3.10,<4.0
10
11
  Classifier: Development Status :: 5 - Production/Stable
11
12
  Classifier: Intended Audience :: Developers
12
13
  Classifier: License :: OSI Approved :: MIT License
13
14
  Classifier: Operating System :: OS Independent
14
15
  Classifier: Programming Language :: Python
15
- Classifier: Programming Language :: Python :: 2
16
- Classifier: Programming Language :: Python :: 2.7
17
16
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.4
19
- Classifier: Programming Language :: Python :: 3.5
20
- Classifier: Programming Language :: Python :: 3.6
21
- Classifier: Programming Language :: Python :: 3.7
22
- Classifier: Programming Language :: Python :: 3.8
23
- Classifier: Programming Language :: Python :: 3.9
24
17
  Classifier: Programming Language :: Python :: 3.10
25
18
  Classifier: Programming Language :: Python :: 3.11
26
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
27
22
  Classifier: Programming Language :: Python :: 3 :: Only
28
23
  Classifier: Topic :: Software Development
29
24
  Classifier: Topic :: Software Development :: Libraries
30
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
- Project-URL: Repository, https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/json_write
26
+ Project-URL: Homepage, https://github.com/ChenyangGao/python-modules/tree/main/json_write
27
+ Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/json_write
32
28
  Description-Content-Type: text/markdown
33
29
 
34
30
  # JSON write tools
@@ -23,12 +23,12 @@ dumps: Callable[..., bytes]
23
23
  try:
24
24
  from orjson import dumps
25
25
  except ImportError:
26
- odumps: Callable[..., str]
26
+ _dumps: Callable[..., str]
27
27
  try:
28
- from ujson import dumps as odumps
28
+ from ujson import dumps as _dumps
29
29
  except ImportError:
30
- from json import dumps as odumps
31
- dumps = lambda obj: bytes(odumps(obj, ensure_ascii=False), "utf-8")
30
+ from json import dumps as _dumps
31
+ dumps = lambda obj: _dumps(obj, ensure_ascii=False).encode("utf-8")
32
32
 
33
33
 
34
34
  PathType: TypeAlias = bytes | str | PathLike
@@ -66,7 +66,7 @@ def foreach(fn, it, /, *its):
66
66
  @gen_startup
67
67
  def json_log_gen_write(
68
68
  value: Optional[Callable] = None,
69
- file: SupportsWriteBytes | TextIOWrapper = stdout,
69
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
70
70
  ):
71
71
  if isinstance(file, TextIOWrapper):
72
72
  file = file.buffer
@@ -83,7 +83,7 @@ def json_log_write(
83
83
  it: Iterable,
84
84
  /,
85
85
  value: Optional[Callable] = None,
86
- file: SupportsWriteBytes | TextIOWrapper = stdout,
86
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
87
87
  ):
88
88
  with gen_as_ctx(json_log_gen_write(value=value, file=file)) as write:
89
89
  foreach(write, it)
@@ -92,7 +92,7 @@ def json_log_write(
92
92
  @gen_startup
93
93
  def json_array_gen_write(
94
94
  value: Optional[Callable] = None,
95
- file: SupportsWriteBytes | TextIOWrapper = stdout,
95
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
96
96
  ):
97
97
  if isinstance(file, TextIOWrapper):
98
98
  file = file.buffer
@@ -117,7 +117,7 @@ def json_array_write(
117
117
  it: Iterable,
118
118
  /,
119
119
  value: Optional[Callable] = None,
120
- file: SupportsWriteBytes | TextIOWrapper = stdout,
120
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
121
121
  ):
122
122
  with gen_as_ctx(json_array_gen_write(value=value, file=file)) as write:
123
123
  foreach(write, it)
@@ -127,7 +127,7 @@ def json_array_write(
127
127
  def json_object_gen_write(
128
128
  key: Callable,
129
129
  value: Optional[Callable] = None,
130
- file: SupportsWriteBytes | TextIOWrapper = stdout,
130
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
131
131
  ):
132
132
  if isinstance(file, TextIOWrapper):
133
133
  file = file.buffer
@@ -154,7 +154,7 @@ def json_object_write(
154
154
  /,
155
155
  key: Optional[Callable] = None,
156
156
  value: Optional[Callable] = None,
157
- file: SupportsWriteBytes | TextIOWrapper = stdout,
157
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
158
158
  ):
159
159
  if key is None:
160
160
  if isinstance(it, Mapping):
@@ -176,7 +176,7 @@ def json_groups_gen_write(
176
176
  keys: Sequence[Callable],
177
177
  *,
178
178
  value: Optional[Callable] = None,
179
- file: SupportsWriteBytes | TextIOWrapper = stdout,
179
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
180
180
  ):
181
181
  assert keys, "empty keys"
182
182
  if isinstance(file, TextIOWrapper):
@@ -216,7 +216,7 @@ def json_groups_write(
216
216
  /,
217
217
  keys: Sequence[Callable],
218
218
  value: Optional[Callable] = None,
219
- file: SupportsWriteBytes | TextIOWrapper = stdout,
219
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
220
220
  ):
221
221
  with gen_as_ctx(json_groups_gen_write(keys, value=value, file=file)) as write:
222
222
  foreach(write, it)
@@ -225,7 +225,7 @@ def json_groups_write(
225
225
  def json_gen_write(
226
226
  keys: None | Callable | Sequence[Callable] = None,
227
227
  value: Optional[Callable] = None,
228
- file: SupportsWriteBytes | TextIOWrapper = stdout,
228
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
229
229
  ):
230
230
  if keys is None:
231
231
  return json_log_gen_write(value=value, file=file)
@@ -244,7 +244,7 @@ def json_write(
244
244
  /,
245
245
  keys: None | Callable | Sequence[Callable] = None,
246
246
  value: Optional[Callable] = None,
247
- file: SupportsWriteBytes | TextIOWrapper = stdout,
247
+ file: SupportsWriteBytes | TextIOWrapper = stdout, # type: ignore
248
248
  ):
249
249
  with gen_as_ctx(json_gen_write(keys=keys, value=value, file=file)) as write:
250
250
  foreach(write, it)
@@ -1,12 +1,12 @@
1
1
  [tool.poetry]
2
2
  name = "json_write"
3
- version = "0.0.1.2"
3
+ version = "0.0.1.3"
4
4
  description = "JSON write tools."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
7
7
  readme = "readme.md"
8
- homepage = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/json_write"
9
- repository = "https://github.com/ChenyangGao/web-mount-packs/tree/main/python-module/json_write"
8
+ homepage = "https://github.com/ChenyangGao/python-modules/tree/main/json_write"
9
+ repository = "https://github.com/ChenyangGao/python-modules/tree/main/json_write"
10
10
  keywords = ["json", "write"]
11
11
  classifiers = [
12
12
  "License :: OSI Approved :: MIT License",
@@ -25,6 +25,9 @@ include = [
25
25
  "LICENSE",
26
26
  ]
27
27
 
28
+ [tool.poetry.dependencies]
29
+ python = "^3.10"
30
+
28
31
  [build-system]
29
32
  requires = ["poetry-core"]
30
33
  build-backend = "poetry.core.masonry.api"
File without changes
File without changes