Prefer from...import...as over import...as in core tests (#136146)
parent
0254be78d6
commit
364556a7dd
|
@ -89,12 +89,12 @@ from homeassistant.helpers.entity import Entity
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.json import JSONEncoder, _orjson_default_encoder, json_dumps
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import dt as dt_util, ulid as ulid_util
|
||||
from homeassistant.util.async_ import (
|
||||
_SHUTDOWN_RUN_CALLBACK_THREADSAFE,
|
||||
get_scheduled_timer_handles,
|
||||
run_callback_threadsafe,
|
||||
)
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.event_type import EventType
|
||||
from homeassistant.util.json import (
|
||||
JsonArrayType,
|
||||
|
@ -105,7 +105,6 @@ from homeassistant.util.json import (
|
|||
json_loads_object,
|
||||
)
|
||||
from homeassistant.util.signal_type import SignalType
|
||||
import homeassistant.util.ulid as ulid_util
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
from homeassistant.util.yaml import load_yaml_dict, loader as yaml_loader
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from homeassistant.const import (
|
|||
HTTP_BASIC_AUTHENTICATION,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.aiohttp_client as client
|
||||
from homeassistant.helpers import aiohttp_client as client
|
||||
from homeassistant.util.color import RGBColor
|
||||
from homeassistant.util.ssl import SSLCipherList
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ import voluptuous as vol
|
|||
from homeassistant.config import YAML_CONFIG_FILE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.check_config import (
|
||||
CheckConfigError,
|
||||
HomeAssistantConfig,
|
||||
async_check_ha_config_file,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.requirements import RequirementsNotFound
|
||||
|
||||
from tests.common import (
|
||||
|
|
|
@ -30,7 +30,7 @@ from homeassistant.helpers import (
|
|||
)
|
||||
from homeassistant.helpers.template import Template
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.typing import WebSocketGenerator
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ from homeassistant.helpers.entity_component import EntityComponent, async_update
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
|
|
|
@ -38,7 +38,7 @@ from homeassistant.helpers.entity_component import (
|
|||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
|
|
|
@ -13,8 +13,8 @@ from freezegun.api import FrozenDateTimeFactory
|
|||
import jinja2
|
||||
import pytest
|
||||
|
||||
from homeassistant import core as ha
|
||||
from homeassistant.const import MATCH_ALL
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.core import (
|
||||
Event,
|
||||
EventStateChangedData,
|
||||
|
@ -52,7 +52,7 @@ from homeassistant.helpers.event import (
|
|||
)
|
||||
from homeassistant.helpers.template import Template, result_as_boolean
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed, async_fire_time_changed_exact
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import pytest
|
|||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.httpx_client as client
|
||||
from homeassistant.helpers import httpx_client as client
|
||||
|
||||
from tests.common import MockModule, extract_stack_to_frame, mock_integration
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ from homeassistant.helpers import (
|
|||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.typing import UNDEFINED
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
|
|
|
@ -36,11 +36,11 @@ from homeassistant.core import (
|
|||
)
|
||||
from homeassistant.helpers import (
|
||||
area_registry as ar,
|
||||
config_validation as cv,
|
||||
device_registry as dr,
|
||||
entity_registry as er,
|
||||
service,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.loader import async_get_integration
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.yaml.loader import parse_yaml
|
||||
|
|
|
@ -10,7 +10,7 @@ import pytest
|
|||
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import sun
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
||||
def test_next_events(hass: HomeAssistant) -> None:
|
||||
|
|
|
@ -50,7 +50,7 @@ from homeassistant.helpers.entity_platform import EntityPlatform
|
|||
from homeassistant.helpers.json import json_dumps
|
||||
from homeassistant.helpers.typing import TemplateVarsType
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.read_only_dict import ReadOnlyDict
|
||||
from homeassistant.util.unit_system import UnitSystem
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ from unittest.mock import AsyncMock, Mock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant import bootstrap, loader, runner
|
||||
import homeassistant.config as config_util
|
||||
from homeassistant import bootstrap, config as config_util, loader, runner
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
BASE_PLATFORMS,
|
||||
|
|
|
@ -15,8 +15,7 @@ from syrupy.assertion import SnapshotAssertion
|
|||
import voluptuous as vol
|
||||
import yaml
|
||||
|
||||
from homeassistant import loader
|
||||
import homeassistant.config as config_util
|
||||
from homeassistant import config as config_util, loader
|
||||
from homeassistant.const import CONF_PACKAGES, __version__
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.exceptions import ConfigValidationError, HomeAssistantError
|
||||
|
|
|
@ -45,8 +45,8 @@ from homeassistant.helpers.service_info.hassio import HassioServiceInfo
|
|||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
from homeassistant.setup import async_set_domains_to_be_loaded, async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.json import json_loads
|
||||
|
||||
from .common import (
|
||||
|
|
|
@ -20,6 +20,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import core as ha
|
||||
from homeassistant.const import (
|
||||
ATTR_FRIENDLY_NAME,
|
||||
EVENT_CALL_SERVICE,
|
||||
|
@ -35,7 +36,6 @@ from homeassistant.const import (
|
|||
EVENT_STATE_REPORTED,
|
||||
MATCH_ALL,
|
||||
)
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
HassJob,
|
||||
|
@ -59,8 +59,8 @@ from homeassistant.exceptions import (
|
|||
)
|
||||
from homeassistant.helpers.json import json_dumps
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.async_ import create_eager_task
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.read_only_dict import ReadOnlyDict
|
||||
|
||||
from .common import (
|
||||
|
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
from syrupy.assertion import SnapshotAssertion
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.util.color as color_util
|
||||
from homeassistant.util import color as color_util
|
||||
|
||||
GAMUT = color_util.GamutType(
|
||||
color_util.XYPoint(0.704, 0.296),
|
||||
|
|
|
@ -6,7 +6,7 @@ from datetime import UTC, datetime, timedelta
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
DEFAULT_TIME_ZONE = dt_util.get_default_time_zone()
|
||||
TEST_TIME_ZONE = "America/Los_Angeles"
|
||||
|
|
|
@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import util
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
||||
def test_raise_if_invalid_filename() -> None:
|
||||
|
|
|
@ -7,7 +7,7 @@ import pytest
|
|||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.util.location as location_util
|
||||
from homeassistant.util import location as location_util
|
||||
|
||||
from tests.common import load_fixture
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.core import (
|
|||
is_callback,
|
||||
is_callback_check_partial,
|
||||
)
|
||||
import homeassistant.util.logging as logging_util
|
||||
from homeassistant.util import logging as logging_util
|
||||
|
||||
|
||||
async def test_logging_with_queue_handler() -> None:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from ipaddress import ip_address
|
||||
|
||||
import homeassistant.util.network as network_util
|
||||
from homeassistant.util import network as network_util
|
||||
|
||||
|
||||
def test_is_loopback() -> None:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import homeassistant.util.ulid as ulid_util
|
||||
from homeassistant.util import ulid as ulid_util
|
||||
|
||||
|
||||
async def test_ulid_util_uuid_hex() -> None:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import homeassistant.util.uuid as uuid_util
|
||||
from homeassistant.util import uuid as uuid_util
|
||||
|
||||
|
||||
async def test_uuid_util_random_uuid_hex() -> None:
|
||||
|
|
Loading…
Reference in New Issue