summaryrefslogtreecommitdiff
path: root/robusta_krr/utils
diff options
context:
space:
mode:
authorПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-05-11 17:18:29 +0300
committerПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-05-11 17:18:29 +0300
commit08f5471dd9977254ca9e1a461dbab9126e20fa7e (patch)
tree31919b24ddf97e3d85adf8c84a795c4c5b28ae10 /robusta_krr/utils
parenta5deea864ae9622f20a376a42227aa21978f86af (diff)
Minor typing fixes & improvements
Diffstat (limited to 'robusta_krr/utils')
-rw-r--r--robusta_krr/utils/resource_units.py6
1 files changed, 3 insertions, 3 deletions
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: