Move imports in linode component (#28014)
This commit is contained in:
parent
e19663f172
commit
67f7146cab
1 changed files with 1 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import linode
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
|
@ -35,8 +36,6 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
|
||||
def setup(hass, config):
|
||||
"""Set up the Linode component."""
|
||||
import linode
|
||||
|
||||
conf = config[DOMAIN]
|
||||
access_token = conf.get(CONF_ACCESS_TOKEN)
|
||||
|
||||
|
@ -58,16 +57,12 @@ class Linode:
|
|||
|
||||
def __init__(self, access_token):
|
||||
"""Initialize the Linode connection."""
|
||||
import linode
|
||||
|
||||
self._access_token = access_token
|
||||
self.data = None
|
||||
self.manager = linode.LinodeClient(token=self._access_token)
|
||||
|
||||
def get_node_id(self, node_name):
|
||||
"""Get the status of a Linode Instance."""
|
||||
import linode
|
||||
|
||||
node_id = None
|
||||
|
||||
try:
|
||||
|
@ -83,8 +78,6 @@ class Linode:
|
|||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Use the data from Linode API."""
|
||||
import linode
|
||||
|
||||
try:
|
||||
self.data = self.manager.linode.get_instances()
|
||||
except linode.errors.ApiError as _ex:
|
||||
|
|
Loading…
Add table
Reference in a new issue