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
@@ -56,10 +47,10 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
56
47
57
48
58
49
@runtime_checkable
59
- class Unit (Protocol ):
60
- def __metrology_namespace__ (
50
+ class Unit [ D : Dimension ] (Protocol ):
51
+ def __metrology_namespace__ [ Q : Quantity ] (
61
52
self , / , * , api_version : str | None = None
62
- ) -> MetrologyNamespace :
53
+ ) -> MetrologyNamespace [ Q , Self , D ] :
63
54
"""
64
55
Returns an object that has all the metrology API functions on it.
65
56
Parameters
@@ -73,7 +64,7 @@ def __metrology_namespace__(
73
64
"""
74
65
75
66
@property
76
- def dimension (self ) -> Dimension : ...
67
+ def dimension (self ) -> D : ...
77
68
78
69
def __mul__ (self , other : Self , / ) -> Self : ...
79
70
def __truediv__ (self , other : Self , / ) -> Self : ...
@@ -85,10 +76,10 @@ def __rpow__(self, other: int | float, /) -> Self: ...
85
76
86
77
87
78
@runtime_checkable
88
- class Quantity [V , U : Unit ](Protocol ):
79
+ class Quantity [V , U : Unit [ D ], D : Dimension ](Protocol ):
89
80
def __metrology_namespace__ (
90
81
self , / , * , api_version : str | None = None
91
- ) -> MetrologyNamespace :
82
+ ) -> MetrologyNamespace [ Self , U , D ] :
92
83
"""
93
84
Returns an object that has all the metrology API functions on it.
94
85
Parameters
0 commit comments