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

@@ -525,7 +525,7 @@ def infer_input_type(text: str) -> InputFileType:
525
525
 
526
526
 
527
527
  inferred_message = (
528
- 'The input file type was determined to be: {}\nThis can be specificied explicitly with the '
528
+ 'The input file type was determined to be: {}\nThis can be specified explicitly with the '
529
529
  '`--input-file-type` option.'
530
530
  )
531
531
 
@@ -7,11 +7,15 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence
7
7
  from warnings import warn
8
8
 
9
9
  import black
10
- import black.mode
11
10
  import isort
12
11
 
13
12
  from datamodel_code_generator.util import cached_property, load_toml
14
13
 
14
+ try:
15
+ import black.mode
16
+ except ImportError: # pragma: no cover
17
+ black.mode = None
18
+
15
19
 
16
20
  class PythonVersion(Enum):
17
21
  PY_36 = '3.6'
@@ -63,7 +63,7 @@ class ConstraintsBase(_BaseModel):
63
63
 
64
64
  @cached_property
65
65
  def has_constraints(self) -> bool:
66
- return any(v for v in self.dict().values() if v is not None)
66
+ return any(v is not None for v in self.dict().values())
67
67
 
68
68
  @staticmethod
69
69
  def merge_constraints(
@@ -87,7 +87,9 @@ class DataModelField(DataModelFieldBase):
87
87
  return result
88
88
 
89
89
  def self_reference(self) -> bool:
90
- return isinstance(self.parent, BaseModel) and self.parent.reference.path in {
90
+ return isinstance(
91
+ self.parent, BaseModelBase
92
+ ) and self.parent.reference.path in {
91
93
  d.reference.path for d in self.data_type.all_data_types if d.reference
92
94
  }
93
95
 
@@ -111,12 +113,12 @@ class DataModelField(DataModelFieldBase):
111
113
  data_type = data_type.data_types[0]
112
114
  if (
113
115
  data_type.reference
114
- and isinstance(data_type.reference.source, BaseModel)
116
+ and isinstance(data_type.reference.source, BaseModelBase)
115
117
  and isinstance(self.default, list)
116
118
  ): # pragma: no cover
117
119
  return f'lambda :[{data_type.alias or data_type.reference.source.class_name}.{self._PARSE_METHOD}(v) for v in {repr(self.default)}]'
118
120
  elif data_type.reference and isinstance(
119
- data_type.reference.source, BaseModel
121
+ data_type.reference.source, BaseModelBase
120
122
  ): # pragma: no cover
121
123
  return f'lambda :{data_type.alias or data_type.reference.source.class_name}.{self._PARSE_METHOD}({repr(self.default)})'
122
124
  return None
@@ -1 +1 @@
1
- version: str = '0.25.3'
1
+ version: str = '0.25.4'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datamodel-code-generator
3
- Version: 0.25.3
3
+ Version: 0.25.4
4
4
  Summary: Datamodel Code Generator
5
5
  Home-page: https://github.com/koxudaxi/datamodel-code-generator
6
6
  License: MIT
@@ -377,7 +377,7 @@ Options:
377
377
  --http-ignore-tls Disable verification of the remote host's TLS
378
378
  certificate
379
379
  --input INPUT Input file/directory (default: stdin)
380
- --input-file-type {auto,openapi,jsonschema,json,yaml,dict,csv}
380
+ --input-file-type {auto,openapi,graphql,jsonschema,json,yaml,dict,csv}
381
381
  Input file type (default: auto)
382
382
  --output OUTPUT Output file (default: stdout)
383
383
  --output-model-type {pydantic.BaseModel,pydantic_v2.BaseModel,dataclasses.dataclass,typing.TypedDict,msgspec.Struct}
@@ -467,7 +467,7 @@ Model customization:
467
467
  --enable-version-header
468
468
  Enable package version on file headers
469
469
  --keep-model-order Keep generated models' order
470
- --reuse-model Re-use models on the field when a module has the model
470
+ --reuse-model Reuse models on the field when a module has the model
471
471
  with the same content
472
472
  --target-python-version {3.6,3.7,3.8,3.9,3.10,3.11}
473
473
  target python version (default: 3.7)
@@ -1,17 +1,17 @@
1
- datamodel_code_generator/__init__.py,sha256=1UiLHVPtIICwmqJzdzKhjWCABncOeeVLd5WmrKiQLw8,17717
1
+ datamodel_code_generator/__init__.py,sha256=cCmyB7qRG9GE6wNQmTcY7MC_rY43yryxyhxLlVav1EA,17715
2
2
  datamodel_code_generator/__main__.py,sha256=7yvaMVa8KXwFUzBwiuKVzD-bs-tO66oGcIzWW3ZAOSI,18496
3
3
  datamodel_code_generator/arguments.py,sha256=N5dOWb_cR5orktDK1FeGy7txVN566mxRlGkvyGeTVaY,14594
4
- datamodel_code_generator/format.py,sha256=61b_zlMElVNvyMdN3VZfkQ4JVy0TnUfirJrVuD1MWF0,8553
4
+ datamodel_code_generator/format.py,sha256=eC_TTYICLDtM4Y_mbdT9PNjxzwuWSirwaOc5pyTt0to,8625
5
5
  datamodel_code_generator/http.py,sha256=WYScR7rqz8GjgdVPPhFp4PJzgON5DPpO1vmHQLDxYxE,590
6
6
  datamodel_code_generator/imports.py,sha256=SJmkUIxHPCH3rDLMdXsUcT5pPfT9rjc-nmREOLx4Kxw,5283
7
7
  datamodel_code_generator/model/__init__.py,sha256=A0CqnL87-lY_Te-n-99ya5v7h6l4jE6hOPP_itvcWOc,3091
8
- datamodel_code_generator/model/base.py,sha256=skBjppN-7-QGYkq_X4KI2YzAzXHnj8j-fn_rGL4T-Xk,14028
8
+ datamodel_code_generator/model/base.py,sha256=WshtblvxQ9fiRE2G7bdFiDRu6aDGSPhcIiiGIIBp1hg,14023
9
9
  datamodel_code_generator/model/dataclass.py,sha256=9meJNWb-XPYYO8kDMSLhSfO6fulGWV7r3_XIM5kA71M,3965
10
10
  datamodel_code_generator/model/enum.py,sha256=Giehhtij2DZs2LssSJnG_CIIHsSA7Mkz471GU-Cb5kI,3338
11
11
  datamodel_code_generator/model/imports.py,sha256=9-0bd-DvZRjZkWMsmw-gykL8fzTd6M-vQEqS7Rm_ty4,725
12
12
  datamodel_code_generator/model/msgspec.py,sha256=_568E91e07NX-A1bOeITOqr3h1Cr9ykecoSYeIZ5PwI,8934
13
13
  datamodel_code_generator/model/pydantic/__init__.py,sha256=AYMjDCtnV4vweYqe1asTRCYdOo8IGLBhd8pEdxyY8ok,1372
14
- datamodel_code_generator/model/pydantic/base_model.py,sha256=8IIAKHflAqw7M7E86tZGejTVZcIRUhgSGv6ai_6eTVo,11936
14
+ datamodel_code_generator/model/pydantic/base_model.py,sha256=Y2GSlcLBvQh8hrlwGE3rGLTsQLKxERBts0so5BcUP6Y,11970
15
15
  datamodel_code_generator/model/pydantic/custom_root_type.py,sha256=XOeJqzUEAYE21C3hPAnRIz9iDWIjZvUOWDc9MCrpdvw,299
16
16
  datamodel_code_generator/model/pydantic/dataclass.py,sha256=sbqTmutl8Fjf1pYngfdv0NMXt904QcTRpHqmZy6GUiQ,424
17
17
  datamodel_code_generator/model/pydantic/imports.py,sha256=2nSLYwphBUMQEa0PTSNwoLjEBslu02EQb6BdZ-S51yk,2189
@@ -51,9 +51,9 @@ datamodel_code_generator/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
51
51
  datamodel_code_generator/reference.py,sha256=EoalUNUP5us31bfMrHDa1iiKqxL8gHrpZKY_IxgZrOg,26347
52
52
  datamodel_code_generator/types.py,sha256=nGUJRwli267SBEhbsAfWIWSf1kDtqGM74Ha-Y05Xvzg,19551
53
53
  datamodel_code_generator/util.py,sha256=LCEqSCPsVJkn-aiXltZBcw5G7cQqte9IQnyd0Z8LGrE,3700
54
- datamodel_code_generator/version.py,sha256=mTqeZ78dbh-59OFkWYOFtpRO5QGjCQtud3ijsmfjfyk,24
55
- datamodel_code_generator-0.25.3.dist-info/LICENSE,sha256=K54Lwc6_jduycsy8oFFjQEeSSuEiqvVIjCGIXOMnuTQ,1068
56
- datamodel_code_generator-0.25.3.dist-info/METADATA,sha256=8pcIMiS1YKAWnXgVeRSLqIzDGVhIWJ_ZR_n-rt_h72g,22991
57
- datamodel_code_generator-0.25.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
58
- datamodel_code_generator-0.25.3.dist-info/entry_points.txt,sha256=bykbUWqOCiKfxJPGe8jpNqTqD1NG7uyRmozdnwzu7rk,76
59
- datamodel_code_generator-0.25.3.dist-info/RECORD,,
54
+ datamodel_code_generator/version.py,sha256=CqzzGug_BFVu7hwUZejterHsBy7pNwfFPjYBYXKyO8g,24
55
+ datamodel_code_generator-0.25.4.dist-info/LICENSE,sha256=K54Lwc6_jduycsy8oFFjQEeSSuEiqvVIjCGIXOMnuTQ,1068
56
+ datamodel_code_generator-0.25.4.dist-info/METADATA,sha256=ukdujdmWa09n01AAkzibHYZ-hffMFPT9F1jdodyCzzQ,22998
57
+ datamodel_code_generator-0.25.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
58
+ datamodel_code_generator-0.25.4.dist-info/entry_points.txt,sha256=bykbUWqOCiKfxJPGe8jpNqTqD1NG7uyRmozdnwzu7rk,76
59
+ datamodel_code_generator-0.25.4.dist-info/RECORD,,