Skip to content

Commit

Permalink
nvidia_smi module: fix --list-properties (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasers authored Jan 12, 2024
1 parent fe39761 commit 64965ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions py3status/modules/nvidia_smi.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,11 @@ def nvidia_smi(self):
help_data = check_output(help_cmd.split()).decode()

new_properties = []
e = ["Default", "Exclusive_Thread", "Exclusive_Process", "Prohibited"]
for line in help_data.splitlines():
if line.startswith('"'):
properties = line.split('"')[1::2]
for name in properties:
if name not in e:
if ":" not in name:
new_properties.append(name)

properties = ",".join(new_properties)
Expand All @@ -177,9 +176,10 @@ def nvidia_smi(self):

new_gpus = []
msg = "This GPU contains {} supported properties."
e = ["Not Supported", "N/A"]
for line in gpu_data.splitlines():
gpu = dict(zip(new_properties, line.split(", ")))
gpu = {k: v for k, v in gpu.items() if "[Not Supported]" not in v}
gpu = {k: v for k, v in gpu.items() if all(x not in v for x in e)}
gpu["= " + msg.format(len(gpu))] = ""
gpu["=" * (len(msg) + 2)] = ""
new_gpus.append(gpu)
Expand Down

0 comments on commit 64965ca

Please sign in to comment.