datamodel-code-generator 0.34.0__py3-none-any.whl → 0.35.0__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.

Potentially problematic release.


This version of datamodel-code-generator might be problematic. Click here for more details.

@@ -111,9 +111,15 @@ class Config(BaseModel):
111
111
 
112
112
  @field_validator("aliases", "extra_template_data", "custom_formatters_kwargs", mode="before")
113
113
  def validate_file(cls, value: Any) -> TextIOBase | None: # noqa: N805
114
- if value is None or isinstance(value, TextIOBase):
114
+ if value is None: # pragma: no cover
115
115
  return value
116
- return cast("TextIOBase", Path(value).expanduser().resolve().open("rt"))
116
+
117
+ path = Path(value)
118
+ if path.is_file():
119
+ return cast("TextIOBase", path.expanduser().resolve().open("rt"))
120
+
121
+ msg = f"A file was expected but {value} is not a file."
122
+ raise Error(msg) # pragma: no cover
117
123
 
118
124
  @field_validator(
119
125
  "input",
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import locale
4
- from argparse import ArgumentParser, FileType, HelpFormatter, Namespace
4
+ from argparse import ArgumentParser, HelpFormatter, Namespace
5
5
  from operator import attrgetter
6
+ from pathlib import Path
6
7
  from typing import TYPE_CHECKING
7
8
 
8
9
  from datamodel_code_generator import DataModelType, InputFileType, OpenAPIScope
@@ -417,7 +418,7 @@ field_options.add_argument(
417
418
  template_options.add_argument(
418
419
  "--aliases",
419
420
  help="Alias mapping file",
420
- type=FileType("rt"),
421
+ type=Path,
421
422
  )
422
423
  template_options.add_argument(
423
424
  "--custom-file-header",
@@ -448,7 +449,7 @@ template_options.add_argument(
448
449
  "apply the template data to multiple objects with the same name. "
449
450
  "If you are using another input file type (e.g. GraphQL), the key is the name of the object. "
450
451
  "The value is a dictionary of the template data to add.",
451
- type=FileType("rt"),
452
+ type=Path,
452
453
  )
453
454
  template_options.add_argument(
454
455
  "--use-double-quotes",
@@ -485,7 +486,7 @@ base_options.add_argument(
485
486
  template_options.add_argument(
486
487
  "--custom-formatters-kwargs",
487
488
  help="A file with kwargs for custom formatters.",
488
- type=FileType("rt"),
489
+ type=Path,
489
490
  )
490
491
 
491
492
  # ======================================================================================
@@ -31,6 +31,7 @@ class PythonVersion(Enum):
31
31
  PY_311 = "3.11"
32
32
  PY_312 = "3.12"
33
33
  PY_313 = "3.13"
34
+ PY_314 = "3.14"
34
35
 
35
36
  @cached_property
36
37
  def _is_py_310_or_later(self) -> bool: # pragma: no cover
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datamodel-code-generator
3
- Version: 0.34.0
3
+ Version: 0.35.0
4
4
  Summary: Datamodel Code Generator
5
5
  Project-URL: Homepage, https://github.com/koxudaxi/datamodel-code-generator
6
6
  Project-URL: Source, https://github.com/koxudaxi/datamodel-code-generator
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
19
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
21
  Requires-Python: >=3.9
21
22
  Requires-Dist: argcomplete<4,>=2.10.1
@@ -516,7 +517,7 @@ Model customization:
516
517
  Set name of models defined inline from the parent model
517
518
  --reuse-model Reuse models on the field when a module has the model with the same
518
519
  content
519
- --target-python-version {3.9,3.10,3.11,3.12,3.13}
520
+ --target-python-version {3.9,3.10,3.11,3.12,3.13,3.14}
520
521
  target python version
521
522
  --treat-dot-as-module
522
523
  treat dotted module names as modules
@@ -1,7 +1,7 @@
1
1
  datamodel_code_generator/__init__.py,sha256=fDwU8afS8W-Z8UQeV7-xvAYCpuzlrMgRDv-TXJ4Wowg,21330
2
- datamodel_code_generator/__main__.py,sha256=EaL4uRLqNLnhajYaXtJ5w3viPnhg6kJZmACso3Bu_tw,25556
3
- datamodel_code_generator/arguments.py,sha256=qWpWeLHTC1yp8JtVMFFjMf4DKJAWZivhLLbESW8ivQo,17923
4
- datamodel_code_generator/format.py,sha256=mhHcPrxc1n3j4IuIUGz67kU3gSWI9nQNlMkkPCNJ888,8938
2
+ datamodel_code_generator/__main__.py,sha256=6zVWd1uiX5J25vZBIEU7KLYweWy5Amj7SpN2Q2lxrHI,25705
3
+ datamodel_code_generator/arguments.py,sha256=0dfqqv0UL7Jkhh26q03K1RKrqIgPjj_BtDvI0fPSF7g,17908
4
+ datamodel_code_generator/format.py,sha256=1VgZ3q-NJbBPJ98cQUhCBsLfFC2WnQbONKohKOWwvgs,8958
5
5
  datamodel_code_generator/http.py,sha256=LE94GC7I9D8lWIg_YAGWedfy0XNxOXTmiYKuNMTwouo,887
6
6
  datamodel_code_generator/imports.py,sha256=Nq83WbEGCegntg3WX4VbKfzAIs84alZ7IrYyNPrlUbc,5517
7
7
  datamodel_code_generator/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -52,8 +52,8 @@ datamodel_code_generator/parser/base.py,sha256=lwmy7aCi-BH78DARDa657i5_wURHvmWcn
52
52
  datamodel_code_generator/parser/graphql.py,sha256=x5Jge8xZiaup9jMhX6jVKncme_D5FmSoEWmXIKtguVo,23384
53
53
  datamodel_code_generator/parser/jsonschema.py,sha256=TGxKrJRxPYEAP8uiFIKrkgH3Vj3HCTQ6csIDGvJorng,72513
54
54
  datamodel_code_generator/parser/openapi.py,sha256=puBXUaq4zXDl7wj-VsZmmmt_D672RfS6qY9WID0VRPw,28603
55
- datamodel_code_generator-0.34.0.dist-info/METADATA,sha256=_omboMSmg84vGvx85QpCFHiAChNpxe-PEzQOgS_oP-4,26091
56
- datamodel_code_generator-0.34.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- datamodel_code_generator-0.34.0.dist-info/entry_points.txt,sha256=cJVcHiEViQMANaoM5C1xR5hzmyCqH6hHHMpV8W00in8,77
58
- datamodel_code_generator-0.34.0.dist-info/licenses/LICENSE,sha256=K54Lwc6_jduycsy8oFFjQEeSSuEiqvVIjCGIXOMnuTQ,1068
59
- datamodel_code_generator-0.34.0.dist-info/RECORD,,
55
+ datamodel_code_generator-0.35.0.dist-info/METADATA,sha256=It_DP-qTVcSnx4BxNmrIbw2P3g3HV46SoWgmwnwf-wc,26147
56
+ datamodel_code_generator-0.35.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ datamodel_code_generator-0.35.0.dist-info/entry_points.txt,sha256=cJVcHiEViQMANaoM5C1xR5hzmyCqH6hHHMpV8W00in8,77
58
+ datamodel_code_generator-0.35.0.dist-info/licenses/LICENSE,sha256=K54Lwc6_jduycsy8oFFjQEeSSuEiqvVIjCGIXOMnuTQ,1068
59
+ datamodel_code_generator-0.35.0.dist-info/RECORD,,