9
9
10
10
11
11
@runtime_checkable
12
- class MetrologyNamespace [Q : Quantity , U : Unit , D : Dimension ](Protocol ):
12
+ class MetrologyNamespace [Q : Quantity [ V , U , D ], V , U : Unit [ D ] , D : Dimension ](Protocol ):
13
13
14
14
@staticmethod
15
15
def asdimension (obj : str | D ) -> D : ...
16
16
17
17
@staticmethod
18
- def asunit (obj ) -> U [ D ] : ...
18
+ def asunit (obj : str | U ) -> U : ...
19
19
20
20
@staticmethod
21
- def asquantity (obj : V , unit : obj ) -> Q [V , U [D ]]: ...
22
-
23
- @property
24
- def Dimension (self ) -> D : ...
25
-
26
- @property
27
- def Unit (self ) -> U : ...
28
-
29
- @property
30
- def Quantity (self ) -> Q : ...
21
+ def asquantity (obj : Q | V , * , unit : U ) -> Q : ...
31
22
32
23
33
24
@runtime_checkable
34
25
class Dimension (Protocol ):
35
- def __metrology_namespace__ (
26
+ def __metrology_namespace__ [ Q : Quantity , U : Unit ] (
36
27
self , / , * , api_version : str | None = None
37
- ) -> MetrologyNamespace :
28
+ ) -> MetrologyNamespace [ Q , U , Self ] :
38
29
"""
39
30
Returns an object that has all the metrology API functions on it.
40
31
Parameters
@@ -59,10 +50,10 @@ def __ne__(self, other: Self, /) -> bool: ...
59
50
60
51
61
52
@runtime_checkable
62
- class Unit (Protocol ):
63
- def __metrology_namespace__ (
53
+ class Unit [ D : Dimension ] (Protocol ):
54
+ def __metrology_namespace__ [ Q : Quantity ] (
64
55
self , / , * , api_version : str | None = None
65
- ) -> MetrologyNamespace :
56
+ ) -> MetrologyNamespace [ Q , Self , D ] :
66
57
"""
67
58
Returns an object that has all the metrology API functions on it.
68
59
Parameters
@@ -76,7 +67,7 @@ def __metrology_namespace__(
76
67
"""
77
68
78
69
@property
79
- def dimension (self ) -> Dimension : ...
70
+ def dimension (self ) -> D : ...
80
71
81
72
def __mul__ (self , other : Self , / ) -> Self : ...
82
73
def __truediv__ (self , other : Self , / ) -> Self : ...
@@ -88,10 +79,10 @@ def __rpow__(self, other: int | float, /) -> Self: ...
88
79
89
80
90
81
@runtime_checkable
91
- class Quantity [V , U : Unit ](Protocol ):
82
+ class Quantity [V , U : Unit [ D ], D : Dimension ](Protocol ):
92
83
def __metrology_namespace__ (
93
84
self , / , * , api_version : str | None = None
94
- ) -> MetrologyNamespace :
85
+ ) -> MetrologyNamespace [ Self , U , D ] :
95
86
"""
96
87
Returns an object that has all the metrology API functions on it.
97
88
Parameters
0 commit comments