Sort imports according to PEP8 for components starting with "O" (#29774)

This commit is contained in:
Bas Nijholt 2019-12-09 14:26:53 +01:00 committed by Franck Nijhof
parent c49e423c78
commit 5cdaff5405
16 changed files with 72 additions and 74 deletions

View file

@ -1,10 +1,9 @@
"""Support for Obihai Sensors.""" """Support for Obihai Sensors."""
from datetime import timedelta
import logging import logging
from datetime import timedelta
import voluptuous as vol
from pyobihai import PyObihai from pyobihai import PyObihai
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
@ -13,10 +12,8 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
DEVICE_CLASS_TIMESTAMP, DEVICE_CLASS_TIMESTAMP,
) )
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -2,23 +2,23 @@
import logging import logging
import time import time
from aiohttp.hdrs import CONTENT_TYPE
import requests import requests
import voluptuous as vol import voluptuous as vol
from aiohttp.hdrs import CONTENT_TYPE
from homeassistant.components.discovery import SERVICE_OCTOPRINT from homeassistant.components.discovery import SERVICE_OCTOPRINT
from homeassistant.const import ( from homeassistant.const import (
CONF_API_KEY, CONF_API_KEY,
CONF_BINARY_SENSORS,
CONF_HOST, CONF_HOST,
CONTENT_TYPE_JSON, CONF_MONITORED_CONDITIONS,
CONF_NAME, CONF_NAME,
CONF_PATH, CONF_PATH,
CONF_PORT, CONF_PORT,
CONF_SSL,
TEMP_CELSIUS,
CONF_MONITORED_CONDITIONS,
CONF_SENSORS, CONF_SENSORS,
CONF_BINARY_SENSORS, CONF_SSL,
CONTENT_TYPE_JSON,
TEMP_CELSIUS,
) )
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View file

@ -1,15 +1,15 @@
"""Support for 1-Wire environment sensors.""" """Support for 1-Wire environment sensors."""
from glob import glob
import logging
import os import os
import time import time
import logging
from glob import glob
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import TEMP_CELSIUS
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
from homeassistant.const import TEMP_CELSIUS
from homeassistant.components.sensor import PLATFORM_SCHEMA
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -2,12 +2,13 @@
import logging import logging
from typing import List from typing import List
import voluptuous as vol
import eiscp import eiscp
from eiscp import eISCP from eiscp import eISCP
import voluptuous as vol
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player.const import ( from homeassistant.components.media_player.const import (
DOMAIN,
SUPPORT_PLAY, SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA, SUPPORT_PLAY_MEDIA,
SUPPORT_SELECT_SOURCE, SUPPORT_SELECT_SOURCE,
@ -16,14 +17,13 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP, SUPPORT_VOLUME_STEP,
DOMAIN,
) )
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_HOST, CONF_HOST,
CONF_NAME, CONF_NAME,
STATE_OFF, STATE_OFF,
STATE_ON, STATE_ON,
ATTR_ENTITY_ID,
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View file

@ -1,26 +1,26 @@
"""Component that will help set the OpenALPR cloud for ALPR processing.""" """Component that will help set the OpenALPR cloud for ALPR processing."""
import asyncio import asyncio
import logging
from base64 import b64encode from base64 import b64encode
import logging
import aiohttp import aiohttp
import async_timeout import async_timeout
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.core import split_entity_id
from homeassistant.const import CONF_API_KEY
from homeassistant.components.image_processing import ( from homeassistant.components.image_processing import (
PLATFORM_SCHEMA,
CONF_CONFIDENCE, CONF_CONFIDENCE,
CONF_SOURCE,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_NAME, CONF_NAME,
CONF_SOURCE,
PLATFORM_SCHEMA,
) )
from homeassistant.components.openalpr_local.image_processing import ( from homeassistant.components.openalpr_local.image_processing import (
ImageProcessingAlprEntity, ImageProcessingAlprEntity,
) )
from homeassistant.const import CONF_API_KEY
from homeassistant.core import split_entity_id
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -6,19 +6,19 @@ import re
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.core import split_entity_id, callback
from homeassistant.const import CONF_REGION
from homeassistant.components.image_processing import ( from homeassistant.components.image_processing import (
PLATFORM_SCHEMA, ATTR_CONFIDENCE,
ImageProcessingEntity, ATTR_ENTITY_ID,
CONF_CONFIDENCE, CONF_CONFIDENCE,
CONF_SOURCE,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_NAME, CONF_NAME,
ATTR_ENTITY_ID, CONF_SOURCE,
ATTR_CONFIDENCE, PLATFORM_SCHEMA,
ImageProcessingEntity,
) )
from homeassistant.const import CONF_REGION
from homeassistant.core import callback, split_entity_id
import homeassistant.helpers.config_validation as cv
from homeassistant.util.async_ import run_callback_threadsafe from homeassistant.util.async_ import run_callback_threadsafe
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -7,11 +7,11 @@ import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
CONF_API_KEY,
CONF_NAME,
CONF_BASE,
CONF_QUOTE,
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
CONF_API_KEY,
CONF_BASE,
CONF_NAME,
CONF_QUOTE,
) )
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

View file

