apexdevkit 1.8.8__tar.gz → 1.8.10__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.8.8 → apexdevkit-1.8.10}/PKG-INFO +1 -1
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/formatter.py +22 -3
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/testing/fake.py +20 -2
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/pyproject.toml +1 -1
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/LICENSE +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/README.md +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/error.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.8.8 → apexdevkit-1.8.10}/apexdevkit/testing/rest.py +0 -0
|
@@ -13,15 +13,34 @@ class Formatter(Protocol[ItemT]): # pragma: no cover
|
|
|
13
13
|
pass
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
@dataclass
|
|
17
|
+
class ListFormatter(Generic[ItemT]):
|
|
18
|
+
inner: Formatter[ItemT]
|
|
19
|
+
|
|
20
|
+
def load(self, raw: list[dict[str, Any]]) -> list[ItemT]:
|
|
21
|
+
result = []
|
|
22
|
+
for item in raw:
|
|
23
|
+
result.append(self.inner.load(item))
|
|
24
|
+
return result
|
|
25
|
+
|
|
26
|
+
def dump(self, items: list[ItemT]) -> list[dict[str, Any]]:
|
|
27
|
+
result: list[dict[str, Any]] = []
|
|
28
|
+
for item in items:
|
|
29
|
+
result.append(self.inner.dump(item))
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
|
|
16
33
|
@dataclass
|
|
17
34
|
class DataclassFormatter(Generic[ItemT]):
|
|
18
35
|
resource: type[ItemT]
|
|
19
|
-
sub_formatters: dict[str, Formatter[Any]] = field(
|
|
36
|
+
sub_formatters: dict[str, Formatter[Any] | ListFormatter[Any]] = field(
|
|
37
|
+
default_factory=dict
|
|
38
|
+
)
|
|
20
39
|
|
|
21
|
-
def and_nested(self, **formatters: Formatter[Any]) -> Self:
|
|
40
|
+
def and_nested(self, **formatters: Formatter[Any] | ListFormatter[Any]) -> Self:
|
|
22
41
|
return self.with_nested(**formatters)
|
|
23
42
|
|
|
24
|
-
def with_nested(self, **formatters: Formatter[Any]) -> Self:
|
|
43
|
+
def with_nested(self, **formatters: Formatter[Any] | ListFormatter[Any]) -> Self:
|
|
25
44
|
self.sub_formatters.update(formatters)
|
|
26
45
|
|
|
27
46
|
return self
|
|
@@ -19,8 +19,8 @@ class Fake:
|
|
|
19
19
|
def text(self, *, length: int) -> str:
|
|
20
20
|
return "".join(self.faker.random_letters(length=length))
|
|
21
21
|
|
|
22
|
-
def number(self) -> int:
|
|
23
|
-
return int(self.faker.random.randint(0,
|
|
22
|
+
def number(self, top: int = 100000) -> int:
|
|
23
|
+
return int(self.faker.random.randint(0, top))
|
|
24
24
|
|
|
25
25
|
def timestamp(self) -> int:
|
|
26
26
|
return int(self.faker.unix_time())
|
|
@@ -31,6 +31,24 @@ class Fake:
|
|
|
31
31
|
def hour(self) -> int:
|
|
32
32
|
return int(self.faker.random_int(min=0, max=23))
|
|
33
33
|
|
|
34
|
+
def first_name(self) -> str:
|
|
35
|
+
return str(self.faker.first_name())
|
|
36
|
+
|
|
37
|
+
def last_name(self) -> str:
|
|
38
|
+
return str(self.faker.last_name())
|
|
39
|
+
|
|
40
|
+
def sentence(self, *, words: int) -> str:
|
|
41
|
+
return str(self.faker.sentence(nb_words=words))
|
|
42
|
+
|
|
43
|
+
def country(self) -> str:
|
|
44
|
+
return str(self.faker.country())
|
|
45
|
+
|
|
46
|
+
def address(self) -> str:
|
|
47
|
+
return str(self.faker.address())
|
|
48
|
+
|
|
49
|
+
def bool(self) -> bool:
|
|
50
|
+
return bool(self.faker.boolean())
|
|
51
|
+
|
|
34
52
|
|
|
35
53
|
@dataclass
|
|
36
54
|
class FakeResource(Generic[ItemT]):
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|