From 7404b91258cec4b004f0cc6dfa19079107a9cdd4 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 8 Mar 2024 11:32:20 +0100 Subject: [PATCH] Drop pint type-hinting until it is properly supported https://github.com/hgrecco/pint/issues/1166 Signed-off-by: Cristian Le --- tmt/hardware.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tmt/hardware.py b/tmt/hardware.py index b647a611cb..c0ade7c787 100644 --- a/tmt/hardware.py +++ b/tmt/hardware.py @@ -53,9 +53,6 @@ from tmt.utils import SpecBasedContainer if TYPE_CHECKING: - import importlib.metadata - - from packaging import version from pint import Quantity # Using TypeAlias and typing-extensions under the guard of TYPE_CHECKING, @@ -66,15 +63,10 @@ else: from typing_extensions import TypeAlias + # Note, type-hinting is not properly supported in pint. Change to `Quantity[int]` when + # supported (https://github.com/hgrecco/pint/issues/1166) #: A type of values describing sizes of things like storage or RAM. - if version.parse(importlib.metadata.version("pint")) >= version.parse("0.20"): - # Note, type-hinting is not properly supported in pint - # https://github.com/hgrecco/pint/issues/1166 - Size: TypeAlias = Quantity - else: - # But this one used to work < 0.20 ¯\_(ツ)_/¯ - # https://github.com/hgrecco/pint/pull/1259 - Size: TypeAlias = 'Quantity[int]' + Size: TypeAlias = Quantity #: Unit registry, used and shared by all code. UNITS = pint.UnitRegistry()