Auto-fix unused imports across tests + switch.py (ruff --fix)

12 unused-import warnings cleaned up by `ruff check --select=F,I --fix
--unsafe-fixes`. No behavioral changes; 94/94 tests still green.

Remaining lint warnings (line-length, complexity) are accumulated
upstream tech debt outside this change's scope.
This commit is contained in:
Casey 2026-05-16 15:12:19 +02:00
commit e59ccfa571
6 changed files with 33 additions and 40 deletions

View file

@ -28,7 +28,6 @@ from homeassistant.components.light import (
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_AREA_ID,
ATTR_DOMAIN,

View file

@ -3,6 +3,18 @@
from unittest.mock import Mock
import pytest
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_BRIGHTNESS_PCT,
ATTR_COLOR_TEMP_KELVIN,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_ON
from homeassistant.core import Context, State
from custom_components.adaptive_lighting.adaptation_utils import (
LightControlAttributes,
ServiceData,
@ -17,17 +29,6 @@ from custom_components.adaptive_lighting.adaptation_utils import (
manual_control_event_attribute_to_flags,
prepare_adaptation_data,
)
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_BRIGHTNESS_PCT,
ATTR_COLOR_TEMP_KELVIN,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_ON
from homeassistant.core import Context, State
@pytest.mark.parametrize(

View file

@ -11,12 +11,12 @@ import datetime as dt
from datetime import UTC, timedelta
import pytest
from custom_components.adaptive_lighting.color_and_brightness import (
SunLightSettings,
_tanh_day_curve,
)
HALF_WIDTH = 1800 # seconds — matches RAMP_HALF_WIDTH_SECONDS
# Fixed reference day: 2026-03-21 in UTC, sunrise 06:00, sunset 18:00.

View file

@ -5,10 +5,17 @@ Covers spec/options-flow/spec.md requirements R1, R2, R3, R5, R6, R7.
from __future__ import annotations
from typing import Any
from unittest.mock import patch
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_NAME
from homeassistant.data_entry_flow import FlowResultType
from homeassistant.helpers.selector import (
BooleanSelector,
EntitySelector,
NumberSelector,
NumberSelectorMode,
)
from pytest_homeassistant_custom_component.common import MockConfigEntry
import pytest
from custom_components.adaptive_lighting.config_flow import (
SECTION_ADVANCED,
SECTION_DAYTIME,
@ -39,18 +46,6 @@ from custom_components.adaptive_lighting.const import (
DEFAULT_SUNSET_ENTITY,
DOMAIN,
)
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_NAME
from homeassistant.data_entry_flow import FlowResultType
from homeassistant.helpers.selector import (
BooleanSelector,
EntitySelector,
NumberSelector,
NumberSelectorMode,
)
from pytest_homeassistant_custom_component.common import MockConfigEntry
EXPECTED_SECTIONS = (
SECTION_TARGETS,

View file

@ -2,14 +2,15 @@
from unittest.mock import AsyncMock
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.const import SERVICE_TURN_ON
from homeassistant.core import ServiceCall
from homeassistant.util.read_only_dict import ReadOnlyDict
from custom_components.adaptive_lighting.adaptation_utils import ServiceData
from custom_components.adaptive_lighting.hass_utils import (
setup_service_call_interceptor,
)
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.const import SERVICE_TURN_ON
from homeassistant.core import ServiceCall
from homeassistant.util.read_only_dict import ReadOnlyDict
async def test_setup_service_call_interceptor(hass):

View file

@ -7,20 +7,17 @@ from __future__ import annotations
import logging
import pytest
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_NAME
from homeassistant.helpers import entity_registry as er
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.adaptive_lighting.const import (
CONFIG_ENTRY_VERSION,
DEFAULT_NAME,
DOMAIN,
UNDO_UPDATE_LISTENER,
)
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_NAME
from homeassistant.exceptions import ConfigEntryError
from homeassistant.helpers import entity_registry as er
from pytest_homeassistant_custom_component.common import MockConfigEntry
# ---------------------------------------------------------------------------
# R8 — strict version break