From 5cc0e40f9804c7d9a97aa151d86e631ce5106194 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 12 Jan 2026 23:47:21 +0800 Subject: [PATCH] chore(pre-commit): update pre-commit hooks --- .pre-commit-config.yaml | 4 ++-- nvitop/tui/screens/main/panels/device.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9158a1..fc24404 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: args: [--ignore-case] files: ^docs/source/spelling_wordlist\.txt$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.9 + rev: v0.14.11 hooks: - id: ruff-check args: [--fix, --exit-non-zero-on-fix] @@ -41,7 +41,7 @@ repos: - id: codespell additional_dependencies: [".[toml]"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.0 + rev: v1.19.1 hooks: - id: mypy exclude: | diff --git a/nvitop/tui/screens/main/panels/device.py b/nvitop/tui/screens/main/panels/device.py index 73d7c34..447a01a 100644 --- a/nvitop/tui/screens/main/panels/device.py +++ b/nvitop/tui/screens/main/panels/device.py @@ -101,7 +101,7 @@ class DevicePanel(BasePanel): # pylint: disable=too-many-instance-attributes self.formats_full: list[str] = [ '│ {physical_index:>3} {name:<19} {persistence_mode:>4} ' '│ {bus_id:<16} {display_active:>3} │ {total_volatile_uncorrected_ecc_errors:>20} │', - '│ {fan_speed_string:>3} {temperature_string:>4} {performance_state:>4} {power_status:>13} ' + '│ {fan_speed_string:>3} {temperature_string:>4} {performance_state:^4} {power_status:>13} ' '│ {memory_usage:>20} │ {gpu_utilization_string:>7} {compute_mode:>11} │', ] @@ -122,6 +122,11 @@ class DevicePanel(BasePanel): # pylint: disable=too-many-instance-attributes '{total_volatile_uncorrected_ecc_errors:>20}', '{mig_mode:>8} {total_volatile_uncorrected_ecc_errors:>10}', ) + if all(len(device.power_status.rpartition(' / ')[-1]) < 5 for device in self.snapshots): + self.formats_compact[0] = self.formats_compact[0].replace( + 'performance_state:<3', + 'performance_state:>3', + ) @property def width(self) -> int: