Skip to content

Commit

Permalink
[Edgecore][device][platform] Fixed lgtm error.
Browse files Browse the repository at this point in the history
Signed-off-by: michael_shih <michael_shih@edge-core.com>
  • Loading branch information
ec-michael-shih committed Dec 1, 2022
1 parent 8a3823f commit f6e52de
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _set_fan_node_val(self, fan_num, node_num, val):

try:
val_file.close()
except BaseException:
except Exception:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _get_thermal_val(self, thermal_num):
return None
try:
val_file.close()
except BaseException:
except Exception:
logging.debug('GET. unable to close file. device_path:%s', device_path)
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def set_high_threshold(self, temperature):

try:
if temperature != NOT_AVAILABLE:
tmp = float(temperature)
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')

Expand Down Expand Up @@ -319,7 +319,7 @@ def set_low_threshold(self, temperature):

try:
if temperature != NOT_AVAILABLE:
tmp = float(temperature)
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')

Expand Down Expand Up @@ -348,7 +348,7 @@ def set_high_critical_threshold(self, temperature):

try:
if temperature != NOT_AVAILABLE:
tmp = float(temperature)
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')

Expand Down Expand Up @@ -377,7 +377,7 @@ def set_low_critical_threshold(self, temperature):

try:
if temperature != NOT_AVAILABLE:
tmp = float(temperature)
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ def get_status_led(self):
0: self.STATUS_LED_COLOR_AMBER
}.get(status, self.STATUS_LED_COLOR_OFF)

return False

def get_temperature(self):
"""
Retrieves current temperature reading from PSU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _convert_raw_to_byte(self, raw, num_bytes):
for n in range(0, num_bytes):
eeprom_raw[n] = hex(raw[n])[2:].zfill(2)

except BaseException:
except Exception:
return None

return eeprom_raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ def set_high_threshold(self, temperature):
"""
try:
value = float(temperature)
except:
except Exception:
return False

try:
self.conf.set_high_threshold(str(value))
except:
except Exception:
return False

return True
Expand Down Expand Up @@ -392,12 +392,12 @@ def set_high_critical_threshold(self, temperature):
"""
try:
value = float(temperature)
except:
except Exception:
return False

try:
self.conf.set_high_critical_threshold(str(value))
except:
except Exception:
return False

return True

0 comments on commit f6e52de

Please sign in to comment.