apexdevkit 1.32.2__tar.gz → 1.32.3__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.32.2 → apexdevkit-1.32.3}/PKG-INFO +1 -1
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/sync/sync.py +20 -5
- apexdevkit-1.32.3/apexdevkit/sync/target.py +85 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/pyproject.toml +1 -1
- apexdevkit-1.32.2/apexdevkit/sync/target.py +0 -82
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/LICENSE +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/README.md +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/date.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/error.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/database.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/decorator.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/interface.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/mixin.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/core/multi.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/in_memory/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/in_memory/mixin.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/in_memory/repository.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/in_memory/store.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/sql/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/sql/connector.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/sql/field.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/sql/mssql.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/repository/sql/sqlite.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/security/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/security/core.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/security/hashing.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/server.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/sync/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/sync/observer.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/sync/source.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.32.2 → apexdevkit-1.32.3}/apexdevkit/value.py +0 -0
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from collections.abc import Callable, Collection, Iterable
|
|
4
|
-
from dataclasses import dataclass
|
|
4
|
+
from dataclasses import dataclass, field, replace
|
|
5
5
|
from typing import Any, Generic, Self, TypeVar
|
|
6
6
|
|
|
7
7
|
from .observer import DefaultLog, ObservableSync
|
|
8
|
-
from .source import Source
|
|
9
|
-
from .target import Target
|
|
8
|
+
from .source import EmptySource, Source
|
|
9
|
+
from .target import NoTarget, Target
|
|
10
10
|
|
|
11
11
|
T = TypeVar("T")
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@dataclass(frozen=True, kw_only=True)
|
|
15
15
|
class Sync(ObservableSync, Generic[T]):
|
|
16
|
-
source: Source[T]
|
|
17
|
-
target: Target
|
|
16
|
+
source: Source[T] = field(default_factory=EmptySource)
|
|
17
|
+
target: Target[T] = field(default_factory=NoTarget)
|
|
18
18
|
|
|
19
19
|
dry_run: bool = False
|
|
20
20
|
|
|
21
|
+
def and_target(self, value: Target[T]) -> Sync[T]:
|
|
22
|
+
return self.with_target(value)
|
|
23
|
+
|
|
24
|
+
def with_target(self, value: Target[T]) -> Sync[T]:
|
|
25
|
+
return replace(self, target=value)
|
|
26
|
+
|
|
27
|
+
def and_source(self, value: Source[T]) -> Sync[T]:
|
|
28
|
+
return self.with_source(value)
|
|
29
|
+
|
|
30
|
+
def with_source(self, value: Source[T]) -> Sync[T]:
|
|
31
|
+
return replace(self, source=value)
|
|
32
|
+
|
|
21
33
|
def with_log(self, using: Callable[[str], None]) -> Self:
|
|
22
34
|
return self.attach(DefaultLog(echo=using))
|
|
23
35
|
|
|
36
|
+
def dry(self, *, when: bool = True) -> Sync[T]:
|
|
37
|
+
return replace(self, dry_run=when)
|
|
38
|
+
|
|
24
39
|
def run(self, prune: bool = True, load: bool = True, update: bool = True) -> None:
|
|
25
40
|
if prune:
|
|
26
41
|
self.prune()
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from typing import Any, Generic, Protocol, TypeVar
|
|
6
|
+
|
|
7
|
+
T = TypeVar("T", contravariant=True)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Target(Protocol[T]): # pragma: no cover
|
|
11
|
+
def prune(self, source: Iterable[T]) -> Any:
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def load(self, source: Iterable[T]) -> Any:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def renew(self, source: Iterable[T]) -> Any:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class NoTarget(Generic[T]): # pragma: no cover
|
|
22
|
+
def prune(self, source: Iterable[T]) -> Any:
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
def load(self, source: Iterable[T]) -> Any:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def renew(self, source: Iterable[T]) -> Any:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True, kw_only=True)
|
|
33
|
+
class TargetDecorator(Generic[T]):
|
|
34
|
+
inner: Target[T] = field(default_factory=NoTarget)
|
|
35
|
+
|
|
36
|
+
def prune(self, source: Iterable[T]) -> Any:
|
|
37
|
+
self.inner.prune(source)
|
|
38
|
+
|
|
39
|
+
def load(self, source: Iterable[T]) -> Any:
|
|
40
|
+
self.inner.load(source)
|
|
41
|
+
|
|
42
|
+
def renew(self, source: Iterable[T]) -> Any:
|
|
43
|
+
self.inner.renew(source)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class TargetFailing(Generic[T]):
|
|
47
|
+
@staticmethod
|
|
48
|
+
def on_everything(using: Target[T] | None = None) -> Target[T]:
|
|
49
|
+
return TargetFailing.on_prune(
|
|
50
|
+
using=TargetFailing.on_load(
|
|
51
|
+
using=TargetFailing.on_update(
|
|
52
|
+
using=using or NoTarget(),
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def on_prune(using: Target[T] | None = None) -> Target[T]:
|
|
59
|
+
return _FailOnPrune(inner=using or NoTarget())
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
def on_load(using: Target[T] | None = None) -> Target[T]:
|
|
63
|
+
return _FailOnLoad(inner=using or NoTarget())
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def on_update(using: Target[T] | None = None) -> Target[T]:
|
|
67
|
+
return _FailOnUpdate(inner=using or NoTarget())
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True, kw_only=True)
|
|
71
|
+
class _FailOnPrune(TargetDecorator[T]):
|
|
72
|
+
def prune(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
73
|
+
raise RuntimeError(source)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass(frozen=True, kw_only=True)
|
|
77
|
+
class _FailOnLoad(TargetDecorator[T]):
|
|
78
|
+
def load(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
79
|
+
raise RuntimeError(source)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass(frozen=True, kw_only=True)
|
|
83
|
+
class _FailOnUpdate(TargetDecorator[T]):
|
|
84
|
+
def renew(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
85
|
+
raise RuntimeError(source)
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from collections.abc import Iterable
|
|
4
|
-
from dataclasses import dataclass, field
|
|
5
|
-
from typing import Any, Protocol, TypeVar
|
|
6
|
-
|
|
7
|
-
T = TypeVar("T")
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Target(Protocol): # pragma: no cover
|
|
11
|
-
def prune(self, source: Iterable[T]) -> Any:
|
|
12
|
-
pass
|
|
13
|
-
|
|
14
|
-
def load(self, source: Iterable[T]) -> Any:
|
|
15
|
-
pass
|
|
16
|
-
|
|
17
|
-
def renew(self, source: Iterable[T]) -> Any:
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class NoTarget: # pragma: no cover
|
|
22
|
-
def prune(self, source: Iterable[T]) -> Any:
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
def load(self, source: Iterable[T]) -> Any:
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
def renew(self, source: Iterable[T]) -> Any:
|
|
29
|
-
pass
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@dataclass(frozen=True, kw_only=True)
|
|
33
|
-
class TargetDecorator:
|
|
34
|
-
inner: Target = field(default_factory=NoTarget)
|
|
35
|
-
|
|
36
|
-
def prune(self, source: Iterable[T]) -> Any:
|
|
37
|
-
self.inner.prune(source)
|
|
38
|
-
|
|
39
|
-
def load(self, source: Iterable[T]) -> Any:
|
|
40
|
-
self.inner.load(source)
|
|
41
|
-
|
|
42
|
-
def renew(self, source: Iterable[T]) -> Any:
|
|
43
|
-
self.inner.renew(source)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class TargetFailing:
|
|
47
|
-
@staticmethod
|
|
48
|
-
def on_everything(using: Target | None = None) -> Target:
|
|
49
|
-
return TargetFailing.on_prune(
|
|
50
|
-
using=TargetFailing.on_load(
|
|
51
|
-
using=TargetFailing.on_update(
|
|
52
|
-
using=using or NoTarget(),
|
|
53
|
-
),
|
|
54
|
-
),
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
@staticmethod
|
|
58
|
-
def on_prune(using: Target | None = None) -> Target:
|
|
59
|
-
return TargetFailing.OnPrune(inner=using or NoTarget())
|
|
60
|
-
|
|
61
|
-
@dataclass(frozen=True, kw_only=True)
|
|
62
|
-
class OnPrune(TargetDecorator):
|
|
63
|
-
def prune(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
64
|
-
raise RuntimeError(source)
|
|
65
|
-
|
|
66
|
-
@staticmethod
|
|
67
|
-
def on_load(using: Target | None = None) -> Target:
|
|
68
|
-
return TargetFailing.OnLoad(inner=using or NoTarget())
|
|
69
|
-
|
|
70
|
-
@dataclass(frozen=True, kw_only=True)
|
|
71
|
-
class OnLoad(TargetDecorator):
|
|
72
|
-
def load(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
73
|
-
raise RuntimeError(source)
|
|
74
|
-
|
|
75
|
-
@staticmethod
|
|
76
|
-
def on_update(using: Target | None = None) -> Target:
|
|
77
|
-
return TargetFailing.OnUpdate(inner=using or NoTarget())
|
|
78
|
-
|
|
79
|
-
@dataclass(frozen=True, kw_only=True)
|
|
80
|
-
class OnUpdate(TargetDecorator):
|
|
81
|
-
def renew(self, source: Iterable[T]) -> Any: # pragma: no cover
|
|
82
|
-
raise RuntimeError(source)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|