8000 Move imports to top for deluge by springstan · Pull Request #29438 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Move imports to top for deluge #29438

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

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions homeassistant/components/deluge/sensor.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
"""Support for monitoring the Deluge BitTorrent client API."""
import logging

from deluge_client import DelugeRPCClient, FailedToReconnectException
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_USERNAME,
CONF_MONITORED_VARIABLES,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_MONITORED_VARIABLES,
CONF_USERNAME,
STATE_IDLE,
)
from homeassistant.helpers.entity import Entity
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity

_LOGGER = logging.getLogger(__name__)
_THROTTLED_REFRESH = None
Expand Down Expand Up @@ -46,7 +47,6 @@

def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Deluge sensors."""
from deluge_client import DelugeRPCClient

name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
< 8000 a href="#diff-b2dd5af67f982e76850736481c4c6062b95041bfd882056c85e2828e7eaaf907" id="expand-down-link-36-diff-b2dd5af67f982e76850736481c4c6062b95041bfd882056c85e2828e7eaaf907" class="js-expand directional-expander" aria-label="Expand Down" data-url="/home-assistant/core/blob_excerpt/7df87490c609300788b769a78364f21689d1cd90?context=pull_request&diff=unified&direction=down&in_wiki_context&last_left=52&last_right=52&left=103&left_hunk_size=7&mode=100644&path=homeassistant%2Fcomponents%2Fdeluge%2Fsensor.py&pull_request_id=348965438&right=103&right_hunk_size=6" data-left-range="53-76" data-right-range="53-76"> Expand Down Expand Up @@ -103,7 +103,6 @@ def unit_of_measurement(self):

def update(self):
"""Get the latest data from Deluge and updates the state."""
from deluge_client import FailedToReconnectException

try:
self.data = self.client.call(
Expand Down
9 changes: 4 additions & 5 deletions homeassistant/components/deluge/switch.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
"""Support for setting the Deluge BitTorrent client in Pause."""
import logging

from deluge_client import DelugeRPCClient, FailedToReconnectException
import voluptuous as vol

from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.exceptions import PlatformNotReady
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PORT,
CONF_PASSWORD,
CONF_PORT,
CONF_USERNAME,
STATE_OFF,
STATE_ON,
)
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import ToggleEntity

_LOGGER = logging.getLogger(__name__)

Expand All @@ -35,7 +36,6 @@

def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Deluge switch."""
from deluge_client import DelugeRPCClient

name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
Expand Down Expand Up @@ -95,7 +95,6 @@ def turn_off(self, **kwargs):

def update(self):
"""Get the latest data from deluge and updates the state."""
from deluge_client import FailedToReconnectException

try:
torrent_list = self.deluge_client.call(
Expand Down
0