apexdevkit 1.19.3__tar.gz → 1.20.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.19.3 → apexdevkit-1.20.2}/PKG-INFO +1 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/dependable.py +25 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/value.py +13 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/pyproject.toml +1 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/LICENSE +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/README.md +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/error.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/id.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/server.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.2}/apexdevkit/testing/rest.py +0 -0
|
@@ -4,6 +4,7 @@ from typing import Annotated, Any, Callable, Protocol
|
|
|
4
4
|
from fastapi import Depends, Path
|
|
5
5
|
from fastapi.requests import Request
|
|
6
6
|
|
|
7
|
+
from apexdevkit.annotation import deprecated
|
|
7
8
|
from apexdevkit.error import ApiError, DoesNotExistError
|
|
8
9
|
from apexdevkit.fastapi import RestfulServiceBuilder
|
|
9
10
|
from apexdevkit.fastapi.name import RestfulName
|
|
@@ -82,10 +83,34 @@ class InfraDependency:
|
|
|
82
83
|
return Annotated[RestfulServiceBuilder, Depends(_)]
|
|
83
84
|
|
|
84
85
|
|
|
86
|
+
_BuilderCallable = Callable[..., RestfulServiceBuilder]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass(frozen=True)
|
|
90
|
+
class BuilderCallableDependency:
|
|
91
|
+
create_builder: _BuilderCallable
|
|
92
|
+
|
|
93
|
+
def as_dependable(self) -> type[RestfulServiceBuilder]:
|
|
94
|
+
def _() -> RestfulServiceBuilder:
|
|
95
|
+
return self.create_builder()
|
|
96
|
+
|
|
97
|
+
return Annotated[RestfulServiceBuilder, Depends(_)]
|
|
98
|
+
|
|
99
|
+
|
|
85
100
|
@dataclass(frozen=True)
|
|
86
101
|
class DependableBuilder:
|
|
87
102
|
dependency: _Dependency | None = None
|
|
88
103
|
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_callable(cls, value: _BuilderCallable) -> "DependableBuilder":
|
|
106
|
+
return DependableBuilder(BuilderCallableDependency(value))
|
|
107
|
+
|
|
108
|
+
@deprecated(
|
|
109
|
+
"""
|
|
110
|
+
DependableBuilder().from_infra() is deprecated,
|
|
111
|
+
use DependencyBuilder.from_callable() instead
|
|
112
|
+
"""
|
|
113
|
+
)
|
|
89
114
|
def from_infra(self, value: RestfulServiceBuilder) -> "DependableBuilder":
|
|
90
115
|
return DependableBuilder(InfraDependency(value))
|
|
91
116
|
|
|
@@ -10,6 +10,8 @@ class Value:
|
|
|
10
10
|
value: int = 0
|
|
11
11
|
exponent: int = 1
|
|
12
12
|
|
|
13
|
+
unit: str = "unknown"
|
|
14
|
+
|
|
13
15
|
def as_decimal(self) -> Decimal:
|
|
14
16
|
return Decimal(self.value) / Decimal(self.exponent)
|
|
15
17
|
|
|
@@ -18,35 +20,45 @@ class Value:
|
|
|
18
20
|
integer_part, _, fractional_part = decimal_str.partition(".")
|
|
19
21
|
value = int(integer_part + fractional_part)
|
|
20
22
|
exponent = 10 ** len(fractional_part)
|
|
23
|
+
|
|
21
24
|
return cls(value, exponent)
|
|
22
25
|
|
|
23
26
|
def add(self, other: Value) -> Value:
|
|
24
27
|
exponent = self.exponent * other.exponent
|
|
25
28
|
value = self.value * other.exponent + self.exponent * other.value
|
|
26
29
|
gcd = int(math.gcd(exponent, value))
|
|
30
|
+
|
|
27
31
|
return Value(int(value / gcd), int(exponent / gcd))
|
|
28
32
|
|
|
29
33
|
def subtract(self, other: Value) -> Value:
|
|
30
34
|
exponent = self.exponent * other.exponent
|
|
31
35
|
value = self.value * other.exponent - self.exponent * other.value
|
|
32
36
|
gcd = int(math.gcd(exponent, value))
|
|
37
|
+
|
|
33
38
|
return Value(int(value / gcd), int(exponent / gcd))
|
|
34
39
|
|
|
35
40
|
def multiply(self, other: Value) -> Value:
|
|
36
41
|
exponent = self.exponent * other.exponent
|
|
37
42
|
value = self.value * other.value
|
|
38
43
|
gcd = int(math.gcd(exponent, value))
|
|
44
|
+
|
|
39
45
|
return Value(int(value / gcd), int(exponent / gcd))
|
|
40
46
|
|
|
41
47
|
def divide(self, other: Value) -> Value:
|
|
42
48
|
exponent = self.exponent * other.value
|
|
43
49
|
value = self.value * other.exponent
|
|
44
50
|
gcd = int(math.gcd(exponent, value))
|
|
51
|
+
|
|
45
52
|
return Value(int(value / gcd), int(exponent / gcd))
|
|
46
53
|
|
|
47
54
|
def __eq__(self, other: object) -> bool:
|
|
48
55
|
if isinstance(other, Value):
|
|
49
56
|
return self.as_decimal() == other.as_decimal()
|
|
50
|
-
|
|
57
|
+
|
|
58
|
+
if isinstance(other, Decimal):
|
|
51
59
|
return self.as_decimal() == other
|
|
60
|
+
|
|
52
61
|
return False
|
|
62
|
+
|
|
63
|
+
def __float__(self) -> float:
|
|
64
|
+
return float(self.as_decimal())
|
|
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
|