tangle-api 0.0.1a3__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.
- tangle_api/__init__.py +0 -0
- tangle_api/generated/__init__.py +1 -0
- tangle_api/generated/models.py +294 -0
- tangle_api/generated/operations.py +394 -0
- tangle_api/generated/runtime.py +43 -0
- tangle_api/py.typed +0 -0
- tangle_api/schema/__init__.py +0 -0
- tangle_api/schema/openapi.json +3881 -0
- tangle_api-0.0.1a3.dist-info/METADATA +15 -0
- tangle_api-0.0.1a3.dist-info/RECORD +11 -0
- tangle_api-0.0.1a3.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Runtime helpers for generated Tangle API model packages."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from pydantic import ConfigDict
|
|
11
|
+
except ImportError: # pragma: no cover - pydantic v1 fallback
|
|
12
|
+
ConfigDict = None # type: ignore[assignment]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TangleGeneratedModel(BaseModel):
|
|
16
|
+
"""Base for generated response models with dict-like conveniences."""
|
|
17
|
+
|
|
18
|
+
if ConfigDict is not None:
|
|
19
|
+
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
|
20
|
+
else: # pragma: no cover - pydantic v1 fallback
|
|
21
|
+
class Config:
|
|
22
|
+
extra = "allow"
|
|
23
|
+
allow_population_by_field_name = True
|
|
24
|
+
|
|
25
|
+
def get(self, key: str, default: Any = None) -> Any:
|
|
26
|
+
return self.to_dict().get(key, default)
|
|
27
|
+
|
|
28
|
+
def __getitem__(self, key: str) -> Any:
|
|
29
|
+
return self.to_dict()[key]
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
if hasattr(self, "model_dump"):
|
|
33
|
+
return self.model_dump(by_alias=True)
|
|
34
|
+
return self.dict(by_alias=True)
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_dict(cls, data: dict[str, Any]) -> Any:
|
|
38
|
+
if hasattr(cls, "model_validate"):
|
|
39
|
+
return cls.model_validate(data)
|
|
40
|
+
return cls.parse_obj(data)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = ["TangleGeneratedModel"]
|
tangle_api/py.typed
ADDED
|
File without changes
|
|
File without changes
|