From f4cd639dd1b6c8ab66191a9e7327767f4d8cb98b Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Tue, 31 Oct 2023 22:36:19 -0400 Subject: [PATCH] Minor style and typing fix for gpustat.{cli,test_gpustat} --- gpustat/cli.py | 10 +++++++--- gpustat/test_gpustat.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gpustat/cli.py b/gpustat/cli.py index dbc4e61..933abbe 100644 --- a/gpustat/cli.py +++ b/gpustat/cli.py @@ -1,3 +1,5 @@ +"""gpustat CLI.""" + import os import sys import time @@ -104,6 +106,7 @@ def loop_gpustat(interval=1.0, **kwargs): def main(*argv): + """The main entrypoint to the gpustat CLI.""" if not argv: argv = list(sys.argv) @@ -111,8 +114,9 @@ def main(*argv): try: # sigpipe not available under windows. just ignore in this case import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) - except Exception as e: + except Exception: # pylint: disable=broad-exception-caught pass + # arguments to gpustat import argparse try: @@ -200,7 +204,7 @@ def nonnegative_int(value): args.show_fan_speed = True args.show_codec = 'enc,dec' args.show_power = 'draw,limit' - del args.show_all + del args.show_all # type: ignore if args.interval is None: # with default value args.interval = 1.0 @@ -213,7 +217,7 @@ def nonnegative_int(value): loop_gpustat(**vars(args)) else: - del args.interval + del args.interval # type: ignore print_gpustat(**vars(args)) diff --git a/gpustat/test_gpustat.py b/gpustat/test_gpustat.py index 4d4017d..3525753 100644 --- a/gpustat/test_gpustat.py +++ b/gpustat/test_gpustat.py @@ -3,7 +3,7 @@ """ # flake8: ignore=E501 # pyright: reportGeneralTypeIssues=false -# pylint: disable=protected-access,no-member +# pylint: disable=protected-access,no-member,redefined-outer-name import ctypes import os