Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move imports to top for gearbest #29432

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions homeassistant/components/gearbest/sensor.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"""Parse prices of an item from gearbest."""
import logging
from datetime import timedelta
import logging

from gearbest_parser import CurrencyConverter, GearbestParser
import voluptuous as vol

from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_CURRENCY, CONF_ID, CONF_NAME, CONF_URL
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import track_time_interval
from homeassistant.const import CONF_NAME, CONF_ID, CONF_URL, CONF_CURRENCY
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -41,7 +42,6 @@

def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Gearbest sensor."""
from gearbest_parser import CurrencyConverter

currency = config.get(CONF_CURRENCY)

Expand Down Expand Up @@ -71,7 +71,6 @@ class GearbestSensor(Entity):

def __init__(self, converter, item, currency):
"""Initialize the sensor."""
from gearbest_parser import GearbestParser

self._name = item.get(CONF_NAME)
self._parser = GearbestParser()
Expand Down