mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Clean up unneeded ruff noqa directives (#113616)
This commit is contained in:
parent
c57dcacade
commit
6ee273a548
@ -19,7 +19,7 @@ async def async_call_shell_with_timeout(
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
_LOGGER.debug("Running command: %s", command)
|
_LOGGER.debug("Running command: %s", command)
|
||||||
proc = await asyncio.create_subprocess_shell( # noqa: S602 # shell by design
|
proc = await asyncio.create_subprocess_shell( # shell by design
|
||||||
command,
|
command,
|
||||||
close_fds=False, # required for posix_spawn
|
close_fds=False, # required for posix_spawn
|
||||||
)
|
)
|
||||||
@ -43,7 +43,7 @@ async def async_call_shell_with_timeout(
|
|||||||
async def async_check_output_or_log(command: str, timeout: int) -> str | None:
|
async def async_check_output_or_log(command: str, timeout: int) -> str | None:
|
||||||
"""Run a shell command with a timeout and return the output."""
|
"""Run a shell command with a timeout and return the output."""
|
||||||
try:
|
try:
|
||||||
proc = await asyncio.create_subprocess_shell( # noqa: S602 # shell by design
|
proc = await asyncio.create_subprocess_shell( # shell by design
|
||||||
command,
|
command,
|
||||||
close_fds=False, # required for posix_spawn
|
close_fds=False, # required for posix_spawn
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
|
@ -49,9 +49,7 @@ from .const import (
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry( # noqa: C901
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
hass: HomeAssistant, entry: ConfigEntry
|
|
||||||
) -> bool:
|
|
||||||
"""Set up devolo Home Network from a config entry."""
|
"""Set up devolo Home Network from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
zeroconf_instance = await zeroconf.async_get_async_instance(hass)
|
zeroconf_instance = await zeroconf.async_get_async_instance(hass)
|
||||||
|
@ -347,7 +347,7 @@ class RuntimeEntryData:
|
|||||||
and subscription_key not in stale_state
|
and subscription_key not in stale_state
|
||||||
and state_type is not CameraState
|
and state_type is not CameraState
|
||||||
and not (
|
and not (
|
||||||
state_type is SensorState # noqa: E721
|
state_type is SensorState
|
||||||
and (platform_info := self.info.get(SensorInfo))
|
and (platform_info := self.info.get(SensorInfo))
|
||||||
and (entity_info := platform_info.get(state.key))
|
and (entity_info := platform_info.get(state.key))
|
||||||
and (cast(SensorInfo, entity_info)).force_update
|
and (cast(SensorInfo, entity_info)).force_update
|
||||||
|
@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any, Self, final
|
|||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.config_validation import ( # noqa: F401
|
from homeassistant.helpers.config_validation import (
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
@ -29,7 +29,7 @@ from .const import ( # noqa: F401
|
|||||||
DEFAULT_EXPOSE_BY_DEFAULT,
|
DEFAULT_EXPOSE_BY_DEFAULT,
|
||||||
DEFAULT_EXPOSED_DOMAINS,
|
DEFAULT_EXPOSED_DOMAINS,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
EVENT_QUERY_RECEIVED, # noqa: F401
|
EVENT_QUERY_RECEIVED,
|
||||||
SERVICE_REQUEST_SYNC,
|
SERVICE_REQUEST_SYNC,
|
||||||
SOURCE_CLOUD,
|
SOURCE_CLOUD,
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@ from .const import ( # noqa: F401
|
|||||||
ATTR_ORDER,
|
ATTR_ORDER,
|
||||||
ATTR_REMOVE_ENTITIES,
|
ATTR_REMOVE_ENTITIES,
|
||||||
CONF_HIDE_MEMBERS,
|
CONF_HIDE_MEMBERS,
|
||||||
DOMAIN, # noqa: F401
|
DOMAIN,
|
||||||
GROUP_ORDER,
|
GROUP_ORDER,
|
||||||
REG_KEY,
|
REG_KEY,
|
||||||
)
|
)
|
||||||
|
@ -25,13 +25,7 @@ from homeassistant.helpers.event import (
|
|||||||
async_track_state_change_event,
|
async_track_state_change_event,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .const import (
|
from .const import ATTR_AUTO, ATTR_ORDER, DOMAIN, GROUP_ORDER, REG_KEY
|
||||||
ATTR_AUTO,
|
|
||||||
ATTR_ORDER,
|
|
||||||
DOMAIN, # noqa: F401
|
|
||||||
GROUP_ORDER,
|
|
||||||
REG_KEY,
|
|
||||||
)
|
|
||||||
from .registry import GroupIntegrationRegistry
|
from .registry import GroupIntegrationRegistry
|
||||||
|
|
||||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||||
|
@ -83,14 +83,14 @@ from .const import (
|
|||||||
from .data import (
|
from .data import (
|
||||||
HassioDataUpdateCoordinator,
|
HassioDataUpdateCoordinator,
|
||||||
get_addons_changelogs, # noqa: F401
|
get_addons_changelogs, # noqa: F401
|
||||||
get_addons_info, # noqa: F401
|
get_addons_info,
|
||||||
get_addons_stats, # noqa: F401
|
get_addons_stats, # noqa: F401
|
||||||
get_core_info, # noqa: F401
|
get_core_info, # noqa: F401
|
||||||
get_core_stats, # noqa: F401
|
get_core_stats, # noqa: F401
|
||||||
get_host_info, # noqa: F401
|
get_host_info, # noqa: F401
|
||||||
get_info, # noqa: F401
|
get_info, # noqa: F401
|
||||||
get_issues_info, # noqa: F401
|
get_issues_info, # noqa: F401
|
||||||
get_os_info, # noqa: F401
|
get_os_info,
|
||||||
get_store, # noqa: F401
|
get_store, # noqa: F401
|
||||||
get_supervisor_info, # noqa: F401
|
get_supervisor_info, # noqa: F401
|
||||||
get_supervisor_stats, # noqa: F401
|
get_supervisor_stats, # noqa: F401
|
||||||
|
@ -46,7 +46,7 @@ WS_NO_ADMIN_ENDPOINTS = re.compile(
|
|||||||
r"^(?:"
|
r"^(?:"
|
||||||
r"|/ingress/(session|validate_session)"
|
r"|/ingress/(session|validate_session)"
|
||||||
r"|/addons/[^/]+/info"
|
r"|/addons/[^/]+/info"
|
||||||
r")$" # noqa: ISC001
|
r")$"
|
||||||
)
|
)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
@ -56,9 +56,7 @@ PLATFORMS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry( # noqa: C901
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
hass: HomeAssistant, entry: ConfigEntry
|
|
||||||
) -> bool:
|
|
||||||
"""Set up Aqualink from a config entry."""
|
"""Set up Aqualink from a config entry."""
|
||||||
username = entry.data[CONF_USERNAME]
|
username = entry.data[CONF_USERNAME]
|
||||||
password = entry.data[CONF_PASSWORD]
|
password = entry.data[CONF_PASSWORD]
|
||||||
|
@ -33,7 +33,7 @@ from homeassistant.helpers.event import (
|
|||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType
|
from homeassistant.helpers.typing import UNDEFINED, ConfigType, UndefinedType
|
||||||
|
|
||||||
from .const import DOMAIN, IMAGE_TIMEOUT # noqa: F401
|
from .const import DOMAIN, IMAGE_TIMEOUT
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
@ -551,7 +551,7 @@ class InfluxThread(threading.Thread):
|
|||||||
|
|
||||||
if item is None:
|
if item is None:
|
||||||
self.shutdown = True
|
self.shutdown = True
|
||||||
elif type(item) is tuple: # noqa: E721
|
elif type(item) is tuple:
|
||||||
timestamp, event = item
|
timestamp, event = item
|
||||||
age = time.monotonic() - timestamp
|
age = time.monotonic() - timestamp
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ def async_get_entities(hass: HomeAssistant) -> dict[str, Entity]:
|
|||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_setup_services(hass: HomeAssistant) -> None: # noqa: C901
|
def async_setup_services(hass: HomeAssistant) -> None:
|
||||||
"""Create and register services for the ISY integration."""
|
"""Create and register services for the ISY integration."""
|
||||||
existing_services = hass.services.async_services_for_domain(DOMAIN)
|
existing_services = hass.services.async_services_for_domain(DOMAIN)
|
||||||
if existing_services and SERVICE_SEND_PROGRAM_COMMAND in existing_services:
|
if existing_services and SERVICE_SEND_PROGRAM_COMMAND in existing_services:
|
||||||
|
@ -10,7 +10,7 @@ class JuiceNetApi:
|
|||||||
self._devices = []
|
self._devices = []
|
||||||
|
|
||||||
async def setup(self):
|
async def setup(self):
|
||||||
"""JuiceNet device setup.""" # noqa: D403
|
"""JuiceNet device setup."""
|
||||||
self._devices = await self.api.get_devices()
|
self._devices = await self.api.get_devices()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -51,7 +51,7 @@ class LazyEventPartialState:
|
|||||||
self._event_data_cache = event_data_cache
|
self._event_data_cache = event_data_cache
|
||||||
# We need to explicitly check for the row is EventAsRow as the unhappy path
|
# We need to explicitly check for the row is EventAsRow as the unhappy path
|
||||||
# to fetch row.data for Row is very expensive
|
# to fetch row.data for Row is very expensive
|
||||||
if type(row) is EventAsRow: # noqa: E721
|
if type(row) is EventAsRow:
|
||||||
# If its an EventAsRow we can avoid the whole
|
# If its an EventAsRow we can avoid the whole
|
||||||
# json decode process as we already have the data
|
# json decode process as we already have the data
|
||||||
self.data = row.data
|
self.data = row.data
|
||||||
|
@ -428,7 +428,7 @@ class EventCache:
|
|||||||
|
|
||||||
def get(self, row: EventAsRow | Row) -> LazyEventPartialState:
|
def get(self, row: EventAsRow | Row) -> LazyEventPartialState:
|
||||||
"""Get the event from the row."""
|
"""Get the event from the row."""
|
||||||
if type(row) is EventAsRow: # noqa: E721 - this is never subclassed
|
if type(row) is EventAsRow: # - this is never subclassed
|
||||||
return LazyEventPartialState(row, self._event_data_cache)
|
return LazyEventPartialState(row, self._event_data_cache)
|
||||||
if event := self.event_cache.get(row):
|
if event := self.event_cache.get(row):
|
||||||
return event
|
return event
|
||||||
|
@ -105,7 +105,7 @@ class MatterEventEntity(MatterEntity, EventEntity):
|
|||||||
"""Call when Node attribute(s) changed."""
|
"""Call when Node attribute(s) changed."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _on_matter_node_event( # noqa: F821
|
def _on_matter_node_event(
|
||||||
self,
|
self,
|
||||||
event: EventType,
|
event: EventType,
|
||||||
data: MatterNodeEvent,
|
data: MatterNodeEvent,
|
||||||
|
@ -51,7 +51,7 @@ from homeassistant.core import HomeAssistant
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import ( # noqa: F401
|
from .const import (
|
||||||
CALL_TYPE_COIL,
|
CALL_TYPE_COIL,
|
||||||
CALL_TYPE_DISCRETE,
|
CALL_TYPE_DISCRETE,
|
||||||
CALL_TYPE_REGISTER_HOLDING,
|
CALL_TYPE_REGISTER_HOLDING,
|
||||||
|
@ -456,7 +456,7 @@ class MqttTemperatureControlEntity(MqttEntity, ABC):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
_LOGGER.error("Could not parse %s from %s", template_name, payload)
|
_LOGGER.error("Could not parse %s from %s", template_name, payload)
|
||||||
|
|
||||||
def prepare_subscribe_topics( # noqa: C901
|
def prepare_subscribe_topics(
|
||||||
self,
|
self,
|
||||||
topics: dict[str, dict[str, Any]],
|
topics: dict[str, dict[str, Any]],
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -714,7 +714,7 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity):
|
|||||||
|
|
||||||
self._attr_supported_features = support
|
self._attr_supported_features = support
|
||||||
|
|
||||||
def _prepare_subscribe_topics(self) -> None: # noqa: C901
|
def _prepare_subscribe_topics(self) -> None:
|
||||||
"""(Re)Subscribe to topics."""
|
"""(Re)Subscribe to topics."""
|
||||||
topics: dict[str, dict[str, Any]] = {}
|
topics: dict[str, dict[str, Any]] = {}
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ class Recorder(threading.Thread):
|
|||||||
for task_or_event in startup_task_or_events:
|
for task_or_event in startup_task_or_events:
|
||||||
# Event is never subclassed so we can
|
# Event is never subclassed so we can
|
||||||
# use a fast type check
|
# use a fast type check
|
||||||
if type(task_or_event) is Event: # noqa: E721
|
if type(task_or_event) is Event:
|
||||||
event_ = task_or_event
|
event_ = task_or_event
|
||||||
if event_.event_type == EVENT_STATE_CHANGED:
|
if event_.event_type == EVENT_STATE_CHANGED:
|
||||||
state_change_events.append(event_)
|
state_change_events.append(event_)
|
||||||
@ -918,7 +918,7 @@ class Recorder(threading.Thread):
|
|||||||
# is an Event so we can process it directly
|
# is an Event so we can process it directly
|
||||||
# and since its never subclassed, we can
|
# and since its never subclassed, we can
|
||||||
# use a fast type check
|
# use a fast type check
|
||||||
if type(task) is Event: # noqa: E721
|
if type(task) is Event:
|
||||||
self._process_one_event(task)
|
self._process_one_event(task)
|
||||||
return
|
return
|
||||||
# If its not an event, commit everything
|
# If its not an event, commit everything
|
||||||
|
@ -758,7 +758,7 @@ def _sorted_states_to_dict(
|
|||||||
_utc_from_timestamp = dt_util.utc_from_timestamp
|
_utc_from_timestamp = dt_util.utc_from_timestamp
|
||||||
ent_results.extend(
|
ent_results.extend(
|
||||||
{
|
{
|
||||||
attr_state: (prev_state := state), # noqa: F841
|
attr_state: (prev_state := state),
|
||||||
attr_time: _utc_from_timestamp(row[last_updated_ts_idx]).isoformat(),
|
attr_time: _utc_from_timestamp(row[last_updated_ts_idx]).isoformat(),
|
||||||
}
|
}
|
||||||
for row in group
|
for row in group
|
||||||
|
@ -2039,7 +2039,7 @@ def _fast_build_sum_list(
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def _sorted_statistics_to_dict( # noqa: C901
|
def _sorted_statistics_to_dict(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
session: Session,
|
session: Session,
|
||||||
stats: Sequence[Row[Any]],
|
stats: Sequence[Row[Any]],
|
||||||
|
@ -494,7 +494,7 @@ async def async_setup_platform(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry( # noqa: C901
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up System Montor sensors based on a config entry."""
|
"""Set up System Montor sensors based on a config entry."""
|
||||||
|
@ -36,12 +36,7 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
from . import group as group_pre_import # noqa: F401
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import STATE_CLEANING, STATE_DOCKED, STATE_ERROR, STATE_RETURNING
|
||||||
STATE_CLEANING,
|
|
||||||
STATE_DOCKED,
|
|
||||||
STATE_ERROR,
|
|
||||||
STATE_RETURNING,
|
|
||||||
)
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
@ -62,7 +62,7 @@ from homeassistant.util.json import JsonValueType
|
|||||||
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
||||||
|
|
||||||
from . import group as group_pre_import # noqa: F401
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import (
|
||||||
ATTR_WEATHER_APPARENT_TEMPERATURE,
|
ATTR_WEATHER_APPARENT_TEMPERATURE,
|
||||||
ATTR_WEATHER_CLOUD_COVERAGE,
|
ATTR_WEATHER_CLOUD_COVERAGE,
|
||||||
ATTR_WEATHER_DEW_POINT,
|
ATTR_WEATHER_DEW_POINT,
|
||||||
@ -675,7 +675,7 @@ class WeatherEntity(Entity, PostInit, cached_properties=CACHED_PROPERTIES_WITH_A
|
|||||||
|
|
||||||
@final
|
@final
|
||||||
@property
|
@property
|
||||||
def state_attributes(self) -> dict[str, Any]: # noqa: C901
|
def state_attributes(self) -> dict[str, Any]:
|
||||||
"""Return the state attributes, converted.
|
"""Return the state attributes, converted.
|
||||||
|
|
||||||
Attributes are configured from native units to user-configured units.
|
Attributes are configured from native units to user-configured units.
|
||||||
|
@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Final
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .connection import ActiveConnection # noqa: F401
|
from .connection import ActiveConnection
|
||||||
|
|
||||||
|
|
||||||
WebSocketCommandHandler = Callable[
|
WebSocketCommandHandler = Callable[
|
||||||
|
@ -36,7 +36,7 @@ from .models import async_wemo_data
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Literal values must match options.error keys from strings.json.
|
# Literal values must match options.error keys from strings.json.
|
||||||
ErrorStringKey = Literal["long_press_requires_subscription"] # noqa: F821
|
ErrorStringKey = Literal["long_press_requires_subscription"]
|
||||||
# Literal values must match options.step.init.data keys from strings.json.
|
# Literal values must match options.step.init.data keys from strings.json.
|
||||||
OptionsFieldKey = Literal["enable_subscription", "enable_long_press"]
|
OptionsFieldKey = Literal["enable_subscription", "enable_long_press"]
|
||||||
|
|
||||||
|
@ -1434,7 +1434,7 @@ def extract_domain_configs(config: ConfigType, domain: str) -> Sequence[str]:
|
|||||||
return domain_configs
|
return domain_configs
|
||||||
|
|
||||||
|
|
||||||
async def async_process_component_config( # noqa: C901
|
async def async_process_component_config(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config: ConfigType,
|
config: ConfigType,
|
||||||
integration: Integration,
|
integration: Integration,
|
||||||
|
@ -1136,7 +1136,7 @@ class HomeAssistant:
|
|||||||
if (
|
if (
|
||||||
not handle.cancelled()
|
not handle.cancelled()
|
||||||
and (args := handle._args) # pylint: disable=protected-access
|
and (args := handle._args) # pylint: disable=protected-access
|
||||||
and type(job := args[0]) is HassJob # noqa: E721
|
and type(job := args[0]) is HassJob
|
||||||
and job.cancel_on_shutdown
|
and job.cancel_on_shutdown
|
||||||
):
|
):
|
||||||
handle.cancel()
|
handle.cancel()
|
||||||
@ -1595,7 +1595,7 @@ class State:
|
|||||||
# State only creates and expects a ReadOnlyDict so
|
# State only creates and expects a ReadOnlyDict so
|
||||||
# there is no need to check for subclassing with
|
# there is no need to check for subclassing with
|
||||||
# isinstance here so we can use the faster type check.
|
# isinstance here so we can use the faster type check.
|
||||||
if type(attributes) is not ReadOnlyDict: # noqa: E721
|
if type(attributes) is not ReadOnlyDict:
|
||||||
self.attributes = ReadOnlyDict(attributes or {})
|
self.attributes = ReadOnlyDict(attributes or {})
|
||||||
else:
|
else:
|
||||||
self.attributes = attributes
|
self.attributes = attributes
|
||||||
|
@ -362,7 +362,7 @@ def numeric_state(
|
|||||||
).result()
|
).result()
|
||||||
|
|
||||||
|
|
||||||
def async_numeric_state( # noqa: C901
|
def async_numeric_state(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity: None | str | State,
|
entity: None | str | State,
|
||||||
below: float | str | None = None,
|
below: float | str | None = None,
|
||||||
|
@ -625,7 +625,7 @@ def string(value: Any) -> str:
|
|||||||
# This is expected to be the most common case, so check it first.
|
# This is expected to be the most common case, so check it first.
|
||||||
if (
|
if (
|
||||||
type(value) is str # noqa: E721
|
type(value) is str # noqa: E721
|
||||||
or type(value) is NodeStrClass # noqa: E721
|
or type(value) is NodeStrClass
|
||||||
or isinstance(value, str)
|
or isinstance(value, str)
|
||||||
):
|
):
|
||||||
return value
|
return value
|
||||||
|
@ -278,7 +278,7 @@ def check_if_deprecated_constant(name: str, module_globals: dict[str, Any]) -> A
|
|||||||
# specifies that __getattr__ should raise AttributeError if the attribute is not
|
# specifies that __getattr__ should raise AttributeError if the attribute is not
|
||||||
# found.
|
# found.
|
||||||
# https://peps.python.org/pep-0562/#specification
|
# https://peps.python.org/pep-0562/#specification
|
||||||
raise AttributeError(msg) # noqa: TRY004
|
raise AttributeError(msg)
|
||||||
|
|
||||||
_print_deprecation_warning_internal(
|
_print_deprecation_warning_internal(
|
||||||
name,
|
name,
|
||||||
|
@ -656,7 +656,7 @@ async def async_get_all_descriptions(
|
|||||||
ints_or_excs = await async_get_integrations(hass, domains_with_missing_services)
|
ints_or_excs = await async_get_integrations(hass, domains_with_missing_services)
|
||||||
integrations: list[Integration] = []
|
integrations: list[Integration] = []
|
||||||
for domain, int_or_exc in ints_or_excs.items():
|
for domain, int_or_exc in ints_or_excs.items():
|
||||||
if type(int_or_exc) is Integration and int_or_exc.has_services: # noqa: E721
|
if type(int_or_exc) is Integration and int_or_exc.has_services:
|
||||||
integrations.append(int_or_exc)
|
integrations.append(int_or_exc)
|
||||||
continue
|
continue
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -1299,7 +1299,7 @@ def async_get_loaded_integration(hass: HomeAssistant, domain: str) -> Integratio
|
|||||||
cache = cast(dict[str, Integration | asyncio.Future[None]], cache)
|
cache = cast(dict[str, Integration | asyncio.Future[None]], cache)
|
||||||
int_or_fut = cache.get(domain, _UNDEF)
|
int_or_fut = cache.get(domain, _UNDEF)
|
||||||
# Integration is never subclassed, so we can check for type
|
# Integration is never subclassed, so we can check for type
|
||||||
if type(int_or_fut) is Integration: # noqa: E721
|
if type(int_or_fut) is Integration:
|
||||||
return int_or_fut
|
return int_or_fut
|
||||||
raise IntegrationNotLoaded(domain)
|
raise IntegrationNotLoaded(domain)
|
||||||
|
|
||||||
@ -1326,7 +1326,7 @@ async def async_get_integrations(
|
|||||||
for domain in domains:
|
for domain in domains:
|
||||||
int_or_fut = cache.get(domain, _UNDEF)
|
int_or_fut = cache.get(domain, _UNDEF)
|
||||||
# Integration is never subclassed, so we can check for type
|
# Integration is never subclassed, so we can check for type
|
||||||
if type(int_or_fut) is Integration: # noqa: E721
|
if type(int_or_fut) is Integration:
|
||||||
results[domain] = int_or_fut
|
results[domain] = int_or_fut
|
||||||
elif int_or_fut is not _UNDEF:
|
elif int_or_fut is not _UNDEF:
|
||||||
in_progress[domain] = cast(asyncio.Future[None], int_or_fut)
|
in_progress[domain] = cast(asyncio.Future[None], int_or_fut)
|
||||||
|
@ -176,7 +176,7 @@ def check(config_dir, secrets=False):
|
|||||||
"secrets": OrderedDict(), # secret cache and secrets loaded
|
"secrets": OrderedDict(), # secret cache and secrets loaded
|
||||||
"except": OrderedDict(), # critical exceptions raised (with config)
|
"except": OrderedDict(), # critical exceptions raised (with config)
|
||||||
"warn": OrderedDict(), # non critical exceptions raised (with config)
|
"warn": OrderedDict(), # non critical exceptions raised (with config)
|
||||||
#'components' is a HomeAssistantConfig # noqa: E265
|
#'components' is a HomeAssistantConfig
|
||||||
"secret_cache": {},
|
"secret_cache": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ def _add_reference( # type: ignore[no-untyped-def]
|
|||||||
obj = NodeListClass(obj)
|
obj = NodeListClass(obj)
|
||||||
if isinstance(obj, str):
|
if isinstance(obj, str):
|
||||||
obj = NodeStrClass(obj)
|
obj = NodeStrClass(obj)
|
||||||
try: # noqa: SIM105 suppress is much slower
|
try: # suppress is much slower
|
||||||
setattr(obj, "__config_file__", loader.get_name)
|
setattr(obj, "__config_file__", loader.get_name)
|
||||||
setattr(obj, "__line__", node.start_mark.line + 1)
|
setattr(obj, "__line__", node.start_mark.line + 1)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -612,6 +612,7 @@ select = [
|
|||||||
"Q000", # Double quotes found but single quotes preferred
|
"Q000", # Double quotes found but single quotes preferred
|
||||||
"RUF005", # Consider iterable unpacking instead of concatenation
|
"RUF005", # Consider iterable unpacking instead of concatenation
|
||||||
"RUF006", # Store a reference to the return value of asyncio.create_task
|
"RUF006", # Store a reference to the return value of asyncio.create_task
|
||||||
|
# "RUF100", # Unused `noqa` directive; temporarily every now and then to clean them up
|
||||||
"S102", # Use of exec detected
|
"S102", # Use of exec detected
|
||||||
"S103", # bad-file-permissions
|
"S103", # bad-file-permissions
|
||||||
"S108", # hardcoded-temp-file
|
"S108", # hardcoded-temp-file
|
||||||
|
@ -112,7 +112,7 @@ def icon_schema(integration_type: str, no_entity_platform: bool) -> vol.Schema:
|
|||||||
return schema
|
return schema
|
||||||
|
|
||||||
|
|
||||||
def validate_icon_file(config: Config, integration: Integration) -> None: # noqa: C901
|
def validate_icon_file(config: Config, integration: Integration) -> None:
|
||||||
"""Validate icon file for integration."""
|
"""Validate icon file for integration."""
|
||||||
icons_file = integration.path / "icons.json"
|
icons_file = integration.path / "icons.json"
|
||||||
if not icons_file.is_file():
|
if not icons_file.is_file():
|
||||||
|
@ -98,7 +98,7 @@ async def _create_august_with_devices(
|
|||||||
return entry
|
return entry
|
||||||
|
|
||||||
|
|
||||||
async def _create_august_api_with_devices( # noqa: C901
|
async def _create_august_api_with_devices(
|
||||||
hass,
|
hass,
|
||||||
devices,
|
devices,
|
||||||
api_call_side_effects=None,
|
api_call_side_effects=None,
|
||||||
|
@ -27,7 +27,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
|||||||
async def setup_automation(
|
async def setup_automation(
|
||||||
hass,
|
hass,
|
||||||
automation_config,
|
automation_config,
|
||||||
stub_blueprint_populate, # noqa: F811
|
stub_blueprint_populate,
|
||||||
):
|
):
|
||||||
"""Set up automation integration."""
|
"""Set up automation integration."""
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
|
@ -24,7 +24,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def setup_script(hass, script_config, stub_blueprint_populate): # noqa: F811
|
async def setup_script(hass, script_config, stub_blueprint_populate):
|
||||||
"""Set up script integration."""
|
"""Set up script integration."""
|
||||||
assert await async_setup_component(hass, "script", {"script": script_config})
|
assert await async_setup_component(hass, "script", {"script": script_config})
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flake8: noqa pylint: skip-file
|
|
||||||
"""Tests for the TelldusLive config flow."""
|
"""Tests for the TelldusLive config flow."""
|
||||||
|
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user