diff options
| author | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-05-11 16:30:42 +0300 |
|---|---|---|
| committer | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-05-11 16:30:42 +0300 |
| commit | 717baa6b12e09b5103c05737c11b2f56dcf651ba (patch) | |
| tree | 0f53cb9f52ecc2d04c2bd8eaa44572767631a8ad /robusta_krr/formatters | |
| parent | 774731c008a3f648185270b0aa42ca13ac3ad1bf (diff) | |
Replace decimals on numpy arrays, keep timestapms
Diffstat (limited to 'robusta_krr/formatters')
| -rw-r--r-- | robusta_krr/formatters/table.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/robusta_krr/formatters/table.py b/robusta_krr/formatters/table.py index 043e383..8a93f04 100644 --- a/robusta_krr/formatters/table.py +++ b/robusta_krr/formatters/table.py @@ -12,7 +12,6 @@ from robusta_krr.utils import resource_units NONE_LITERAL = "none" NAN_LITERAL = "?" -PRESCISION = 4 ALLOWED_DIFFERENCE = 0.05 @@ -21,13 +20,13 @@ class TableFormatter(BaseFormatter): __display_name__ = "table" - def _format_united_decimal(self, value: RecommendationValue, prescision: Optional[int] = None) -> str: + def _format(self, value: RecommendationValue) -> str: if value is None: return NONE_LITERAL elif isinstance(value, str): return NAN_LITERAL else: - return resource_units.format(value, prescision=prescision) + return resource_units.format(value) def _format_request_str(self, item: ResourceScan, resource: ResourceType, selector: str) -> str: allocated = getattr(item.object.allocations, selector)[resource] @@ -36,9 +35,9 @@ class TableFormatter(BaseFormatter): return ( f"[{severity.color}]" - + self._format_united_decimal(allocated) + + self._format(allocated) + " -> " - + self._format_united_decimal(recommended.value, prescision=PRESCISION) + + self._format(recommended.value) + f"[/{severity.color}]" ) |
