Upgrade mypy to 0.770, tighten config a bit (#32715)

* Upgrade mypy to 0.770, related cleanups

https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html

* Clean up config and make it a notch stricter, address findings
This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-03-12 11:52:20 +01:00
1 parent 77ebda0c20
commit 221d5205e4
14 files changed
+29 -37

No files matched your search

+4 -2
View File
@@ -5,7 +5,7 @@ from contextlib import suppress
from datetime import datetime
import logging
from timeit import default_timer as timer
from typing import Callable, Dict
from typing import Callable, Dict, TypeVar
from homeassistant import core
from homeassistant.components.websocket_api.const import JSON_DUMP
@@ -15,6 +15,8 @@ from homeassistant.util import dt as dt_util
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
# mypy: no-warn-return-any
CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name
BENCHMARKS: Dict[str, Callable] = {}
@@ -44,7 +46,7 @@ def run(args):
loop.close()
def benchmark(func):
def benchmark(func: CALLABLE_T) -> CALLABLE_T:
"""Decorate to mark a benchmark."""
BENCHMARKS[func.__name__] = func
return func