mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-15 14:15:55 -06:00
chore(pre-commit): update pre-commit hooks
This commit is contained in:
parent
43015c916f
commit
a6761eb5c4
5 changed files with 15 additions and 10 deletions
|
|
@ -41,7 +41,7 @@ repos:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
additional_dependencies: [".[toml]"]
|
additional_dependencies: [".[toml]"]
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.19.1
|
rev: v1.20.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
exclude: |
|
exclude: |
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ class HistoryGraph: # pylint: disable=too-many-instance-attributes
|
||||||
|
|
||||||
def add(self, value: float) -> None:
|
def add(self, value: float) -> None:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
value = self.baseline - 0.1
|
value = self.baseline - 0.1 # type: ignore[unreachable]
|
||||||
assert isinstance(value, (int, float))
|
assert isinstance(value, (int, float))
|
||||||
|
|
||||||
with self.write_lock:
|
with self.write_lock:
|
||||||
|
|
@ -368,7 +368,7 @@ class BufferedHistoryGraph(HistoryGraph):
|
||||||
|
|
||||||
def add(self, value: float) -> None:
|
def add(self, value: float) -> None:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
value = self.baseline - 0.1
|
value = self.baseline - 0.1 # type: ignore[unreachable]
|
||||||
assert isinstance(value, (int, float))
|
assert isinstance(value, (int, float))
|
||||||
|
|
||||||
timestamp = time.monotonic()
|
timestamp = time.monotonic()
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ class KeyBuffer: # pylint: disable=too-many-instance-attributes
|
||||||
and self.quantifier_key in self.keymap
|
and self.quantifier_key in self.keymap
|
||||||
and self.keymap[self.quantifier_key] is self.QUANTIFIER_KEY_FINISHED # type: ignore[comparison-overlap]
|
and self.keymap[self.quantifier_key] is self.QUANTIFIER_KEY_FINISHED # type: ignore[comparison-overlap]
|
||||||
):
|
):
|
||||||
self.finished_parsing_quantifier = True
|
self.finished_parsing_quantifier = True # type: ignore[unreachable]
|
||||||
|
|
||||||
def clear(self) -> None:
|
def clear(self) -> None:
|
||||||
self.__init__(self.keymap) # type: ignore[misc] # pylint: disable=unnecessary-dunder-call
|
self.__init__(self.keymap) # type: ignore[misc] # pylint: disable=unnecessary-dunder-call
|
||||||
|
|
|
||||||
|
|
@ -152,17 +152,17 @@ class ProcessMetricsScreen(BaseSelectableScreen): # pylint: disable=too-many-in
|
||||||
|
|
||||||
def format_cpu_percent(value: float) -> str:
|
def format_cpu_percent(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'CPU: {value}'
|
return f'CPU: {value}' # type: ignore[unreachable]
|
||||||
return f'CPU: {value:.1f}%'
|
return f'CPU: {value:.1f}%'
|
||||||
|
|
||||||
def format_max_cpu_percent(value: float) -> str:
|
def format_max_cpu_percent(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'MAX CPU: {value}'
|
return f'MAX CPU: {value}' # type: ignore[unreachable]
|
||||||
return f'MAX CPU: {value:.1f}%'
|
return f'MAX CPU: {value:.1f}%'
|
||||||
|
|
||||||
def format_host_memory(value: float) -> str:
|
def format_host_memory(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'HOST-MEM: {value}'
|
return f'HOST-MEM: {value}' # type: ignore[unreachable]
|
||||||
return (
|
return (
|
||||||
f'HOST-MEM: {bytes2human(value)} '
|
f'HOST-MEM: {bytes2human(value)} '
|
||||||
f'({round(100.0 * value / total_host_memory, 1):.1f}%)'
|
f'({round(100.0 * value / total_host_memory, 1):.1f}%)'
|
||||||
|
|
@ -170,7 +170,7 @@ class ProcessMetricsScreen(BaseSelectableScreen): # pylint: disable=too-many-in
|
||||||
|
|
||||||
def format_max_host_memory(value: float) -> str:
|
def format_max_host_memory(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'MAX HOST-MEM: {value}'
|
return f'MAX HOST-MEM: {value}' # type: ignore[unreachable]
|
||||||
return (
|
return (
|
||||||
f'MAX HOST-MEM: {bytes2human(value)} '
|
f'MAX HOST-MEM: {bytes2human(value)} '
|
||||||
f'({round(100.0 * value / total_host_memory, 1):.1f}%) '
|
f'({round(100.0 * value / total_host_memory, 1):.1f}%) '
|
||||||
|
|
@ -196,12 +196,12 @@ class ProcessMetricsScreen(BaseSelectableScreen): # pylint: disable=too-many-in
|
||||||
|
|
||||||
def format_sm(value: float) -> str:
|
def format_sm(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'GPU-SM: {value}'
|
return f'GPU-SM: {value}' # type: ignore[unreachable]
|
||||||
return f'GPU-SM: {value:.1f}%'
|
return f'GPU-SM: {value:.1f}%'
|
||||||
|
|
||||||
def format_max_sm(value: float) -> str:
|
def format_max_sm(value: float) -> str:
|
||||||
if value is NA: # type: ignore[comparison-overlap]
|
if value is NA: # type: ignore[comparison-overlap]
|
||||||
return f'MAX GPU-SM: {value}'
|
return f'MAX GPU-SM: {value}' # type: ignore[unreachable]
|
||||||
return f'MAX GPU-SM: {value:.1f}%'
|
return f'MAX GPU-SM: {value:.1f}%'
|
||||||
|
|
||||||
with self.snapshot_lock:
|
with self.snapshot_lock:
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ warn_redundant_casts = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
|
no_site_packages = true
|
||||||
|
|
||||||
[tool.pylint]
|
[tool.pylint]
|
||||||
main.py-version = "3.8"
|
main.py-version = "3.8"
|
||||||
|
|
@ -174,6 +175,9 @@ ignore = [
|
||||||
# TRY003: avoid specifying long messages outside the exception class
|
# TRY003: avoid specifying long messages outside the exception class
|
||||||
# long messages are necessary for clarity
|
# long messages are necessary for clarity
|
||||||
"TRY003",
|
"TRY003",
|
||||||
|
# FURB152: literals that are similar to constants in `math` module.
|
||||||
|
# change code semantics
|
||||||
|
"FURB152",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
|
|
@ -207,6 +211,7 @@ ignore = [
|
||||||
[tool.ruff.lint.isort]
|
[tool.ruff.lint.isort]
|
||||||
known-first-party = ["nvitop", "nvitop_exporter"]
|
known-first-party = ["nvitop", "nvitop_exporter"]
|
||||||
extra-standard-library = ["typing_extensions"]
|
extra-standard-library = ["typing_extensions"]
|
||||||
|
known-local-folder = ["tests"]
|
||||||
lines-after-imports = 2
|
lines-after-imports = 2
|
||||||
|
|
||||||
[tool.ruff.lint.pydocstyle]
|
[tool.ruff.lint.pydocstyle]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue