clean up linting
This commit is contained in:
parent
b288e721a3
commit
bdaaa11d66
2 changed files with 5 additions and 6 deletions
|
@ -76,12 +76,12 @@ class GPUStatsWidget(Static):
|
|||
|
||||
# 'humanize' values, add units
|
||||
for power_stat, val in power_stats.items():
|
||||
if val == None:
|
||||
if val is None:
|
||||
power_stats[power_stat] = 'Unknown'
|
||||
else:
|
||||
power_stats[power_stat] = str(val) + 'W'
|
||||
for temp_stat, val in temp_stats.items():
|
||||
if val == None:
|
||||
if val is None:
|
||||
temp_stats[temp_stat] = 'N/A'
|
||||
else:
|
||||
temp_stats[temp_stat] = str(val) + 'C'
|
||||
|
|
|
@ -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'),
|
||||
"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)
|
||||
|
||||
return _pwr
|
||||
|
@ -211,8 +211,7 @@ def get_clock(domain: str, card: Optional[str] = None, format_freq: Optional[boo
|
|||
if format_freq:
|
||||
return format_frequency(int(read_stat(clock_file)))
|
||||
return int(read_stat(clock_file))
|
||||
else:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def get_voltage(card: Optional[str] = None) -> float:
|
||||
|
@ -251,7 +250,7 @@ def get_fan_rpm(card: Optional[str] = None) -> int:
|
|||
card = validate_card(card)
|
||||
hwmon_dir = AMDGPU_CARDS[card]
|
||||
_val = read_stat(path.join(hwmon_dir, "fan1_input"))
|
||||
if _val != None:
|
||||
if _val is not None:
|
||||
_val = int(_val)
|
||||
return _val
|
||||
|
||||
|
|
Reference in a new issue