apexdevkit 1.14.3__tar.gz → 1.14.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.14.3 → apexdevkit-1.14.4}/PKG-INFO +1 -1
- apexdevkit-1.14.4/apexdevkit/synchronization.py +47 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/pyproject.toml +1 -1
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/LICENSE +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/README.md +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/error.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.14.3 → apexdevkit-1.14.4}/apexdevkit/testing/rest.py +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Generic, Iterable, Iterator, Protocol, TypeVar
|
|
5
|
+
|
|
6
|
+
ItemT = TypeVar("ItemT")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(frozen=True)
|
|
10
|
+
class Sync(Generic[ItemT]):
|
|
11
|
+
source: _Source[ItemT]
|
|
12
|
+
target: _Target[ItemT]
|
|
13
|
+
|
|
14
|
+
def sync(self) -> None:
|
|
15
|
+
items = self.source.value_of(list(self.target))
|
|
16
|
+
self.target.update_many(list(items))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _Source(Protocol[ItemT]):
|
|
20
|
+
def value_of(self, items: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class _Target(Protocol[ItemT]):
|
|
25
|
+
def __iter__(self) -> Iterator[ItemT]:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def update_many(self, items: Iterable[ItemT]) -> None:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
class FullSync(Generic[ItemT]):
|
|
34
|
+
source: Iterable[ItemT]
|
|
35
|
+
target: _FullTarget[ItemT]
|
|
36
|
+
|
|
37
|
+
def sync(self) -> None:
|
|
38
|
+
items = list(self.source)
|
|
39
|
+
self.target.update_many(items)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
ItemR = TypeVar("ItemR", contravariant=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class _FullTarget(Protocol[ItemR]):
|
|
46
|
+
def update_many(self, items: Iterable[ItemR]) -> None:
|
|
47
|
+
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
|