Move imports in bitcoin component (#27814)

This commit is contained in:
bouni 2019-10-18 02:18:47 +02:00 committed by Paulus Schoutsen
parent 21754fd7cc
commit e17b8b011a

View File

@ -1,11 +1,12 @@
"""Bitcoin information service that uses blockchain.info.""" """Bitcoin information service that uses blockchain.info."""
import logging
from datetime import timedelta from datetime import timedelta
import logging
from blockchain import exchangerates, statistics
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_DISPLAY_OPTIONS, ATTR_ATTRIBUTION, CONF_CURRENCY from homeassistant.const import ATTR_ATTRIBUTION, CONF_CURRENCY, CONF_DISPLAY_OPTIONS
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@ -55,7 +56,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Bitcoin sensors.""" """Set up the Bitcoin sensors."""
from blockchain import exchangerates
currency = config.get(CONF_CURRENCY) currency = config.get(CONF_CURRENCY)
@ -169,7 +169,6 @@ class BitcoinData:
def update(self): def update(self):
"""Get the latest data from blockchain.info.""" """Get the latest data from blockchain.info."""
from blockchain import statistics, exchangerates
self.stats = statistics.get() self.stats = statistics.get()
self.ticker = exchangerates.get_ticker() self.ticker = exchangerates.get_ticker()