Upgrade mypy to 0.740 (#27913)

* Upgrade mypy to 0.740

http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html

* Type hint additions

* Type fixes

* Remove no longer needed type ignores and casts

* Disable untyped definition checks in bunch of files
This commit is contained in:
Ville Skyttä 2019-10-19 21:35:57 +03:00 committed by Paulus Schoutsen
parent 758fcc9b00
commit 381d423fec
17 changed files with 25 additions and 21 deletions

View file

@ -2,6 +2,7 @@
import asyncio
from contextlib import suppress
import logging
from typing import Optional
from aiohttp import web, WSMsgType
import async_timeout
@ -25,7 +26,7 @@ from .error import Disconnect
from .messages import error_message
# mypy: allow-untyped-calls, allow-untyped-defs
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
class WebsocketAPIView(HomeAssistantView):
@ -47,7 +48,7 @@ class WebSocketHandler:
"""Initialize an active connection."""
self.hass = hass
self.request = request
self.wsock = None
self.wsock: Optional[web.WebSocketResponse] = None
self._to_write: asyncio.Queue = asyncio.Queue(maxsize=MAX_PENDING_MSG)
self._handle_task = None
self._writer_task = None
@ -115,7 +116,7 @@ class WebSocketHandler:
# Py3.7+
if hasattr(asyncio, "current_task"):
# pylint: disable=no-member
self._handle_task = asyncio.current_task() # type: ignore
self._handle_task = asyncio.current_task()
else:
self._handle_task = asyncio.Task.current_task()