From 6ee273a5484067814109a3f06814906add498325 Mon Sep 17 00:00:00 2001 From: Sid <27780930+autinerd@users.noreply.github.com> Date: Sat, 16 Mar 2024 20:48:37 +0100 Subject: [PATCH] Clean up unneeded ruff noqa directives (#113616) --- homeassistant/components/command_line/utils.py | 4 ++-- homeassistant/components/devolo_home_network/__init__.py | 4 +--- homeassistant/components/esphome/entry_data.py | 2 +- homeassistant/components/event/__init__.py | 2 +- homeassistant/components/google_assistant/__init__.py | 2 +- homeassistant/components/group/__init__.py | 2 +- homeassistant/components/group/entity.py | 8 +------- homeassistant/components/hassio/__init__.py | 4 ++-- homeassistant/components/hassio/websocket_api.py | 2 +- homeassistant/components/iaqualink/__init__.py | 4 +--- homeassistant/components/image/__init__.py | 2 +- homeassistant/components/influxdb/__init__.py | 2 +- homeassistant/components/isy994/services.py | 2 +- homeassistant/components/juicenet/device.py | 2 +- homeassistant/components/logbook/models.py | 2 +- homeassistant/components/logbook/processor.py | 2 +- homeassistant/components/matter/event.py | 2 +- homeassistant/components/modbus/__init__.py | 2 +- homeassistant/components/mqtt/climate.py | 4 ++-- homeassistant/components/recorder/core.py | 4 ++-- homeassistant/components/recorder/history/modern.py | 2 +- homeassistant/components/recorder/statistics.py | 2 +- homeassistant/components/systemmonitor/sensor.py | 2 +- homeassistant/components/vacuum/__init__.py | 7 +------ homeassistant/components/weather/__init__.py | 4 ++-- homeassistant/components/websocket_api/const.py | 2 +- homeassistant/components/wemo/wemo_device.py | 2 +- homeassistant/config.py | 2 +- homeassistant/core.py | 4 ++-- homeassistant/helpers/condition.py | 2 +- homeassistant/helpers/config_validation.py | 2 +- homeassistant/helpers/deprecation.py | 2 +- homeassistant/helpers/service.py | 2 +- homeassistant/loader.py | 4 ++-- homeassistant/scripts/check_config.py | 2 +- homeassistant/util/yaml/loader.py | 2 +- pyproject.toml | 1 + script/hassfest/icons.py | 2 +- tests/components/august/mocks.py | 2 +- tests/components/config/test_automation.py | 2 +- tests/components/config/test_script.py | 2 +- tests/components/tellduslive/test_config_flow.py | 1 - 42 files changed, 48 insertions(+), 63 deletions(-) diff --git a/homeassistant/components/command_line/utils.py b/homeassistant/components/command_line/utils.py index faebccae477..067efc08e97 100644 --- a/homeassistant/components/command_line/utils.py +++ b/homeassistant/components/command_line/utils.py @@ -19,7 +19,7 @@ async def async_call_shell_with_timeout( """ try: _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, 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: """Run a shell command with a timeout and return the output.""" try: - proc = await asyncio.create_subprocess_shell( # noqa: S602 # shell by design + proc = await asyncio.create_subprocess_shell( # shell by design command, close_fds=False, # required for posix_spawn stdout=asyncio.subprocess.PIPE, diff --git a/homeassistant/components/devolo_home_network/__init__.py b/homeassistant/components/devolo_home_network/__init__.py index 08d0e340b16..d96312be4e6 100644 --- a/homeassistant/components/devolo_home_network/__init__.py +++ b/homeassistant/components/devolo_home_network/__init__.py @@ -49,9 +49,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -async def async_setup_entry( # noqa: C901 - hass: HomeAssistant, entry: ConfigEntry -) -> bool: +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up devolo Home Network from a config entry.""" hass.data.setdefault(DOMAIN, {}) zeroconf_instance = await zeroconf.async_get_async_instance(hass) diff --git a/homeassistant/components/esphome/entry_data.py b/homeassistant/components/esphome/entry_data.py index a7f3caf20cf..39bca5031fa 100644 --- a/homeassistant/components/esphome/entry_data.py +++ b/homeassistant/components/esphome/entry_data.py @@ -347,7 +347,7 @@ class RuntimeEntryData: and subscription_key not in stale_state and state_type is not CameraState and not ( - state_type is SensorState # noqa: E721 + state_type is SensorState and (platform_info := self.info.get(SensorInfo)) and (entity_info := platform_info.get(state.key)) and (cast(SensorInfo, entity_info)).force_update diff --git a/homeassistant/components/event/__init__.py b/homeassistant/components/event/__init__.py index 5a7e8bdda30..fc9add8c62e 100644 --- a/homeassistant/components/event/__init__.py +++ b/homeassistant/components/event/__init__.py @@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any, Self, final from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant -from homeassistant.helpers.config_validation import ( # noqa: F401 +from homeassistant.helpers.config_validation import ( PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/google_assistant/__init__.py b/homeassistant/components/google_assistant/__init__.py index eb71361672a..273e46040b7 100644 --- a/homeassistant/components/google_assistant/__init__.py +++ b/homeassistant/components/google_assistant/__init__.py @@ -29,7 +29,7 @@ from .const import ( # noqa: F401 DEFAULT_EXPOSE_BY_DEFAULT, DEFAULT_EXPOSED_DOMAINS, DOMAIN, - EVENT_QUERY_RECEIVED, # noqa: F401 + EVENT_QUERY_RECEIVED, SERVICE_REQUEST_SYNC, SOURCE_CLOUD, ) diff --git a/homeassistant/components/group/__init__.py b/homeassistant/components/group/__init__.py index 330eafa110c..8758bf19312 100644 --- a/homeassistant/components/group/__init__.py +++ b/homeassistant/components/group/__init__.py @@ -46,7 +46,7 @@ from .const import ( # noqa: F401 ATTR_ORDER, ATTR_REMOVE_ENTITIES, CONF_HIDE_MEMBERS, - DOMAIN, # noqa: F401 + DOMAIN, GROUP_ORDER, REG_KEY, ) diff --git a/homeassistant/components/group/entity.py b/homeassistant/components/group/entity.py index 3df068f5e23..24c10fd2e7b 100644 --- a/homeassistant/components/group/entity.py +++ b/homeassistant/components/group/entity.py @@ -25,13 +25,7 @@ from homeassistant.helpers.event import ( async_track_state_change_event, ) -from .const import ( - ATTR_AUTO, - ATTR_ORDER, - DOMAIN, # noqa: F401 - GROUP_ORDER, - REG_KEY, -) +from .const import ATTR_AUTO, ATTR_ORDER, DOMAIN, GROUP_ORDER, REG_KEY from .registry import GroupIntegrationRegistry ENTITY_ID_FORMAT = DOMAIN + ".{}" diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py index b533f615db6..90b155aff15 100644 --- a/homeassistant/components/hassio/__init__.py +++ b/homeassistant/components/hassio/__init__.py @@ -83,14 +83,14 @@ from .const import ( from .data import ( HassioDataUpdateCoordinator, get_addons_changelogs, # noqa: F401 - get_addons_info, # noqa: F401 + get_addons_info, get_addons_stats, # noqa: F401 get_core_info, # noqa: F401 get_core_stats, # noqa: F401 get_host_info, # noqa: F401 get_info, # noqa: F401 get_issues_info, # noqa: F401 - get_os_info, # noqa: F401 + get_os_info, get_store, # noqa: F401 get_supervisor_info, # noqa: F401 get_supervisor_stats, # noqa: F401 diff --git a/homeassistant/components/hassio/websocket_api.py b/homeassistant/components/hassio/websocket_api.py index 22315161300..6313ebd5eaf 100644 --- a/homeassistant/components/hassio/websocket_api.py +++ b/homeassistant/components/hassio/websocket_api.py @@ -46,7 +46,7 @@ WS_NO_ADMIN_ENDPOINTS = re.compile( r"^(?:" r"|/ingress/(session|validate_session)" r"|/addons/[^/]+/info" - r")$" # noqa: ISC001 + r")$" ) # fmt: on diff --git a/homeassistant/components/iaqualink/__init__.py b/homeassistant/components/iaqualink/__init__.py index 6468347b001..33697dfb2cc 100644 --- a/homeassistant/components/iaqualink/__init__.py +++ b/homeassistant/components/iaqualink/__init__.py @@ -56,9 +56,7 @@ PLATFORMS = [ ] -async def async_setup_entry( # noqa: C901 - hass: HomeAssistant, entry: ConfigEntry -) -> bool: +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Aqualink from a config entry.""" username = entry.data[CONF_USERNAME] password = entry.data[CONF_PASSWORD] diff --git a/homeassistant/components/image/__init__.py b/homeassistant/components/image/__init__.py index b73da5fbfd6..35869f31792 100644 --- a/homeassistant/components/image/__init__.py +++ b/homeassistant/components/image/__init__.py @@ -33,7 +33,7 @@ from homeassistant.helpers.event import ( from homeassistant.helpers.httpx_client import get_async_client 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: from functools import cached_property diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index daa49a4ba20..5c40dac1c9d 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -551,7 +551,7 @@ class InfluxThread(threading.Thread): if item is None: self.shutdown = True - elif type(item) is tuple: # noqa: E721 + elif type(item) is tuple: timestamp, event = item age = time.monotonic() - timestamp diff --git a/homeassistant/components/isy994/services.py b/homeassistant/components/isy994/services.py index 9159627c9eb..fedf7f8e902 100644 --- a/homeassistant/components/isy994/services.py +++ b/homeassistant/components/isy994/services.py @@ -131,7 +131,7 @@ def async_get_entities(hass: HomeAssistant) -> dict[str, Entity]: @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.""" existing_services = hass.services.async_services_for_domain(DOMAIN) if existing_services and SERVICE_SEND_PROGRAM_COMMAND in existing_services: diff --git a/homeassistant/components/juicenet/device.py b/homeassistant/components/juicenet/device.py index 86e1c92e4da..daec88c2a94 100644 --- a/homeassistant/components/juicenet/device.py +++ b/homeassistant/components/juicenet/device.py @@ -10,7 +10,7 @@ class JuiceNetApi: self._devices = [] async def setup(self): - """JuiceNet device setup.""" # noqa: D403 + """JuiceNet device setup.""" self._devices = await self.api.get_devices() @property diff --git a/homeassistant/components/logbook/models.py b/homeassistant/components/logbook/models.py index 7cbafd43d53..1073c6b0d3a 100644 --- a/homeassistant/components/logbook/models.py +++ b/homeassistant/components/logbook/models.py @@ -51,7 +51,7 @@ class LazyEventPartialState: self._event_data_cache = event_data_cache # We need to explicitly check for the row is EventAsRow as the unhappy path # 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 # json decode process as we already have the data self.data = row.data diff --git a/homeassistant/components/logbook/processor.py b/homeassistant/components/logbook/processor.py index 29e135fbf62..2180a63b74f 100644 --- a/homeassistant/components/logbook/processor.py +++ b/homeassistant/components/logbook/processor.py @@ -428,7 +428,7 @@ class EventCache: def get(self, row: EventAsRow | Row) -> LazyEventPartialState: """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) if event := self.event_cache.get(row): return event diff --git a/homeassistant/components/matter/event.py b/homeassistant/components/matter/event.py index 1b55b700085..ea48beef782 100644 --- a/homeassistant/components/matter/event.py +++ b/homeassistant/components/matter/event.py @@ -105,7 +105,7 @@ class MatterEventEntity(MatterEntity, EventEntity): """Call when Node attribute(s) changed.""" @callback - def _on_matter_node_event( # noqa: F821 + def _on_matter_node_event( self, event: EventType, data: MatterNodeEvent, diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index eb1f2ec0f60..94a84d3440d 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -51,7 +51,7 @@ from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.typing import ConfigType -from .const import ( # noqa: F401 +from .const import ( CALL_TYPE_COIL, CALL_TYPE_DISCRETE, CALL_TYPE_REGISTER_HOLDING, diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 567fe2540fd..cb1274c7665 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -456,7 +456,7 @@ class MqttTemperatureControlEntity(MqttEntity, ABC): except ValueError: _LOGGER.error("Could not parse %s from %s", template_name, payload) - def prepare_subscribe_topics( # noqa: C901 + def prepare_subscribe_topics( self, topics: dict[str, dict[str, Any]], ) -> None: @@ -714,7 +714,7 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity): self._attr_supported_features = support - def _prepare_subscribe_topics(self) -> None: # noqa: C901 + def _prepare_subscribe_topics(self) -> None: """(Re)Subscribe to topics.""" topics: dict[str, dict[str, Any]] = {} diff --git a/homeassistant/components/recorder/core.py b/homeassistant/components/recorder/core.py index 664fb59644f..fdb593ff27b 100644 --- a/homeassistant/components/recorder/core.py +++ b/homeassistant/components/recorder/core.py @@ -887,7 +887,7 @@ class Recorder(threading.Thread): for task_or_event in startup_task_or_events: # Event is never subclassed so we can # 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 if event_.event_type == EVENT_STATE_CHANGED: state_change_events.append(event_) @@ -918,7 +918,7 @@ class Recorder(threading.Thread): # is an Event so we can process it directly # and since its never subclassed, we can # use a fast type check - if type(task) is Event: # noqa: E721 + if type(task) is Event: self._process_one_event(task) return # If its not an event, commit everything diff --git a/homeassistant/components/recorder/history/modern.py b/homeassistant/components/recorder/history/modern.py index b35e1315cbe..124a6a43869 100644 --- a/homeassistant/components/recorder/history/modern.py +++ b/homeassistant/components/recorder/history/modern.py @@ -758,7 +758,7 @@ def _sorted_states_to_dict( _utc_from_timestamp = dt_util.utc_from_timestamp 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(), } for row in group diff --git a/homeassistant/components/recorder/statistics.py b/homeassistant/components/recorder/statistics.py index ffe3136f841..f840fdbd7b6 100644 --- a/homeassistant/components/recorder/statistics.py +++ b/homeassistant/components/recorder/statistics.py @@ -2039,7 +2039,7 @@ def _fast_build_sum_list( ] -def _sorted_statistics_to_dict( # noqa: C901 +def _sorted_statistics_to_dict( hass: HomeAssistant, session: Session, stats: Sequence[Row[Any]], diff --git a/homeassistant/components/systemmonitor/sensor.py b/homeassistant/components/systemmonitor/sensor.py index fb04ac815b9..a8b0d6bd146 100644 --- a/homeassistant/components/systemmonitor/sensor.py +++ b/homeassistant/components/systemmonitor/sensor.py @@ -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 ) -> None: """Set up System Montor sensors based on a config entry.""" diff --git a/homeassistant/components/vacuum/__init__.py b/homeassistant/components/vacuum/__init__.py index 1be2c6c6796..61a31add655 100644 --- a/homeassistant/components/vacuum/__init__.py +++ b/homeassistant/components/vacuum/__init__.py @@ -36,12 +36,7 @@ from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass from . import group as group_pre_import # noqa: F401 -from .const import ( # noqa: F401 - STATE_CLEANING, - STATE_DOCKED, - STATE_ERROR, - STATE_RETURNING, -) +from .const import STATE_CLEANING, STATE_DOCKED, STATE_ERROR, STATE_RETURNING if TYPE_CHECKING: from functools import cached_property diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py index 76dc0508545..59e01f03e67 100644 --- a/homeassistant/components/weather/__init__.py +++ b/homeassistant/components/weather/__init__.py @@ -62,7 +62,7 @@ from homeassistant.util.json import JsonValueType from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM from . import group as group_pre_import # noqa: F401 -from .const import ( # noqa: F401 +from .const import ( ATTR_WEATHER_APPARENT_TEMPERATURE, ATTR_WEATHER_CLOUD_COVERAGE, ATTR_WEATHER_DEW_POINT, @@ -675,7 +675,7 @@ class WeatherEntity(Entity, PostInit, cached_properties=CACHED_PROPERTIES_WITH_A @final @property - def state_attributes(self) -> dict[str, Any]: # noqa: C901 + def state_attributes(self) -> dict[str, Any]: """Return the state attributes, converted. Attributes are configured from native units to user-configured units. diff --git a/homeassistant/components/websocket_api/const.py b/homeassistant/components/websocket_api/const.py index c5de49e4033..25d3ff8dcb3 100644 --- a/homeassistant/components/websocket_api/const.py +++ b/homeassistant/components/websocket_api/const.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Final from homeassistant.core import HomeAssistant if TYPE_CHECKING: - from .connection import ActiveConnection # noqa: F401 + from .connection import ActiveConnection WebSocketCommandHandler = Callable[ diff --git a/homeassistant/components/wemo/wemo_device.py b/homeassistant/components/wemo/wemo_device.py index fae4f87c239..2a4185a7640 100644 --- a/homeassistant/components/wemo/wemo_device.py +++ b/homeassistant/components/wemo/wemo_device.py @@ -36,7 +36,7 @@ from .models import async_wemo_data _LOGGER = logging.getLogger(__name__) # 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. OptionsFieldKey = Literal["enable_subscription", "enable_long_press"] diff --git a/homeassistant/config.py b/homeassistant/config.py index 0cc79a37ca5..a95da351a54 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -1434,7 +1434,7 @@ def extract_domain_configs(config: ConfigType, domain: str) -> Sequence[str]: return domain_configs -async def async_process_component_config( # noqa: C901 +async def async_process_component_config( hass: HomeAssistant, config: ConfigType, integration: Integration, diff --git a/homeassistant/core.py b/homeassistant/core.py index a6262c56c81..c9760194a92 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -1136,7 +1136,7 @@ class HomeAssistant: if ( not handle.cancelled() 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 ): handle.cancel() @@ -1595,7 +1595,7 @@ class State: # State only creates and expects a ReadOnlyDict so # there is no need to check for subclassing with # 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 {}) else: self.attributes = attributes diff --git a/homeassistant/helpers/condition.py b/homeassistant/helpers/condition.py index ab0da9f4478..e906148efdb 100644 --- a/homeassistant/helpers/condition.py +++ b/homeassistant/helpers/condition.py @@ -362,7 +362,7 @@ def numeric_state( ).result() -def async_numeric_state( # noqa: C901 +def async_numeric_state( hass: HomeAssistant, entity: None | str | State, below: float | str | None = None, diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 8f9e0d5353f..fbe98ccd387 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -625,7 +625,7 @@ def string(value: Any) -> str: # This is expected to be the most common case, so check it first. if ( type(value) is str # noqa: E721 - or type(value) is NodeStrClass # noqa: E721 + or type(value) is NodeStrClass or isinstance(value, str) ): return value diff --git a/homeassistant/helpers/deprecation.py b/homeassistant/helpers/deprecation.py index 3266c69db20..6e70bbc7635 100644 --- a/homeassistant/helpers/deprecation.py +++ b/homeassistant/helpers/deprecation.py @@ -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 # found. # https://peps.python.org/pep-0562/#specification - raise AttributeError(msg) # noqa: TRY004 + raise AttributeError(msg) _print_deprecation_warning_internal( name, diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index b58e0831ccb..df8284c0b4c 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -656,7 +656,7 @@ async def async_get_all_descriptions( ints_or_excs = await async_get_integrations(hass, domains_with_missing_services) integrations: list[Integration] = [] 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) continue if TYPE_CHECKING: diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 8e44ca38d77..fe825e84bdf 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -1299,7 +1299,7 @@ def async_get_loaded_integration(hass: HomeAssistant, domain: str) -> Integratio cache = cast(dict[str, Integration | asyncio.Future[None]], cache) int_or_fut = cache.get(domain, _UNDEF) # 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 raise IntegrationNotLoaded(domain) @@ -1326,7 +1326,7 @@ async def async_get_integrations( for domain in domains: int_or_fut = cache.get(domain, _UNDEF) # 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 elif int_or_fut is not _UNDEF: in_progress[domain] = cast(asyncio.Future[None], int_or_fut) diff --git a/homeassistant/scripts/check_config.py b/homeassistant/scripts/check_config.py index f688a96b11d..d38e24a24da 100644 --- a/homeassistant/scripts/check_config.py +++ b/homeassistant/scripts/check_config.py @@ -176,7 +176,7 @@ def check(config_dir, secrets=False): "secrets": OrderedDict(), # secret cache and secrets loaded "except": OrderedDict(), # 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": {}, } diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index 2a2883ed544..0713fd83ee8 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -319,7 +319,7 @@ def _add_reference( # type: ignore[no-untyped-def] obj = NodeListClass(obj) if isinstance(obj, str): obj = NodeStrClass(obj) - try: # noqa: SIM105 suppress is much slower + try: # suppress is much slower setattr(obj, "__config_file__", loader.get_name) setattr(obj, "__line__", node.start_mark.line + 1) except AttributeError: diff --git a/pyproject.toml b/pyproject.toml index 7d0ff3f3e35..7bc7931f18b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -612,6 +612,7 @@ select = [ "Q000", # Double quotes found but single quotes preferred "RUF005", # Consider iterable unpacking instead of concatenation "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 "S103", # bad-file-permissions "S108", # hardcoded-temp-file diff --git a/script/hassfest/icons.py b/script/hassfest/icons.py index 8b0fd6d3b91..b7ba2fbb402 100644 --- a/script/hassfest/icons.py +++ b/script/hassfest/icons.py @@ -112,7 +112,7 @@ def icon_schema(integration_type: str, no_entity_platform: bool) -> vol.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.""" icons_file = integration.path / "icons.json" if not icons_file.is_file(): diff --git a/tests/components/august/mocks.py b/tests/components/august/mocks.py index df52e900dbd..b819565d4bf 100644 --- a/tests/components/august/mocks.py +++ b/tests/components/august/mocks.py @@ -98,7 +98,7 @@ async def _create_august_with_devices( return entry -async def _create_august_api_with_devices( # noqa: C901 +async def _create_august_api_with_devices( hass, devices, api_call_side_effects=None, diff --git a/tests/components/config/test_automation.py b/tests/components/config/test_automation.py index 616aae58bdd..6d28a66fdc3 100644 --- a/tests/components/config/test_automation.py +++ b/tests/components/config/test_automation.py @@ -27,7 +27,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None: async def setup_automation( hass, automation_config, - stub_blueprint_populate, # noqa: F811 + stub_blueprint_populate, ): """Set up automation integration.""" assert await async_setup_component( diff --git a/tests/components/config/test_script.py b/tests/components/config/test_script.py index 745ee708875..cca4f07f8e0 100644 --- a/tests/components/config/test_script.py +++ b/tests/components/config/test_script.py @@ -24,7 +24,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None: @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.""" assert await async_setup_component(hass, "script", {"script": script_config}) diff --git a/tests/components/tellduslive/test_config_flow.py b/tests/components/tellduslive/test_config_flow.py index 17d29b383fb..cf107477897 100644 --- a/tests/components/tellduslive/test_config_flow.py +++ b/tests/components/tellduslive/test_config_flow.py @@ -1,4 +1,3 @@ -# flake8: noqa pylint: skip-file """Tests for the TelldusLive config flow.""" from unittest.mock import Mock, patch