1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Pylint cleanups (#15626)

* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
This commit is contained in:
Ville Skyttä
2018-07-23 11:16:05 +03:00
committed by Paulus Schoutsen
parent a38c0d6d15
commit b7c336a687
166 changed files with 425 additions and 490 deletions

View File

@@ -361,7 +361,7 @@ def temperature_unit(value) -> str:
value = str(value).upper()
if value == 'C':
return TEMP_CELSIUS
elif value == 'F':
if value == 'F':
return TEMP_FAHRENHEIT
raise vol.Invalid('invalid temperature unit (expected C or F)')
@@ -435,15 +435,14 @@ def socket_timeout(value):
"""
if value is None:
return _GLOBAL_DEFAULT_TIMEOUT
else:
try:
float_value = float(value)
if float_value > 0.0:
return float_value
raise vol.Invalid('Invalid socket timeout value.'
' float > 0.0 required.')
except Exception as _:
raise vol.Invalid('Invalid socket timeout: {err}'.format(err=_))
try:
float_value = float(value)
if float_value > 0.0:
return float_value
raise vol.Invalid('Invalid socket timeout value.'
' float > 0.0 required.')
except Exception as _:
raise vol.Invalid('Invalid socket timeout: {err}'.format(err=_))
# pylint: disable=no-value-for-parameter