apexdevkit 1.19.3__tar.gz → 1.20.1__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.1}/PKG-INFO +1 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/value.py +13 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/pyproject.toml +1 -1
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/LICENSE +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/README.md +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/error.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/id.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/server.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.19.3 → apexdevkit-1.20.1}/apexdevkit/testing/rest.py +0 -0
|
@@ -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
|
|
File without changes
|