Skip to content

Commit b8a6d75

Browse files
committed
some aliases
1 parent b70a68b commit b8a6d75

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/metrology_apis/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Final,
66
Protocol,
77
Self,
8-
TypeAlias,
98
override,
109
runtime_checkable,
1110
)
@@ -16,13 +15,14 @@
1615
__all__ = ["__version__", "Dimension", "Quantity", "Unit"]
1716

1817

19-
VT: TypeAlias = Any
20-
DT: TypeAlias = Any
21-
UT: TypeAlias = Any
18+
type _AnyValue = Any
19+
type _AnyDimension = Any
20+
type _AnyUnit = Unit[_AnyDimension]
21+
type _AnyQuantity = Quantity[_AnyValue, _AnyUnit, _AnyDimension]
2222

2323

2424
@runtime_checkable
25-
class MetrologyNamespace[Q: Quantity[VT, UT, DT], V: VT, U: Unit[DT], D: Dimension](
25+
class MetrologyNamespace[Q: _AnyQuantity, V: _AnyValue, U: _AnyUnit, D: Dimension](
2626
Protocol
2727
):
2828
@staticmethod
@@ -39,7 +39,7 @@ def asquantity(obj: Q | V, *, unit: U) -> Q: ...
3939
class Dimension(Protocol):
4040
def __metrology_namespace__(
4141
self, /, *, api_version: str | None = None
42-
) -> MetrologyNamespace["Quantity[VT, UT, DT]", VT, "Unit[DT]", Self]:
42+
) -> MetrologyNamespace[_AnyQuantity, _AnyValue, _AnyUnit, Self]:
4343
"""
4444
Return an object that has all the metrology API functions on it.
4545
@@ -76,7 +76,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
7676
class Unit[D: Dimension](Protocol):
7777
def __metrology_namespace__(
7878
self, /, *, api_version: str | None = None
79-
) -> MetrologyNamespace["Quantity[VT, UT, DT]", VT, Self, D]:
79+
) -> MetrologyNamespace[_AnyQuantity, _AnyValue, Self, D]:
8080
"""
8181
Return an object that has all the metrology API functions on it.
8282
@@ -113,7 +113,7 @@ def __rtruediv__(self, other: Self, /) -> Self: ...
113113

114114

115115
@runtime_checkable
116-
class Quantity[V, U: Unit[DT], D: Dimension](Protocol):
116+
class Quantity[V, U: _AnyUnit, D: Dimension](Protocol):
117117
def __metrology_namespace__(
118118
self, /, *, api_version: str | None = None
119119
) -> MetrologyNamespace[Self, V, U, D]:

0 commit comments

Comments
 (0)