@ -5,22 +5,22 @@ import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.cover import ( from homeassistant.components.cover import (
CoverDevice,
DEVICE_CLASS_GARAGE, DEVICE_CLASS_GARAGE,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
SUPPORT_OPEN,
SUPPORT_CLOSE, SUPPORT_CLOSE,
SUPPORT_OPEN,
CoverDevice,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_NAME,
STATE_CLOSED,
STATE_OPEN,
CONF_COVERS, CONF_COVERS,
CONF_HOST, CONF_HOST,
CONF_NAME,
CONF_PORT, CONF_PORT,
CONF_SSL, CONF_SSL,
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
STATE_CLOSED,
STATE_CLOSING, STATE_CLOSING,
STATE_OPEN,
STATE_OPENING, STATE_OPENING,
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View file

@ -1,26 +1,25 @@
"""Sensor for the Open Sky Network.""" """Sensor for the Open Sky Network."""
import logging
from datetime import timedelta from datetime import timedelta
import logging
import requests import requests
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
CONF_NAME,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_RADIUS,
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
ATTR_LATITUDE, ATTR_LATITUDE,
ATTR_LONGITUDE, ATTR_LONGITUDE,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
CONF_RADIUS,
LENGTH_KILOMETERS, LENGTH_KILOMETERS,
LENGTH_METERS, LENGTH_METERS,
) )
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.util import distance as util_distance from homeassistant.util import distance as util_distance, location as util_location
from homeassistant.util import location as util_location
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -2,14 +2,12 @@
from datetime import timedelta from datetime import timedelta
import logging import logging
from oru import Meter, MeterError
import voluptuous as vol import voluptuous as vol
from oru import Meter
from oru import MeterError
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.const import ENERGY_KILO_WATT_HOUR from homeassistant.const import ENERGY_KILO_WATT_HOUR
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -1,13 +1,13 @@
"""Tests for the init.""" """Tests for the init."""
from unittest.mock import patch, Mock from unittest.mock import Mock, patch
from homeassistant.setup import async_setup_component
from homeassistant.components import onboarding from homeassistant.components import onboarding
from homeassistant.setup import async_setup_component
from tests.common import mock_coro, MockUser
from . import mock_storage from . import mock_storage
from tests.common import MockUser, mock_coro
# Temporarily: if auth not active, always set onboarded=True # Temporarily: if auth not active, always set onboarded=True

View file

@ -4,15 +4,15 @@ from unittest.mock import patch
import pytest import pytest
from homeassistant.setup import async_setup_component
from homeassistant.components import onboarding from homeassistant.components import onboarding
from homeassistant.components.onboarding import const, views from homeassistant.components.onboarding import const, views
from homeassistant.setup import async_setup_component
from . import mock_storage
from tests.common import CLIENT_ID, register_auth_provider from tests.common import CLIENT_ID, register_auth_provider
from tests.components.met.conftest import mock_weather # noqa: F401 from tests.components.met.conftest import mock_weather # noqa: F401
from . import mock_storage
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def always_mock_weather(mock_weather): # noqa: F811 def always_mock_weather(mock_weather): # noqa: F811

View file

@ -1,15 +1,15 @@
"""The tests for the openalpr cloud platform.""" """The tests for the openalpr cloud platform."""
import asyncio import asyncio
from unittest.mock import patch, PropertyMock from unittest.mock import PropertyMock, patch
from homeassistant.core import callback
from homeassistant.setup import setup_component
from homeassistant.components import camera, image_processing as ip from homeassistant.components import camera, image_processing as ip
from homeassistant.components.openalpr_cloud.image_processing import OPENALPR_API_URL from homeassistant.components.openalpr_cloud.image_processing import OPENALPR_API_URL
from homeassistant.core import callback
from homeassistant.setup import setup_component
from tests.common import ( from tests.common import (
get_test_home_assistant,
assert_setup_component, assert_setup_component,
get_test_home_assistant,
load_fixture, load_fixture,
mock_coro, mock_coro,
) )

View file

@ -1,13 +1,13 @@
"""The tests for the openalpr local platform.""" """The tests for the openalpr local platform."""
import asyncio import asyncio
from unittest.mock import patch, PropertyMock, MagicMock from unittest.mock import MagicMock, PropertyMock, patch
from homeassistant.core import callback
from homeassistant.const import ATTR_ENTITY_PICTURE
from homeassistant.setup import setup_component
import homeassistant.components.image_processing as ip import homeassistant.components.image_processing as ip
from homeassistant.const import ATTR_ENTITY_PICTURE
from homeassistant.core import callback
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant, assert_setup_component, load_fixture from tests.common import assert_setup_component, get_test_home_assistant, load_fixture
from tests.components.image_processing import common from tests.components.image_processing import common

View file

@ -1,8 +1,11 @@
"""The tests for the Open Hardware Monitor platform.""" """The tests for the Open Hardware Monitor platform."""
import unittest import unittest
import requests_mock import requests_mock
from homeassistant.setup import setup_component from homeassistant.setup import setup_component
from tests.common import load_fixture, get_test_home_assistant
from tests.common import get_test_home_assistant, load_fixture
class TestOpenHardwareMonitorSetup(unittest.TestCase): class TestOpenHardwareMonitorSetup(unittest.TestCase):

View file

@ -1,8 +1,9 @@
"""Define tests for the OpenUV config flow.""" """Define tests for the OpenUV config flow."""
import pytest
from pyopenuv.errors import OpenUvError
from unittest.mock import patch from unittest.mock import patch
from pyopenuv.errors import OpenUvError
import pytest
from homeassistant import data_entry_flow from homeassistant import data_entry_flow
from homeassistant.components.openuv import DOMAIN, config_flow from homeassistant.components.openuv import DOMAIN, config_flow
from homeassistant.const import ( from homeassistant.const import (