Archived
1
1
Fork 0

clean up linting

This commit is contained in:
Josh Lay 2023-07-23 02:18:54 -05:00
parent b288e721a3
commit bdaaa11d66
Signed by: jlay
GPG key ID: B265E45CACAD108A
2 changed files with 5 additions and 6 deletions

View file

@ -76,12 +76,12 @@ class GPUStatsWidget(Static):
# 'humanize' values, add units # 'humanize' values, add units
for power_stat, val in power_stats.items(): for power_stat, val in power_stats.items():
if val == None: if val is None:
power_stats[power_stat] = 'Unknown' power_stats[power_stat] = 'Unknown'
else: else:
power_stats[power_stat] = str(val) + 'W' power_stats[power_stat] = str(val) + 'W'
for temp_stat, val in temp_stats.items(): for temp_stat, val in temp_stats.items():
if val == None: if val is None:
temp_stats[temp_stat] = 'N/A' temp_stats[temp_stat] = 'N/A'
else: else:
temp_stats[temp_stat] = str(val) + 'C' temp_stats[temp_stat] = str(val) + 'C'

View file

@ -142,7 +142,7 @@ def get_power_stats(card: Optional[str] = None) -> dict:
"capability": read_stat(path.join(hwmon_dir, "power1_cap_max"), stat_type='power'), "capability": read_stat(path.join(hwmon_dir, "power1_cap_max"), stat_type='power'),
"default": read_stat(path.join(hwmon_dir, "power1_cap_default"), stat_type='power')} "default": read_stat(path.join(hwmon_dir, "power1_cap_default"), stat_type='power')}
if _pwr['limit'] != None: if _pwr['limit'] is not None:
_pwr['limit_pct'] = round((_pwr['average'] / _pwr['limit']) * 100, 1) _pwr['limit_pct'] = round((_pwr['average'] / _pwr['limit']) * 100, 1)
return _pwr return _pwr
@ -211,7 +211,6 @@ def get_clock(domain: str, card: Optional[str] = None, format_freq: Optional[boo
if format_freq: if format_freq:
return format_frequency(int(read_stat(clock_file))) return format_frequency(int(read_stat(clock_file)))
return int(read_stat(clock_file)) return int(read_stat(clock_file))
else:
return None return None
@ -251,7 +250,7 @@ def get_fan_rpm(card: Optional[str] = None) -> int:
card = validate_card(card) card = validate_card(card)
hwmon_dir = AMDGPU_CARDS[card] hwmon_dir = AMDGPU_CARDS[card]
_val = read_stat(path.join(hwmon_dir, "fan1_input")) _val = read_stat(path.join(hwmon_dir, "fan1_input"))
if _val != None: if _val is not None:
_val = int(_val) _val = int(_val)
return _val return _val