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ä authored and Paulus Schoutsen committed 2019-08-11 20:38:18 -07:00
1 parent cf90e49b50
commit b738082dad
59 files changed
+233 -34

No files matched your search

+5 -1
View File
@@ -7,6 +7,7 @@ from datetime import timedelta
import logging
import hashlib
from random import SystemRandom
from typing import Deque
import attr
from aiohttp import web
@@ -52,6 +53,9 @@ from homeassistant.setup import async_when_setup
from .const import DOMAIN, DATA_CAMERA_PREFS
from .prefs import CameraPreferences
# mypy: allow-untyped-calls, allow-untyped-defs
_LOGGER = logging.getLogger(__name__)
SERVICE_ENABLE_MOTION = "enable_motion_detection"
@@ -311,7 +315,7 @@ class Camera(Entity):
"""Initialize a camera."""
self.is_streaming = False
self.content_type = DEFAULT_CONTENT_TYPE
self.access_tokens = collections.deque([], 2)
self.access_tokens: Deque[str] = collections.deque([], 2)
self.async_update_token()
@property
+3
View File
@@ -1,6 +1,9 @@
"""Preference management for camera component."""
from .const import DOMAIN, PREF_PRELOAD_STREAM
# mypy: allow-untyped-defs, no-check-untyped-defs
STORAGE_KEY = DOMAIN
STORAGE_VERSION = 1
_UNDEF = object()