Flesh out typing information, enforce.

(cherry picked from commit fb9a0fe833)
This commit is contained in:
Dan Albert
2021-07-07 17:41:29 -07:00
parent 7cfd6b7151
commit 4e9d661c0c
99 changed files with 426 additions and 453 deletions

View File

@@ -5,7 +5,8 @@ import timeit
from collections import defaultdict
from contextlib import contextmanager
from datetime import timedelta
from typing import Iterator
from types import TracebackType
from typing import Iterator, Optional, Type
@contextmanager
@@ -23,7 +24,12 @@ class MultiEventTracer:
def __enter__(self) -> MultiEventTracer:
return self
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None:
for event, duration in self.events.items():
logging.debug("%s took %s", event, duration)