apexdevkit 1.3.7__tar.gz → 1.3.8__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.
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/PKG-INFO +1 -1
- {apexdevkit-1.3.7/apexdevkit → apexdevkit-1.3.8/apexdevkit/testing}/fake.py +25 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/pyproject.toml +1 -1
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/LICENSE +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/README.md +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/error.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.3.7 → apexdevkit-1.3.8}/apexdevkit/testing/rest.py +0 -0
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
+
from functools import cached_property
|
|
3
|
+
from typing import Any, Generic, Type, TypeVar
|
|
2
4
|
|
|
3
5
|
from faker import Faker
|
|
4
6
|
|
|
7
|
+
from apexdevkit.http import JsonDict
|
|
8
|
+
|
|
9
|
+
ItemT = TypeVar("ItemT")
|
|
10
|
+
|
|
5
11
|
|
|
6
12
|
@dataclass
|
|
7
13
|
class Fake:
|
|
@@ -24,3 +30,22 @@ class Fake:
|
|
|
24
30
|
|
|
25
31
|
def hour(self) -> int:
|
|
26
32
|
return int(self.faker.random_int(min=0, max=23))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class FakeGeneric(Generic[ItemT]):
|
|
37
|
+
item_type: Type[ItemT] = field()
|
|
38
|
+
fake: Fake = field(default_factory=Fake)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def _raw(self) -> dict[str, Any]:
|
|
42
|
+
return {}
|
|
43
|
+
|
|
44
|
+
def unknown_id(self) -> str:
|
|
45
|
+
return self.fake.text(length=32)
|
|
46
|
+
|
|
47
|
+
def json(self) -> JsonDict:
|
|
48
|
+
return JsonDict(self._raw)
|
|
49
|
+
|
|
50
|
+
def entity(self, **fields: Any) -> ItemT:
|
|
51
|
+
return self.item_type(**self.json().merge(JsonDict(fields)))
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|