mypy: Enable new error explicit-override.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-10-12 10:43:45 -07:00
committed by Anders Kaseorg
parent d257002ad8
commit a50eb2e809
223 changed files with 936 additions and 18 deletions

View File

@@ -6,12 +6,15 @@ import time
from types import TracebackType
from typing import Callable, Optional, Tuple, Type, TypeVar
from typing_extensions import override
# Based on https://code.activestate.com/recipes/483752/
class TimeoutExpiredError(Exception):
"""Exception raised when a function times out."""
@override
def __str__(self) -> str:
return "Function call timed out."
@@ -49,6 +52,7 @@ def timeout(timeout: float, func: Callable[[], ResultT]) -> ResultT:
# if this is the only thread left.
self.daemon = True
@override
def run(self) -> None:
try:
self.result = func()