15
15
__all__ = ["__version__" , "Dimension" , "Quantity" , "Unit" ]
16
16
17
17
18
- type _AnyValue = Any
19
- type _AnyDimension = Any
20
- type _AnyUnit = Unit [_AnyDimension ]
21
- type _AnyQuantity = Quantity [_AnyValue , _AnyUnit , _AnyDimension ]
18
+ type VT = Any
19
+ type UT = Unit [Any ]
20
+ type QT = Quantity [Any , Any , Any ]
22
21
23
22
24
23
@runtime_checkable
25
- class MetrologyNamespace [Q : _AnyQuantity , V : _AnyValue , U : _AnyUnit , D : Dimension ](
26
- Protocol
27
- ):
24
+ class MetrologyNamespace [Q : QT , V : VT , U : UT , D : Dimension ](Protocol ):
28
25
@staticmethod
29
26
def asdimension (obj : str | D ) -> D : ...
30
27
@@ -39,7 +36,7 @@ def asquantity(obj: Q | V, *, unit: U) -> Q: ...
39
36
class Dimension (Protocol ):
40
37
def __metrology_namespace__ (
41
38
self , / , * , api_version : str | None = None
42
- ) -> MetrologyNamespace [_AnyQuantity , _AnyValue , _AnyUnit , Self ]:
39
+ ) -> MetrologyNamespace [QT , VT , UT , Self ]:
43
40
"""
44
41
Return an object that has all the metrology API functions on it.
45
42
@@ -76,7 +73,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
76
73
class Unit [D : Dimension ](Protocol ):
77
74
def __metrology_namespace__ (
78
75
self , / , * , api_version : str | None = None
79
- ) -> MetrologyNamespace [_AnyQuantity , _AnyValue , Self , D ]:
76
+ ) -> MetrologyNamespace [QT , VT , Self , D ]:
80
77
"""
81
78
Return an object that has all the metrology API functions on it.
82
79
@@ -113,7 +110,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
113
110
114
111
115
112
@runtime_checkable
116
- class Quantity [V , U : _AnyUnit , D : Dimension ](Protocol ):
113
+ class Quantity [V , U : UT , D : Dimension ](Protocol ):
117
114
def __metrology_namespace__ (
118
115
self , / , * , api_version : str | None = None
119
116
) -> MetrologyNamespace [Self , V , U , D ]:
0 commit comments