Fix pylint 1.7.2 no-else-return issues (#8361)

* Fix pylint 1.7.2 no-else-return issues

* Update tomato.py
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2017-07-05 23:30:01 -07:00
1 parent 5779d64e98
commit 46e030662d
111 files changed
+305 -455

No files matched your search

@@ -52,8 +52,7 @@ class BboxDeviceScanner(DeviceScanner):
if filter_named:
return filter_named[0]
else:
return None
return None
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_info(self):
@@ -94,21 +94,20 @@ class LocativeView(HomeAssistantView):
partial(self.see, dev_id=device,
location_name=location_name, gps=gps_location))
return 'Setting location to not home'
else:
# Ignore the message if it is telling us to exit a zone that we
# aren't currently in. This occurs when a zone is entered
# before the previous zone was exited. The enter message will
# be sent first, then the exit message will be sent second.
return 'Ignoring exit from {} (already in {})'.format(
location_name, current_state)
# Ignore the message if it is telling us to exit a zone that we
# aren't currently in. This occurs when a zone is entered
# before the previous zone was exited. The enter message will
# be sent first, then the exit message will be sent second.
return 'Ignoring exit from {} (already in {})'.format(
location_name, current_state)
elif direction == 'test':
# In the app, a test message can be sent. Just return something to
# the user to let them know that it works.
return 'Received test message.'
else:
_LOGGER.error('Received unidentified message from Locative: %s',
direction)
return ('Received unidentified message: {}'.format(direction),
HTTP_UNPROCESSABLE_ENTITY)
_LOGGER.error('Received unidentified message from Locative: %s',
direction)
return ('Received unidentified message: {}'.format(direction),
HTTP_UNPROCESSABLE_ENTITY)
@@ -95,8 +95,7 @@ class NmapDeviceScanner(DeviceScanner):
if filter_named:
return filter_named[0]
else:
return None
return None
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_info(self):
@@ -131,8 +131,7 @@ def async_setup_scanner(hass, config, async_see, discovery_info=None):
plaintext_payload = decrypt_payload(topic, data['data'])
if plaintext_payload is None:
return None
else:
return validate_payload(topic, plaintext_payload, data_type)
return validate_payload(topic, plaintext_payload, data_type)
if not isinstance(data, dict) or data.get('_type') != data_type:
_LOGGER.debug("Skipping %s update for following data "
@@ -90,8 +90,7 @@ class TadoDeviceScanner(DeviceScanner):
if filter_named:
return filter_named[0]
else:
return None
return None
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_info(self):
@@ -73,8 +73,8 @@ class TomatoDeviceScanner(DeviceScanner):
if not filter_named or not filter_named[0]:
return None
else:
return filter_named[0]
return filter_named[0]
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_tomato_info(self):
@@ -234,10 +234,9 @@ class Tplink3DeviceScanner(TplinkDeviceScanner):
self.stok = ''
self.sysauth = ''
return False
else:
_LOGGER.error(
"An unknown error happened while fetching data")
return False
_LOGGER.error(
"An unknown error happened while fetching data")
return False
except ValueError:
_LOGGER.error("Router didn't respond with JSON. "
"Check if credentials are correct")
@@ -101,10 +101,10 @@ class XiaomiDeviceScanner(DeviceScanner):
result = _retrieve_list(self.host, self.token)
if result:
return result
else:
_LOGGER.info("Refreshing token and retrying device list refresh")
self.token = _get_token(self.host, self.username, self.password)
return _retrieve_list(self.host, self.token)
_LOGGER.info("Refreshing token and retrying device list refresh")
self.token = _get_token(self.host, self.username, self.password)
return _retrieve_list(self.host, self.token)
def _store_result(self, result):
"""Extract and store the device list in self.last_results."""