Pylint cleanups (#15626)

* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2018-07-23 10:16:05 +02:00
1 parent a38c0d6d15
commit b7c336a687
166 files changed
+425 -490

No files matched your search

+1 -1
View File
@@ -280,7 +280,7 @@ class HTML5PushCallbackView(HomeAssistantView):
return self.json_message('Authorization header must '
'start with Bearer',
status_code=HTTP_UNAUTHORIZED)
elif len(parts) != 2:
if len(parts) != 2:
return self.json_message('Authorization header must '
'be Bearer token',
status_code=HTTP_UNAUTHORIZED)
+1 -1
View File
@@ -95,7 +95,7 @@ class RestNotificationService(BaseNotificationService):
"""Recursive template creator helper function."""
if isinstance(value, list):
return [_data_template_creator(item) for item in value]
elif isinstance(value, dict):
if isinstance(value, dict):
return {key: _data_template_creator(item)
for key, item in value.items()}
value.hass = self._hass
+3 -3
View File
@@ -73,7 +73,7 @@ class TelegramNotificationService(BaseNotificationService):
self.hass.services.call(
DOMAIN, 'send_photo', service_data=service_data)
return
elif data is not None and ATTR_VIDEO in data:
if data is not None and ATTR_VIDEO in data:
videos = data.get(ATTR_VIDEO, None)
videos = videos if isinstance(videos, list) else [videos]
for video_data in videos:
@@ -81,11 +81,11 @@ class TelegramNotificationService(BaseNotificationService):
self.hass.services.call(
DOMAIN, 'send_video', service_data=service_data)
return
elif data is not None and ATTR_LOCATION in data:
if data is not None and ATTR_LOCATION in data:
service_data.update(data.get(ATTR_LOCATION))
return self.hass.services.call(
DOMAIN, 'send_location', service_data=service_data)
elif data is not None and ATTR_DOCUMENT in data:
if data is not None and ATTR_DOCUMENT in data:
service_data.update(data.get(ATTR_DOCUMENT))
return self.hass.services.call(
DOMAIN, 'send_document', service_data=service_data)
+2 -2
View File
@@ -194,9 +194,9 @@ class TwitterNotificationService(BaseNotificationService):
if media_type.startswith('image/gif'):
return 'tweet_gif'
elif media_type.startswith('video/'):
if media_type.startswith('video/'):
return 'tweet_video'
elif media_type.startswith('image/'):
if media_type.startswith('image/'):
return 'tweet_image'
return None