summaryrefslogtreecommitdiff
path: root/robusta_krr/formatters
diff options
context:
space:
mode:
authorПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-03-29 18:12:02 +0300
committerПавел Жуков <33721692+LeaveMyYard@users.noreply.github.com>2023-03-29 18:12:02 +0300
commit55a628b3d02ebcb485ff55c29cfd56521546be91 (patch)
tree03e5ef5b139c30dcd0e2a9eadbffe7223937c837 /robusta_krr/formatters
parent1971f310063c5525d856100f818e3252b29bd753 (diff)
Fix case when can not possible to calculate
Diffstat (limited to 'robusta_krr/formatters')
-rw-r--r--robusta_krr/formatters/table.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/robusta_krr/formatters/table.py b/robusta_krr/formatters/table.py
index 327d66a..c23f531 100644
--- a/robusta_krr/formatters/table.py
+++ b/robusta_krr/formatters/table.py
@@ -1,11 +1,11 @@
from __future__ import annotations
import itertools
-from decimal import Decimal
from rich.table import Table
from robusta_krr.core.abstract.formatters import BaseFormatter
+from robusta_krr.core.models.allocations import RecommendationValue
from robusta_krr.core.models.result import ResourceScan, ResourceType, Result
from robusta_krr.utils import resource_units
@@ -20,10 +20,10 @@ class TableFormatter(BaseFormatter):
__display_name__ = "table"
- def _format_united_decimal(self, value: Decimal | None, prescision: int | None = None) -> str:
+ def _format_united_decimal(self, value: RecommendationValue, prescision: int | None = None) -> str:
if value is None:
return NONE_LITERAL
- elif value.is_nan():
+ elif isinstance(value, str):
return NAN_LITERAL
else:
return resource_units.format(value, prescision=prescision)