xn-model 1.0.8__py3-none-any.whl → 1.0.10__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.
x_model/models.py CHANGED
@@ -28,13 +28,13 @@ class Model(TortModel):
28
28
  @classmethod
29
29
  def out_type(cls):
30
30
  if not cls._out_type:
31
- cls._out = pydantic_model_creator(cls, name=cls.__name__ + "Out")
31
+ cls._out_type = pydantic_model_creator(cls, name=cls.__name__ + "Out")
32
32
  return cls._out_type
33
33
 
34
34
  @classmethod
35
35
  def in_type(cls):
36
36
  if not cls._in_type:
37
- cls._inn = pydantic_model_creator(
37
+ cls._in_type = pydantic_model_creator(
38
38
  cls, name=cls.__name__ + "In", exclude_readonly=True, meta_override=cls.PydanticMetaIn
39
39
  )
40
40
  return cls._in_type
x_model/types.py CHANGED
@@ -1,15 +1,17 @@
1
- from pydantic import BaseModel
1
+ from typing import ClassVar
2
+ from msgspec import Struct
3
+ from msgspec.structs import asdict
2
4
 
3
5
 
4
- class New(BaseModel):
5
- _unq: list[str] = []
6
+ class New(Struct):
7
+ _unq: ClassVar[tuple[str]] = ()
6
8
 
7
- def df_unq(self) -> dict:
8
- d = self.model_dump(exclude_none=True)
9
+ def df_unq(self, frozen_props: tuple[str] = ()) -> dict:
10
+ d = {k: v for k, v in asdict(self).items() if v is not None or k in frozen_props}
9
11
  return {**{k: d.pop(k) for k in set(self._unq) & d.keys()}, "defaults": d}
10
12
 
11
13
 
12
14
  class Upd(New):
13
- _unq: list[str] = ["id"]
15
+ _unq = ("id",)
14
16
 
15
17
  id: int
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xn-model
3
- Version: 1.0.8
3
+ Version: 1.0.10
4
4
  Summary: Base model for xn-api
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,9 @@
1
+ x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
2
+ x_model/field.py,sha256=w5BAoNA33a-uROaExx5Pr3jYQnUMKIYFYcPTjdBlx3M,2784
3
+ x_model/func.py,sha256=E7jDoHJGaFpKvxbHnT_lyBxUZeMo-GRd5gv9dLw7B9s,289
4
+ x_model/models.py,sha256=-dhEPBoOIcMvkWayjgOBt9xYiOalv8ZIM9bmFziVdzM,2710
5
+ x_model/types.py,sha256=FEb0dPkmeU7sz_To1iT3-yk4UOD7S8xfiHGoYIFEpk0,432
6
+ xn_model-1.0.10.dist-info/METADATA,sha256=4NkzzJAq2EuhxVlBI0Tj6MCsdjoKoTuUpEgbXfxEWps,962
7
+ xn_model-1.0.10.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
8
+ xn_model-1.0.10.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
9
+ xn_model-1.0.10.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
2
- x_model/field.py,sha256=w5BAoNA33a-uROaExx5Pr3jYQnUMKIYFYcPTjdBlx3M,2784
3
- x_model/func.py,sha256=E7jDoHJGaFpKvxbHnT_lyBxUZeMo-GRd5gv9dLw7B9s,289
4
- x_model/models.py,sha256=MxhGgmmiinkQ6LSFOnnwjcIeDsiyQNjHhNagZVap1wM,2701
5
- x_model/types.py,sha256=m7B5XOQvXpOMe8GpO0IizmQLAMd-UzMa9t0hodnfCXw,301
6
- xn_model-1.0.8.dist-info/METADATA,sha256=rIaxH2A7c2gl9hRiBvAosob1xN4Jbf0MqMMOrLJFEZw,961
7
- xn_model-1.0.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
8
- xn_model-1.0.8.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
9
- xn_model-1.0.8.dist-info/RECORD,,