Enable strict typing for downloader (#107263)

This commit is contained in:
Marc Mueller 2024-01-05 18:35:05 +01:00 committed by GitHub
parent 221fa48ea5
commit f0b47bf00c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -141,6 +141,7 @@ homeassistant.components.dlna_dmr.*
homeassistant.components.dnsip.* homeassistant.components.dnsip.*
homeassistant.components.doorbird.* homeassistant.components.doorbird.*
homeassistant.components.dormakaba_dkey.* homeassistant.components.dormakaba_dkey.*
homeassistant.components.downloader.*
homeassistant.components.dsmr.* homeassistant.components.dsmr.*
homeassistant.components.dunehd.* homeassistant.components.dunehd.*
homeassistant.components.efergy.* homeassistant.components.efergy.*

View File

@ -1,4 +1,6 @@
"""Support for functionality to download files.""" """Support for functionality to download files."""
from __future__ import annotations
from http import HTTPStatus from http import HTTPStatus
import logging import logging
import os import os
@ -61,7 +63,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
def download_file(service: ServiceCall) -> None: def download_file(service: ServiceCall) -> None:
"""Start thread to download file specified in the URL.""" """Start thread to download file specified in the URL."""
def do_download(): def do_download() -> None:
"""Download the file.""" """Download the file."""
try: try:
url = service.data[ATTR_URL] url = service.data[ATTR_URL]

View File

@ -1171,6 +1171,16 @@ disallow_untyped_defs = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
[mypy-homeassistant.components.downloader.*]
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.dsmr.*] [mypy-homeassistant.components.dsmr.*]
check_untyped_defs = true check_untyped_defs = true
disallow_incomplete_defs = true disallow_incomplete_defs = true