qnty 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
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.
- qnty/__init__.py +3 -0
- qnty/dimension.py +5 -4
- qnty/equation.py +216 -0
- qnty/expression.py +480 -0
- qnty/unit.py +8 -8
- qnty/units.py +2 -3
- qnty/variable.py +68 -29
- qnty/variables.py +217 -19
- {qnty-0.0.1.dist-info → qnty-0.0.2.dist-info}/METADATA +109 -22
- qnty-0.0.2.dist-info/RECORD +11 -0
- qnty/setters.py +0 -89
- qnty-0.0.1.dist-info/RECORD +0 -10
- {qnty-0.0.1.dist-info → qnty-0.0.2.dist-info}/WHEEL +0 -0
qnty/setters.py
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Specialized Setters
|
3
|
-
===================
|
4
|
-
|
5
|
-
Dimension-specific setters with fluent API and compile-time type safety.
|
6
|
-
"""
|
7
|
-
|
8
|
-
from typing import TYPE_CHECKING
|
9
|
-
from .variable import FastQuantity
|
10
|
-
from .units import LengthUnits, PressureUnits
|
11
|
-
from .unit import UnitConstant
|
12
|
-
|
13
|
-
if TYPE_CHECKING:
|
14
|
-
from .variables import Length, Pressure
|
15
|
-
from .variable import TypeSafeVariable
|
16
|
-
|
17
|
-
|
18
|
-
class TypeSafeSetter:
|
19
|
-
"""Type-safe setter that only accepts compatible units."""
|
20
|
-
|
21
|
-
def __init__(self, variable: 'TypeSafeVariable', value: float):
|
22
|
-
self.variable = variable
|
23
|
-
self.value = value
|
24
|
-
|
25
|
-
def with_unit(self, unit: UnitConstant) -> 'TypeSafeVariable':
|
26
|
-
"""Set with type-safe unit constant."""
|
27
|
-
if not self.variable.expected_dimension.is_compatible(unit.dimension):
|
28
|
-
raise TypeError(f"Unit {unit.name} incompatible with expected dimension")
|
29
|
-
|
30
|
-
self.variable.quantity = FastQuantity(self.value, unit)
|
31
|
-
return self.variable
|
32
|
-
|
33
|
-
|
34
|
-
class LengthSetter:
|
35
|
-
"""Length-specific setter with only length units."""
|
36
|
-
|
37
|
-
def __init__(self, variable: 'Length', value: float):
|
38
|
-
self.variable = variable
|
39
|
-
self.value = value
|
40
|
-
|
41
|
-
# Only length units available - compile-time safe!
|
42
|
-
@property
|
43
|
-
def meters(self) -> 'Length':
|
44
|
-
self.variable.quantity = FastQuantity(self.value, LengthUnits.meter)
|
45
|
-
return self.variable
|
46
|
-
|
47
|
-
@property
|
48
|
-
def millimeters(self) -> 'Length':
|
49
|
-
self.variable.quantity = FastQuantity(self.value, LengthUnits.millimeter)
|
50
|
-
return self.variable
|
51
|
-
|
52
|
-
@property
|
53
|
-
def inches(self) -> 'Length':
|
54
|
-
self.variable.quantity = FastQuantity(self.value, LengthUnits.inch)
|
55
|
-
return self.variable
|
56
|
-
|
57
|
-
@property
|
58
|
-
def feet(self) -> 'Length':
|
59
|
-
self.variable.quantity = FastQuantity(self.value, LengthUnits.foot)
|
60
|
-
return self.variable
|
61
|
-
|
62
|
-
|
63
|
-
class PressureSetter:
|
64
|
-
"""Pressure-specific setter with only pressure units."""
|
65
|
-
|
66
|
-
def __init__(self, variable: 'Pressure', value: float):
|
67
|
-
self.variable = variable
|
68
|
-
self.value = value
|
69
|
-
|
70
|
-
# Only pressure units available - compile-time safe!
|
71
|
-
@property
|
72
|
-
def psi(self) -> 'Pressure':
|
73
|
-
self.variable.quantity = FastQuantity(self.value, PressureUnits.psi)
|
74
|
-
return self.variable
|
75
|
-
|
76
|
-
@property
|
77
|
-
def kPa(self) -> 'Pressure':
|
78
|
-
self.variable.quantity = FastQuantity(self.value, PressureUnits.kilopascal)
|
79
|
-
return self.variable
|
80
|
-
|
81
|
-
@property
|
82
|
-
def MPa(self) -> 'Pressure':
|
83
|
-
self.variable.quantity = FastQuantity(self.value, PressureUnits.megapascal)
|
84
|
-
return self.variable
|
85
|
-
|
86
|
-
@property
|
87
|
-
def bar(self) -> 'Pressure':
|
88
|
-
self.variable.quantity = FastQuantity(self.value, PressureUnits.bar)
|
89
|
-
return self.variable
|
qnty-0.0.1.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
qnty/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
qnty/dimension.py,sha256=6EBpexKOWNCjMnd-VPH8bbjEdbZwkpvRRxexBAI-aqQ,2782
|
3
|
-
qnty/setters.py,sha256=4rNLJQ0U7gAhXgaOWzGKes9iX8PnQeKI_RBmvgY4DHo,2793
|
4
|
-
qnty/unit.py,sha256=VhWw8Z3PKBI8jXhhiYmuzp5PF6wYQeZvh8GiV29kumw,4230
|
5
|
-
qnty/units.py,sha256=_iueuOZv-0mYMBfnswxmJ1okg1mRLz2M4UW2CN28x2w,1369
|
6
|
-
qnty/variable.py,sha256=cH0UawJ-mxFgdY7i3UVsdQ5P64EAnioYyhHppGxCJT8,8613
|
7
|
-
qnty/variables.py,sha256=yfeEewKHOgm-DRKPf7SEH5ZT5xW6SQcSzFz9NxcWy74,771
|
8
|
-
qnty-0.0.1.dist-info/METADATA,sha256=0q4UsvsoMxwAtg7RutwZXRAEhBmsAEBUsTfX8imaXKY,9432
|
9
|
-
qnty-0.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
10
|
-
qnty-0.0.1.dist-info/RECORD,,
|
File without changes
|