deps: remove duplicate lint checks

This commit is contained in:
Xuehai Pan 2025-03-16 23:07:45 +08:00
parent 669f7b32c6
commit 2fbf791e5c
5 changed files with 144 additions and 207 deletions

36
.flake8
View file

@ -1,36 +0,0 @@
[flake8]
max-line-length = 120
max-doc-length = 100
select = B,C,E,F,W,Y,SIM
ignore =
# E203: whitespace before ':'
# E241: whitespace after ':'
# E704: multiple statements on one line (def)
# W503: line break before binary operator
# W504: line break after binary operator
# format by black
E203,E241,E704,W503,W504,
# E501: line too long
# W505: doc line too long
# too long docstring due to long example blocks
E501,W505,
# SIM105: Use 'contextlib.suppress(...)'
# prefer try-except block
SIM105,
per-file-ignores =
# F401: module imported but unused
# intentionally unused imports
__init__.py: F401
nvitop/api/host.py: F401
nvitop/api/libnvml.py: F401
# SIM113: use enumerate
# false positive
nvitop/tui/screens/main/process.py: SIM113
exclude =
.git,
.vscode,
venv,
__pycache__,
docs/source/conf.py,
build,
dist

View file

@ -27,30 +27,11 @@ repos:
- id: debug-statements
- id: double-quote-string-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.10.0
rev: v0.11.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py38-plus] # sync with requires-python
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-docstrings
- flake8-pyi
- flake8-simplify
exclude: |
(?x)(
^docs/source/conf.py$
)
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:

View file

@ -1,162 +1,148 @@
nvitop
nvisel
Xuehai
Pan
panxuehai
pyproject
toml
txt
GPL
fmt
Redhat
WSL
enum
isinstance
str
accessdenied
addstr
api
args
ascii
attr
bg
bool
boolean
ints
args
kwargs
py
os
sys
nan
func
divmod
ord
cwd
environ
lstrip
rstrip
const
globals
Iterable
iterable
psutil
bstate
cli
cmdline
oneshot
colorscheme
conf
const
csv
ctrl
ctx
IPython
cuda
cudadevice
cudaerror
cwd
devicesnapshot
displayables
divmod
docstring
ecc
enum
env
environ
esc
failsafe
fallbacks
fg
fmt
func
getch
getmouse
gib
gids
globals
gpl
gpu
gpu's
gpuprocess
gpuprocesssnapshot
gpus
gpustatslogger
hostname
ints
ipython
isinstance
iterable
keras
kib
kmd
kwargs
len
libcuda
libcudart
libnvml
linters
lol
lstrip
maxsize
memoize
mib
mig
migdevice
milliwatts
mps
mypy
namespace
nan
noheader
noqa
nosuchprocess
nounits
nvidia
nvidia-smi
smi
pynvml
PID
pid
GPU
gpu
GPUs
GPU's
gpus
MIG
mig
runtime
RTX
TTC
TCC
WDM
WDDM
ECC
ecc
SM
sm
shader
PCI
nvisel
nvitop
nvml
nvmlerror
oneshot
ord
os
ot
pan
panxuehai
pci
pstate
xxxxxx
milliwatts
linters
docstring
Cuda
cuda
CUDA
CUDAError
NVML
NVMLError
CudaDevice
PhysicalDevice
MigDevice
GpuProcess
DeviceSnapshot
GpuProcessSnapshot
ResourceMetricCollector
UUID
uuid
rw
physicaldevice
pid
ppid
uid
uids
gids
RSS
NoSuchProcess
AccessDenied
fallbacks
memoize
csv
noheader
nounits
xargs
superset
subprocess
MiB
GiB
Failsafe
failsafe
unicode
Traceback
Subclasses
Displayables
WideString
tensorflow
Keras
keras
Xception
fg
bg
attr
esc
Ctrl
ascii
colorscheme
addstr
getch
bstate
getmouse
uncase
lol
xx
yyy
zz
CLI
pstate
psutil
py
pynvml
pyproject
pytorch
redhat
reentrant
resourcemetriccollector
rss
rstrip
rtx
runtime
rw
rx
shader
sm
smi
str
struct
subclasses
submodule
submodules
namespace
noqa
uptime
ot
oT
mypy
struct
MPS
KMD
conf
Unallocated
KiB
tx
rx
ThroughputInfo
pytorch
api
utils
GpuStatsLogger
hostname
len
maxsize
reentrant
env
subprocess
superset
sys
tcc
tensorflow
throughputinfo
toml
traceback
ttc
tty
tx
txt
uid
uids
unallocated
uncase
unicode
uptime
utils
uuid
wddm
wdm
widestring
wsl
xargs
xception
xuehai
xx
xxxxxx
yyy
zz

View file

@ -29,7 +29,7 @@ import re
import sys
import time
from collections.abc import KeysView
from typing import TYPE_CHECKING, Any, Callable, TypeVar, final
from typing import TYPE_CHECKING, Any, Callable, ClassVar, TypeVar, final
from nvitop.api import termcolor
@ -135,6 +135,8 @@ class NaType(str):
nan
"""
__slots__: ClassVar[tuple[()]] = ()
def __new__(cls) -> NaType:
"""Get the singleton instance (:const:`nvitop.NA`)."""
if not hasattr(cls, '_instance'):

View file

@ -115,6 +115,7 @@ src = ["nvitop", "nvitop-exporter/nvitop_exporter"]
[tool.ruff.format]
quote-style = "single"
docstring-code-format = false
skip-magic-trailing-comma = false
[tool.ruff.lint]
select = [
@ -132,17 +133,20 @@ select = [
"C4", # flake8-comprehensions
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"LOG", # flake8-logging
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"TC", # flake8-type-checking
"NPY", # numpy
"PERF", # perflint
"FURB", # refurb
"TRY", # tryceratops