From 55a628b3d02ebcb485ff55c29cfd56521546be91 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: Wed, 29 Mar 2023 18:12:02 +0300 Subject: Fix case when can not possible to calculate --- robusta_krr/formatters/table.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'robusta_krr/formatters') 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) -- cgit v1.2.3