mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Enable strict typing for rest_command (#107911)
This commit is contained in:
parent
ca1aaacc90
commit
7c98c1e544
@ -339,6 +339,7 @@ homeassistant.components.remote.*
|
|||||||
homeassistant.components.renault.*
|
homeassistant.components.renault.*
|
||||||
homeassistant.components.repairs.*
|
homeassistant.components.repairs.*
|
||||||
homeassistant.components.rest.*
|
homeassistant.components.rest.*
|
||||||
|
homeassistant.components.rest_command.*
|
||||||
homeassistant.components.rfxtrx.*
|
homeassistant.components.rfxtrx.*
|
||||||
homeassistant.components.rhasspy.*
|
homeassistant.components.rhasspy.*
|
||||||
homeassistant.components.ridwell.*
|
homeassistant.components.ridwell.*
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
"""Support for exposing regular REST commands as services."""
|
"""Support for exposing regular REST commands as services."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiohttp import hdrs
|
from aiohttp import hdrs
|
||||||
@ -86,9 +89,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
async_register_rest_command(name, command_config)
|
async_register_rest_command(name, command_config)
|
||||||
|
|
||||||
@callback
|
@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."""
|
"""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]
|
timeout = command_config[CONF_TIMEOUT]
|
||||||
method = command_config[CONF_METHOD]
|
method = command_config[CONF_METHOD]
|
||||||
|
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -3151,6 +3151,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = 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.*]
|
[mypy-homeassistant.components.rfxtrx.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user