diff --git a/homeassistant/block_async_io.py b/homeassistant/block_async_io.py index 9358fe731109351d609ebca1ebf01e82b168327c..29e31ae4a88f2a9fff0426761c7e813e571f8ab3 100644 --- a/homeassistant/block_async_io.py +++ b/homeassistant/block_async_io.py @@ -8,7 +8,7 @@ from .util.async_ import protect_loop def enable() -> None: """Enable the detection of blocking calls in the event loop.""" # Prevent urllib3 and requests doing I/O in event loop - HTTPConnection.putrequest = protect_loop(HTTPConnection.putrequest) # type: ignore + HTTPConnection.putrequest = protect_loop(HTTPConnection.putrequest) # type: ignore[assignment] # Prevent sleeping in event loop. Non-strict since 2022.02 time.sleep = protect_loop(time.sleep, strict=False) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index fbe7a6b005fd31592104a9d628a946990ea13b4b..b1b638f844aa2778c15d05c372c59e6b229a3df1 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -321,7 +321,7 @@ def async_enable_logging( logging.getLogger("aiohttp.access").setLevel(logging.WARNING) sys.excepthook = lambda *args: logging.getLogger(None).exception( - "Uncaught exception", exc_info=args # type: ignore + "Uncaught exception", exc_info=args # type: ignore[arg-type] ) threading.excepthook = lambda args: logging.getLogger(None).exception( "Uncaught thread exception", diff --git a/homeassistant/config.py b/homeassistant/config.py index 74a8055e97188bb6484db9a0f9f6bbb89e1c2acd..17a1c0fbfa1e0a9411769c470366ae3d136c3f13 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -816,7 +816,7 @@ async def async_process_component_config( # noqa: C901 config_validator, "async_validate_config" ): try: - return await config_validator.async_validate_config( # type: ignore + return await config_validator.async_validate_config( # type: ignore[no-any-return] hass, config ) except (vol.Invalid, HomeAssistantError) as ex: @@ -829,7 +829,7 @@ async def async_process_component_config( # noqa: C901 # No custom config validator, proceed with schema validation if hasattr(component, "CONFIG_SCHEMA"): try: - return component.CONFIG_SCHEMA(config) # type: ignore + return component.CONFIG_SCHEMA(config) # type: ignore[no-any-return] except vol.Invalid as ex: async_log_exception(ex, domain, config, hass, integration.documentation) return None diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 400cea3f78ca26b51cccee0a192aeb4f398ce503..57c837178a48efe811957d0ee926f1205419a4d7 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1213,7 +1213,7 @@ class ConfigFlow(data_entry_flow.FlowHandler): match_dict = {} # Match any entry for entry in self._async_current_entries(include_ignore=False): if all( - item in ChainMap(entry.options, entry.data).items() # type: ignore + item in ChainMap(entry.options, entry.data).items() # type: ignore[arg-type] for item in match_dict.items() ): raise data_entry_flow.AbortFlow("already_configured") diff --git a/homeassistant/core.py b/homeassistant/core.py index 5685b479d1c3f1e60009f4b36e22d56beedece39..38a0bbeb73cc44bdf583ae34a1930aae757349f0 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -238,8 +238,8 @@ class HomeAssistant: """Root object of the Home Assistant home automation.""" auth: AuthManager - http: HomeAssistantHTTP = None # type: ignore - config_entries: ConfigEntries = None # type: ignore + http: HomeAssistantHTTP = None # type: ignore[assignment] + config_entries: ConfigEntries = None # type: ignore[assignment] def __init__(self) -> None: """Initialize new Home Assistant object.""" @@ -765,7 +765,7 @@ class Event: def __eq__(self, other: Any) -> bool: """Return the comparison.""" - return ( # type: ignore + return ( # type: ignore[no-any-return] self.__class__ == other.__class__ and self.event_type == other.event_type and self.data == other.data @@ -1125,7 +1125,7 @@ class State: def __eq__(self, other: Any) -> bool: """Return the comparison of the state.""" - return ( # type: ignore + return ( # type: ignore[no-any-return] self.__class__ == other.__class__ and self.entity_id == other.entity_id and self.state == other.state diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 734a568ce4e1f1e2f7bedd37ab2726ed82e7bc58..b69cf44dc6c319688a30c99a16b5494e916b0cc7 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -378,11 +378,11 @@ class FlowHandler: # While not purely typed, it makes typehinting more useful for us # and removes the need for constant None checks or asserts. - flow_id: str = None # type: ignore - hass: HomeAssistant = None # type: ignore - handler: str = None # type: ignore + flow_id: str = None # type: ignore[assignment] + hass: HomeAssistant = None # type: ignore[assignment] + handler: str = None # type: ignore[assignment] # Ensure the attribute has a subscriptable, but immutable, default value. - context: dict[str, Any] = MappingProxyType({}) # type: ignore + context: dict[str, Any] = MappingProxyType({}) # type: ignore[assignment] # Set by _async_create_flow callback init_step = "init" diff --git a/homeassistant/loader.py b/homeassistant/loader.py index c02fa18eefbb5fbb017df7af15eea0532a1fddbb..f5c68897e2e25f73440bd495868cbdcb56cadb2c 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -681,7 +681,7 @@ def _load_file( Async friendly. """ with suppress(KeyError): - return hass.data[DATA_COMPONENTS][comp_or_platform] # type: ignore + return hass.data[DATA_COMPONENTS][comp_or_platform] # type: ignore[no-any-return] if (cache := hass.data.get(DATA_COMPONENTS)) is None: if not _async_mount_config_dir(hass): diff --git a/homeassistant/runner.py b/homeassistant/runner.py index 6ee0b8fefe192365aba973f015410542cc8f4031..472d399713dba8b9e129b7203ae852c0e5ddfeb0 100644 --- a/homeassistant/runner.py +++ b/homeassistant/runner.py @@ -59,7 +59,7 @@ class HassEventLoopPolicy(asyncio.DefaultEventLoopPolicy): # type: ignore[valid @property def loop_name(self) -> str: """Return name of the loop.""" - return self._loop_factory.__name__ # type: ignore + return self._loop_factory.__name__ # type: ignore[no-any-return] def new_event_loop(self) -> asyncio.AbstractEventLoop: """Get the event loop.""" @@ -72,7 +72,7 @@ class HassEventLoopPolicy(asyncio.DefaultEventLoopPolicy): # type: ignore[valid thread_name_prefix="SyncWorker", max_workers=MAX_EXECUTOR_WORKERS ) loop.set_default_executor(executor) - loop.set_default_executor = warn_use( # type: ignore + loop.set_default_executor = warn_use( # type: ignore[assignment] loop.set_default_executor, "sets default executor on the event loop" ) return loop @@ -89,11 +89,11 @@ def _async_loop_exception_handler(_: Any, context: dict[str, Any]) -> None: if source_traceback := context.get("source_traceback"): stack_summary = "".join(traceback.format_list(source_traceback)) logger.error( - "Error doing job: %s: %s", context["message"], stack_summary, **kwargs # type: ignore + "Error doing job: %s: %s", context["message"], stack_summary, **kwargs # type: ignore[arg-type] ) return - logger.error("Error doing job: %s", context["message"], **kwargs) # type: ignore + logger.error("Error doing job: %s", context["message"], **kwargs) # type: ignore[arg-type] async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int: