apexdevkit 1.29.3__tar.gz → 1.29.4__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.29.3 → apexdevkit-1.29.4}/PKG-INFO +1 -1
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/service.py +4 -6
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/decorator.py +21 -7
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/interface.py +6 -3
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/pyproject.toml +1 -1
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/LICENSE +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/README.md +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/date.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/error.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/id.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/database.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/mixin.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/core/multi.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/in_memory/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/in_memory/mixin.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/in_memory/repository.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/in_memory/store.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/sql/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/sql/connector.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/sql/field.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/sql/mssql.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/repository/sql/sqlite.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/server.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.29.3 → apexdevkit-1.29.4}/apexdevkit/value.py +0 -0
|
@@ -75,7 +75,7 @@ class RestfulRepository(RestfulService, Generic[ItemT]):
|
|
|
75
75
|
def create_many(self, items: RawCollection) -> RawCollection:
|
|
76
76
|
return [
|
|
77
77
|
self.formatter.dump(item)
|
|
78
|
-
for item in self._batch.
|
|
78
|
+
for item in self._batch.load(
|
|
79
79
|
[self.formatter.load(fields) for fields in items]
|
|
80
80
|
)
|
|
81
81
|
]
|
|
@@ -102,9 +102,7 @@ class RestfulRepository(RestfulService, Generic[ItemT]):
|
|
|
102
102
|
|
|
103
103
|
updates.append(self.formatter.load(data))
|
|
104
104
|
|
|
105
|
-
self._batch.
|
|
106
|
-
|
|
107
|
-
return [self.formatter.dump(item) for item in updates]
|
|
105
|
+
return [self.formatter.dump(item) for item in self._batch.renew(updates)]
|
|
108
106
|
|
|
109
107
|
def replace_one(self, item: RawItem) -> RawItem:
|
|
110
108
|
self.repository.update(self.formatter.load(item))
|
|
@@ -112,9 +110,9 @@ class RestfulRepository(RestfulService, Generic[ItemT]):
|
|
|
112
110
|
return item
|
|
113
111
|
|
|
114
112
|
def replace_many(self, items: RawCollection) -> RawCollection:
|
|
115
|
-
self._batch.
|
|
113
|
+
updated = self._batch.renew([self.formatter.load(item) for item in items])
|
|
116
114
|
|
|
117
|
-
return
|
|
115
|
+
return [self.formatter.dump(item) for item in updated]
|
|
118
116
|
|
|
119
117
|
def delete_one(self, item_id: str) -> None:
|
|
120
118
|
self.repository.delete(item_id)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
from collections.abc import Iterable, Iterator
|
|
1
|
+
from collections.abc import Container, Iterable, Iterator
|
|
2
|
+
from contextlib import suppress
|
|
2
3
|
from dataclasses import dataclass, field
|
|
3
4
|
|
|
5
|
+
from apexdevkit.error import DoesNotExistError, ExistsError
|
|
6
|
+
|
|
4
7
|
from .interface import ItemT, Repository
|
|
5
8
|
|
|
6
9
|
|
|
@@ -55,9 +58,20 @@ class RepositoryDecorator(Repository[ItemT]): # pragma: no cover
|
|
|
55
58
|
|
|
56
59
|
@dataclass(frozen=True, kw_only=True)
|
|
57
60
|
class BruteForceBatch(RepositoryDecorator[ItemT]):
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
def load(self, source: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
62
|
+
for item in list(source):
|
|
63
|
+
with suppress(ExistsError):
|
|
64
|
+
yield self.inner.create(item)
|
|
65
|
+
|
|
66
|
+
def prune(self, source: Container[ItemT]) -> Iterable[ItemT]:
|
|
67
|
+
for item in list(self.inner):
|
|
68
|
+
if item not in source:
|
|
69
|
+
with suppress(DoesNotExistError):
|
|
70
|
+
self.inner.delete(item.id)
|
|
71
|
+
yield item
|
|
72
|
+
|
|
73
|
+
def renew(self, source: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
74
|
+
for item in list(source):
|
|
75
|
+
with suppress(DoesNotExistError):
|
|
76
|
+
self.inner.update(item)
|
|
77
|
+
yield item
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from collections.abc import Callable, Collection, Iterable
|
|
3
|
+
from collections.abc import Callable, Collection, Container, Iterable
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from typing import Protocol, TypeVar
|
|
6
6
|
from uuid import uuid4
|
|
@@ -35,8 +35,11 @@ class Repository(Collection[ItemT], Protocol[ItemT]): # pragma: no cover
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class BatchRepository(Repository[ItemT], Protocol[ItemT]): # pragma: no cover
|
|
38
|
-
def
|
|
38
|
+
def load(self, source: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
39
39
|
pass
|
|
40
40
|
|
|
41
|
-
def
|
|
41
|
+
def prune(self, source: Container[ItemT]) -> Iterable[ItemT]:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
def renew(self, source: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
42
45
|
pass
|
|
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
|
|
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
|