Sort imports according to PEP8 for huawei_lte (#29664)

pull/29798/head
Bas Nijholt 2019-12-09 19:06:25 +01:00 committed by Franck Nijhof
parent 897522a82d
commit 80c344d3a8
8 changed files with 22 additions and 23 deletions

View File

@ -3,12 +3,11 @@
from collections import defaultdict
from datetime import timedelta
from functools import partial
from urllib.parse import urlparse
import ipaddress
import logging
from typing import Any, Callable, Dict, List, Set, Tuple
from urllib.parse import urlparse
import voluptuous as vol
import attr
from getmac import get_mac_address
from huawei_lte_api.AuthorizedConnection import AuthorizedConnection
@ -20,13 +19,14 @@ from huawei_lte_api.exceptions import (
)
from requests.exceptions import Timeout
from url_normalize import url_normalize
import voluptuous as vol
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.notify import DOMAIN as NOTIFY_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.config_entries import ConfigEntry, SOURCE_IMPORT
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
CONF_PASSWORD,
CONF_RECIPIENT,
@ -36,8 +36,11 @@ from homeassistant.const import (
)
from homeassistant.core import CALLBACK_TYPE
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv, discovery
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import (
config_validation as cv,
device_registry as dr,
discovery,
)
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
@ -46,6 +49,7 @@ from homeassistant.helpers.dispatcher import (
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import HomeAssistantType
from .const import (
ALL_KEYS,
CONNECTION_TIMEOUT,
@ -64,7 +68,6 @@ from .const import (
UPDATE_SIGNAL,
)
_LOGGER = logging.getLogger(__name__)
# dicttoxml (used by huawei-lte-api) has uselessly verbose INFO level.

View File

@ -11,10 +11,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorDevice,
)
from homeassistant.const import CONF_URL
from . import HuaweiLteBaseEntity
from .const import DOMAIN, KEY_MONITORING_STATUS
_LOGGER = logging.getLogger(__name__)

View File

@ -8,10 +8,10 @@ from huawei_lte_api.AuthorizedConnection import AuthorizedConnection
from huawei_lte_api.Client import Client
from huawei_lte_api.Connection import Connection
from huawei_lte_api.exceptions import (
LoginErrorUsernameWrongException,
LoginErrorPasswordWrongException,
LoginErrorUsernamePasswordWrongException,
LoginErrorUsernamePasswordOverrunException,
LoginErrorUsernamePasswordWrongException,
LoginErrorUsernameWrongException,
ResponseErrorException,
)
from requests.exceptions import Timeout
@ -22,12 +22,11 @@ from homeassistant import config_entries
from homeassistant.components.ssdp import ATTR_HOST, ATTR_NAME, ATTR_PRESENTATIONURL
from homeassistant.const import CONF_PASSWORD, CONF_RECIPIENT, CONF_URL, CONF_USERNAME
from homeassistant.core import callback
# see https://github.com/PyCQA/pylint/issues/3202 about the DOMAIN's pylint issue
from .const import CONNECTION_TIMEOUT, DEFAULT_DEVICE_NAME
# https://github.com/PyCQA/pylint/issues/3202
from .const import DOMAIN # pylint: disable=unused-import
_LOGGER = logging.getLogger(__name__)

View File

@ -15,10 +15,10 @@ from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.const import CONF_URL
from homeassistant.helpers import entity_registry
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import HuaweiLteBaseEntity
from .const import DOMAIN, KEY_WLAN_HOST_LIST, UPDATE_SIGNAL
_LOGGER = logging.getLogger(__name__)
_DEVICE_SCAN = f"{DEVICE_TRACKER_DOMAIN}/device_scan"

View File

@ -6,13 +6,12 @@ from typing import Any, List
import attr
from huawei_lte_api.exceptions import ResponseErrorException
from homeassistant.components.notify import BaseNotificationService, ATTR_TARGET
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
from homeassistant.const import CONF_RECIPIENT, CONF_URL
from . import Router
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -6,11 +6,11 @@ from typing import Optional
import attr
from homeassistant.const import CONF_URL, STATE_UNKNOWN
from homeassistant.components.sensor import (
DEVICE_CLASS_SIGNAL_STRENGTH,
DOMAIN as SENSOR_DOMAIN,
)
from homeassistant.const import CONF_URL, STATE_UNKNOWN
from . import HuaweiLteBaseEntity
from .const import (
@ -22,7 +22,6 @@ from .const import (
UNIT_SECONDS,
)
_LOGGER = logging.getLogger(__name__)

View File

@ -11,10 +11,10 @@ from homeassistant.components.switch import (
SwitchDevice,
)
from homeassistant.const import CONF_URL
from . import HuaweiLteBaseEntity
from .const import DOMAIN, KEY_DIALUP_MOBILE_DATASWITCH
_LOGGER = logging.getLogger(__name__)

View File

@ -2,14 +2,13 @@
from huawei_lte_api.enums.client import ResponseCodeEnum
from huawei_lte_api.enums.user import LoginErrorEnum, LoginStateEnum, PasswordTypeEnum
from requests_mock import ANY
from requests.exceptions import ConnectionError
import pytest
from requests.exceptions import ConnectionError
from requests_mock import ANY
from homeassistant import data_entry_flow
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD, CONF_URL
from homeassistant.components.huawei_lte.const import DOMAIN
from homeassistant.components.huawei_lte.config_flow import ConfigFlowHandler
from homeassistant.components.huawei_lte.const import DOMAIN
from homeassistant.components.ssdp import (
ATTR_HOST,
ATTR_MANUFACTURER,
@ -24,10 +23,10 @@ from homeassistant.components.ssdp import (
ATTR_UDN,
ATTR_UPNP_DEVICE_TYPE,
)
from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME
from tests.common import MockConfigEntry
FIXTURE_USER_INPUT = {
CONF_URL: "http://192.168.1.1/",
CONF_USERNAME: "admin",