From 59d5d749d3d4e00d1d829144ea2fe541be9ec3cf Mon Sep 17 00:00:00 2001 From: Benedikt Burger <67148916+BenediktBurger@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:09:14 +0100 Subject: [PATCH] Make units fit for Python 3.9 --- pyleco_extras/utils/units.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyleco_extras/utils/units.py b/pyleco_extras/utils/units.py index 64fa07a..b1155c6 100644 --- a/pyleco_extras/utils/units.py +++ b/pyleco_extras/utils/units.py @@ -9,12 +9,14 @@ Created on Wed Feb 15 17:51:49 2023 by Benedikt Burger """ +from typing import Union + import pint ureg = pint.UnitRegistry() -def assume_units(value: pint.Quantity | str, units: pint.Unit | str) -> pint.Quantity: +def assume_units(value: Union[pint.Quantity, str], units: Union[pint.Unit, str]) -> pint.Quantity: """Return a unitful quantity, assuming, if necessary the `units`. :param value: A value that may or may not be unitful.