Skip to content

Commit 661e4a2

Browse files
committed
fix errors
1 parent b8a6d75 commit 661e4a2

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/metrology_apis/__init__.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
__all__ = ["__version__", "Dimension", "Quantity", "Unit"]
1616

1717

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]
2221

2322

2423
@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):
2825
@staticmethod
2926
def asdimension(obj: str | D) -> D: ...
3027

@@ -39,7 +36,7 @@ def asquantity(obj: Q | V, *, unit: U) -> Q: ...
3936
class Dimension(Protocol):
4037
def __metrology_namespace__(
4138
self, /, *, api_version: str | None = None
42-
) -> MetrologyNamespace[_AnyQuantity, _AnyValue, _AnyUnit, Self]:
39+
) -> MetrologyNamespace[QT, VT, UT, Self]:
4340
"""
4441
Return an object that has all the metrology API functions on it.
4542
@@ -76,7 +73,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
7673
class Unit[D: Dimension](Protocol):
7774
def __metrology_namespace__(
7875
self, /, *, api_version: str | None = None
79-
) -> MetrologyNamespace[_AnyQuantity, _AnyValue, Self, D]:
76+
) -> MetrologyNamespace[QT, VT, Self, D]:
8077
"""
8178
Return an object that has all the metrology API functions on it.
8279
@@ -113,7 +110,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
113110

114111

115112
@runtime_checkable
116-
class Quantity[V, U: _AnyUnit, D: Dimension](Protocol):
113+
class Quantity[V, U: UT, D: Dimension](Protocol):
117114
def __metrology_namespace__(
118115
self, /, *, api_version: str | None = None
119116
) -> MetrologyNamespace[Self, V, U, D]:

0 commit comments

Comments
 (0)