Skip to content

Commit

Permalink
Minor update to type stubs (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Feb 11, 2025
2 parents af9ba68 + 8852bc4 commit 8d84e26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test_perf/test_value_with_dimension_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_perf_abs(a: ValueWithDimension) -> ValueWithDimension:


@perf_goal(repeats=1500, avg_micros=3.5, args=[a_random_value_with_dimension])
def test_perf_pow(a: ValueWithDimension) -> ValueWithDimension:
def test_perf_pow(a: ValueWithDimension) -> Value:
return abs(a) ** (2 / 3.0)


Expand Down
3 changes: 2 additions & 1 deletion tunits/core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class WithUnit:
def __eq__(self, other: Any) -> bool | NDArray[Any]: ... # type: ignore[override]
def __neq__(self, other: Any) -> bool | NDArray[Any]: ...
def __round__(self) -> int: ...
def __pow__(self: T, other: Any, modulus: Any = None) -> T: ...
def __divmod__(self, other: Any) -> tuple[_NUMERICAL_TYPE_OR_ARRAY, 'WithUnit']: ...
def _value_class(self) -> type['Value']: ...
def _array_class(self) -> type['ValueArray']: ...
Expand Down Expand Up @@ -314,6 +313,7 @@ class Value(Generic[NumericalT], WithUnit, np.generic, SupportsIndex):
def __getitem__(self, key: Any) -> NumericalT: ...
def value_in_base_units(self) -> NumericalT: ...
def __index__(self) -> int: ...
def __pow__(self, other: Any, modulus: Any = None) -> Value: ...

class ValueArray(Generic[ValueType2], WithUnit):
value: NDArray[Any]
Expand Down Expand Up @@ -373,6 +373,7 @@ class ValueArray(Generic[ValueType2], WithUnit):
def __array_ufunc__(
self, ufunc: Callable[..., Any], method: str, *inputs: Any, **kwargs: Any
) -> ValueArray: ...
def __pow__(self, other: Any, modulus: Any = None) -> ValueArray: ...

def init_base_unit_functions(
try_interpret_as_with_unit: Callable[[Any, bool], WithUnit | None],
Expand Down
2 changes: 2 additions & 0 deletions tunits/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@
petawatt = core.Power(core.default_unit_database.known_units['petawatt'])
petaweber = core.MagneticFlux(core.default_unit_database.known_units['petaweber'])
pg = core.Mass(core.default_unit_database.known_units['pg'])
phi0 = core.MagneticFlux(hplanck / (2 * e))
picoampere = core.ElectricCurrent(core.default_unit_database.known_units['picoampere'])
picobecquerel = core.Frequency(core.default_unit_database.known_units['picobecquerel'])
picocandela = core.LuminousIntensity(core.default_unit_database.known_units['picocandela'])
Expand Down Expand Up @@ -2458,4 +2459,5 @@
'zrad',
'zs',
'zsr',
'phi0',
]

0 comments on commit 8d84e26

Please sign in to comment.