mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02:00
Move imports in slack and socialblade (#27747)
* Moved imports to top-level in samsungtv, slack and socialblade * Rewinded top-level imports in samsungtv component
This commit is contained in:
parent
43c85c0549
commit
e79a5baf9e
@ -3,11 +3,10 @@ import logging
|
||||
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
|
||||
import slacker
|
||||
from slacker import Slacker
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_API_KEY, CONF_ICON, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_TARGET,
|
||||
@ -15,6 +14,8 @@ from homeassistant.components.notify import (
|
||||
PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_ICON, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -45,7 +46,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
"""Get the Slack notification service."""
|
||||
import slacker
|
||||
|
||||
channel = config.get(CONF_CHANNEL)
|
||||
api_key = config.get(CONF_API_KEY)
|
||||
@ -67,7 +67,6 @@ class SlackNotificationService(BaseNotificationService):
|
||||
|
||||
def __init__(self, default_channel, api_token, username, icon, is_allowed_path):
|
||||
"""Initialize the service."""
|
||||
from slacker import Slacker
|
||||
|
||||
self._default_channel = default_channel
|
||||
self._api_token = api_token
|
||||
@ -84,7 +83,6 @@ class SlackNotificationService(BaseNotificationService):
|
||||
|
||||
def send_message(self, message="", **kwargs):
|
||||
"""Send a message to a user."""
|
||||
import slacker
|
||||
|
||||
if kwargs.get(ATTR_TARGET) is None:
|
||||
targets = [self._default_channel]
|
||||
|
@ -2,6 +2,7 @@
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import socialbladeclient
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
@ -71,7 +72,6 @@ class SocialBladeSensor(Entity):
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Get the latest data from Social Blade."""
|
||||
import socialbladeclient
|
||||
|
||||
try:
|
||||
data = socialbladeclient.get_data(self.channel_id)
|
||||
|
Loading…
Reference in New Issue
Block a user