From 08f5471dd9977254ca9e1a461dbab9126e20fa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=96=D1=83=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= <33721692+LeaveMyYard@users.noreply.github.com> Date: Thu, 11 May 2023 17:18:29 +0300 Subject: Minor typing fixes & improvements --- robusta_krr/utils/resource_units.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'robusta_krr/utils') diff --git a/robusta_krr/utils/resource_units.py b/robusta_krr/utils/resource_units.py index cf61df7..5b33601 100644 --- a/robusta_krr/utils/resource_units.py +++ b/robusta_krr/utils/resource_units.py @@ -1,4 +1,4 @@ -from typing import Literal +from typing import Literal, Union UNITS = { "m": 0.001, @@ -17,7 +17,7 @@ UNITS = { } -def parse(x: str, /) -> float | int: +def parse(x: str, /) -> Union[float, int]: """Converts a string to an integer with respect of units.""" for unit, multiplier in UNITS.items(): @@ -37,7 +37,7 @@ def get_base(x: str, /) -> Literal[1024, 1000]: return 1000 if "." in x else 1024 -def format(x: float | int, /, *, base: Literal[1024, 1000] = 1024) -> str: +def format(x: Union[float, int], /, *, base: Literal[1024, 1000] = 1024) -> str: """Converts an integer to a string with respect of units.""" if x < 1: -- cgit v1.2.3