xn-model 1.0.9__tar.gz → 1.0.11__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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xn-model
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: Base model for xn-api
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,16 @@
1
+ from typing import ClassVar
2
+ from pydantic import BaseModel
3
+
4
+
5
+ class New(BaseModel):
6
+ _unq: ClassVar[tuple[str]] = ()
7
+
8
+ def df_unq(self) -> dict:
9
+ d = {k: v for k, v in self.model_dump(exclude_none=True).items()}
10
+ return {**{k: d.pop(k, None) for k in set(self._unq)}, "defaults": d}
11
+
12
+
13
+ class Upd(New):
14
+ _unq = ("id",)
15
+
16
+ id: int
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xn-model
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: Base model for xn-api
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -1,15 +0,0 @@
1
- from pydantic import BaseModel
2
-
3
-
4
- class New(BaseModel):
5
- _unq: list[str] = []
6
-
7
- def df_unq(self) -> dict:
8
- d = self.model_dump(exclude_none=True)
9
- return {**{k: d.pop(k) for k in set(self._unq) & d.keys()}, "defaults": d}
10
-
11
-
12
- class Upd(New):
13
- _unq: list[str] = ["id"]
14
-
15
- id: int
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes