Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 11:46:32 +01:00
1 parent cf7c2c492a
commit 652f059d6a
19 files changed
+86 -131

No files matched your search

+4 -7
View File
@@ -1,6 +1,4 @@
"""
homeassistant.components.notify.slack
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Slack platform for notify component.
For more details about this platform, please refer to the documentation at
@@ -18,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-variable
def get_service(hass, config):
""" Get the slack notification service. """
"""Get the Slack notification service."""
import slacker
if not validate_config({DOMAIN: config},
@@ -39,22 +37,21 @@ def get_service(hass, config):
# pylint: disable=too-few-public-methods
class SlackNotificationService(BaseNotificationService):
""" Implements notification service for Slack. """
"""Implement the notification service for Slack."""
def __init__(self, default_channel, api_token):
"""Initialize the service."""
from slacker import Slacker
self._default_channel = default_channel
self._api_token = api_token
self.slack = Slacker(self._api_token)
self.slack.auth.test()
def send_message(self, message="", **kwargs):
""" Send a message to a user. """
"""Send a message to a user."""
import slacker
channel = kwargs.get('channel', self._default_channel)
try:
self.slack.chat.post_message(channel, message)
except slacker.Error: