apexdevkit 1.29.4__tar.gz → 1.30.2__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.4 → apexdevkit-1.30.2}/PKG-INFO +1 -1
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/pyproject.toml +2 -2
- apexdevkit-1.29.4/apexdevkit/id.py +0 -54
- apexdevkit-1.29.4/apexdevkit/synchronization.py +0 -48
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/LICENSE +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/README.md +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/date.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/error.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/database.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/decorator.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/interface.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/mixin.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/core/multi.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/in_memory/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/in_memory/mixin.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/in_memory/repository.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/in_memory/store.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/sql/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/sql/connector.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/sql/field.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/sql/mssql.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/repository/sql/sqlite.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/server.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.29.4 → apexdevkit-1.30.2}/apexdevkit/value.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "apexdevkit"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.30.2"
|
|
4
4
|
description = "Apex Development Tools for python."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -30,7 +30,7 @@ faker = "*"
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
[tool.poetry.group.lint.dependencies]
|
|
33
|
-
apexcodexpy = "0.
|
|
33
|
+
apexcodexpy = "0.4.1"
|
|
34
34
|
|
|
35
35
|
[tool.mypy]
|
|
36
36
|
ignore_missing_imports = true
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from threading import Lock
|
|
3
|
-
from time import time
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ApexID:
|
|
7
|
-
last_timestamp: int = -1
|
|
8
|
-
sequence: int = 0
|
|
9
|
-
lock: Lock = Lock()
|
|
10
|
-
|
|
11
|
-
_metadata_bitmask: int = 0x0FFF
|
|
12
|
-
_sequence_bitmask: int = 0x03FF
|
|
13
|
-
_timestamp_bitmask: int = 0x03FFFFFFFFFF
|
|
14
|
-
|
|
15
|
-
@classmethod
|
|
16
|
-
def id(cls) -> int:
|
|
17
|
-
"""
|
|
18
|
-
Generates a unique identifier with the following structure
|
|
19
|
-
from most significant to least significant:
|
|
20
|
-
1 bit reserved
|
|
21
|
-
41 bits for unix timestamp (millisecond precision)
|
|
22
|
-
12 bits for metadata
|
|
23
|
-
10 bits for sequence
|
|
24
|
-
"""
|
|
25
|
-
with cls.lock:
|
|
26
|
-
current_timestamp = cls._get_timestamp()
|
|
27
|
-
if cls.last_timestamp == current_timestamp:
|
|
28
|
-
cls.sequence += 1
|
|
29
|
-
else:
|
|
30
|
-
cls.sequence = 0
|
|
31
|
-
|
|
32
|
-
if cls.sequence > cls._sequence_bitmask:
|
|
33
|
-
raise DuplicateIDError("Duplicate ID Generated")
|
|
34
|
-
|
|
35
|
-
cls.last_timestamp = current_timestamp
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
(0 << 63)
|
|
39
|
-
| ((cls.last_timestamp & cls._timestamp_bitmask) << 22)
|
|
40
|
-
| ((cls._metadata() & cls._metadata_bitmask) << 10)
|
|
41
|
-
| (cls.sequence & cls._sequence_bitmask)
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
@classmethod
|
|
45
|
-
def _get_timestamp(cls) -> int:
|
|
46
|
-
return int(time() * 1000)
|
|
47
|
-
|
|
48
|
-
@classmethod
|
|
49
|
-
def _metadata(cls) -> int:
|
|
50
|
-
return int(os.getenv("APEX_ID_METADATA", "0"))
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class DuplicateIDError(Exception):
|
|
54
|
-
pass
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from collections.abc import Iterable, Iterator
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from typing import Generic, Protocol, TypeVar
|
|
6
|
-
|
|
7
|
-
ItemT = TypeVar("ItemT")
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@dataclass(frozen=True)
|
|
11
|
-
class Sync(Generic[ItemT]):
|
|
12
|
-
source: _Source[ItemT]
|
|
13
|
-
target: _Target[ItemT]
|
|
14
|
-
|
|
15
|
-
def sync(self) -> None:
|
|
16
|
-
items = self.source.value_of(list(self.target))
|
|
17
|
-
self.target.update_many(list(items))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class _Source(Protocol[ItemT]):
|
|
21
|
-
def value_of(self, items: Iterable[ItemT]) -> Iterable[ItemT]:
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class _Target(Protocol[ItemT]):
|
|
26
|
-
def __iter__(self) -> Iterator[ItemT]:
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
def update_many(self, items: Iterable[ItemT]) -> None:
|
|
30
|
-
pass
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@dataclass(frozen=True)
|
|
34
|
-
class FullSync(Generic[ItemT]):
|
|
35
|
-
source: Iterable[ItemT]
|
|
36
|
-
target: _FullTarget[ItemT]
|
|
37
|
-
|
|
38
|
-
def sync(self) -> None:
|
|
39
|
-
items = list(self.source)
|
|
40
|
-
self.target.update_many(items)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ItemR = TypeVar("ItemR", contravariant=True)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class _FullTarget(Protocol[ItemR]):
|
|
47
|
-
def update_many(self, items: Iterable[ItemR]) -> None:
|
|
48
|
-
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
|
|
File without changes
|