1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Type check various base components (#25878)

* Type check various component base classes, disabling bunch of checks for now

* Type hint fixes

* Help mypy out some

* Add more type hints
This commit is contained in:
Ville Skyttä
2019-08-12 06:38:18 +03:00
committed by Paulus Schoutsen
parent cf90e49b50
commit b738082dad
59 changed files with 233 additions and 34 deletions

View File

@@ -6,6 +6,9 @@ from aiohttp.web import FileResponse
from aiohttp.web_exceptions import HTTPNotFound, HTTPForbidden
from aiohttp.web_urldispatcher import StaticResource
# mypy: allow-untyped-defs
CACHE_TIME = 31 * 86400 # = 1 month
CACHE_HEADERS = {hdrs.CACHE_CONTROL: "public, max-age={}".format(CACHE_TIME)}
@@ -39,7 +42,8 @@ class CachingStaticResource(StaticResource):
if filepath.is_dir():
return await super()._handle(request)
if filepath.is_file():
return FileResponse(
# type ignore: https://github.com/aio-libs/aiohttp/pull/3976
return FileResponse( # type: ignore
filepath, chunk_size=self._chunk_size, headers=CACHE_HEADERS
)
raise HTTPNotFound