Skip to content

Commit

Permalink
Minor style and typing fix for gpustat.{cli,test_gpustat}
Browse files Browse the repository at this point in the history
  • Loading branch information
wookayin committed Nov 24, 2023
1 parent f1464ea commit f4cd639
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions gpustat/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""gpustat CLI."""

import os
import sys
import time
Expand Down Expand Up @@ -104,15 +106,17 @@ def loop_gpustat(interval=1.0, **kwargs):


def main(*argv):
"""The main entrypoint to the gpustat CLI."""
if not argv:
argv = list(sys.argv)

# attach SIGPIPE handler to properly handle broken pipe
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:
Expand Down Expand Up @@ -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
Expand All @@ -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))


Expand Down
2 changes: 1 addition & 1 deletion gpustat/test_gpustat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f4cd639

Please sign in to comment.