mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 01:21:51 +02:00
Enable strict typing for rest_command (#107911)
This commit is contained in:
@ -339,6 +339,7 @@ homeassistant.components.remote.*
|
||||
homeassistant.components.renault.*
|
||||
homeassistant.components.repairs.*
|
||||
homeassistant.components.rest.*
|
||||
homeassistant.components.rest_command.*
|
||||
homeassistant.components.rfxtrx.*
|
||||
homeassistant.components.rhasspy.*
|
||||
homeassistant.components.ridwell.*
|
||||
|
@ -1,8 +1,11 @@
|
||||
"""Support for exposing regular REST commands as services."""
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from http import HTTPStatus
|
||||
from json.decoder import JSONDecodeError
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
from aiohttp import hdrs
|
||||
@ -86,9 +89,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
async_register_rest_command(name, command_config)
|
||||
|
||||
@callback
|
||||
def async_register_rest_command(name, command_config):
|
||||
def async_register_rest_command(name: str, command_config: dict[str, Any]) -> None:
|
||||
"""Create service for rest command."""
|
||||
websession = async_get_clientsession(hass, command_config.get(CONF_VERIFY_SSL))
|
||||
websession = async_get_clientsession(hass, command_config[CONF_VERIFY_SSL])
|
||||
timeout = command_config[CONF_TIMEOUT]
|
||||
method = command_config[CONF_METHOD]
|
||||
|
||||
|
10
mypy.ini
10
mypy.ini
@ -3151,6 +3151,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.rest_command.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.rfxtrx.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
Reference in New Issue
Block a user