mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:44:49 -04:00
Upgrade mypy to version 0.931 (#12030)
Upgrade mypy to 0.931, mypy-zope to 0.3.5 and fix new complaints.
This commit is contained in:
parent
eb609c65d0
commit
e6acd3cf4f
9 changed files with 33 additions and 19 deletions
|
@ -20,7 +20,7 @@ import os
|
|||
import signal
|
||||
import sys
|
||||
from types import FrameType, TracebackType
|
||||
from typing import NoReturn, Type
|
||||
from typing import NoReturn, Optional, Type
|
||||
|
||||
|
||||
def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") -> None:
|
||||
|
@ -100,7 +100,9 @@ def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") -
|
|||
# also catch any other uncaught exceptions before we get that far.)
|
||||
|
||||
def excepthook(
|
||||
type_: Type[BaseException], value: BaseException, traceback: TracebackType
|
||||
type_: Type[BaseException],
|
||||
value: BaseException,
|
||||
traceback: Optional[TracebackType],
|
||||
) -> None:
|
||||
logger.critical("Unhanded exception", exc_info=(type_, value, traceback))
|
||||
|
||||
|
@ -123,7 +125,7 @@ def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") -
|
|||
sys.exit(1)
|
||||
|
||||
# write a log line on SIGTERM.
|
||||
def sigterm(signum: signal.Signals, frame: FrameType) -> NoReturn:
|
||||
def sigterm(signum: int, frame: Optional[FrameType]) -> NoReturn:
|
||||
logger.warning("Caught signal %s. Stopping daemon." % signum)
|
||||
sys.exit(0)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import functools
|
||||
import sys
|
||||
from typing import Any, Callable, Generator, List, TypeVar
|
||||
from typing import Any, Callable, Generator, List, TypeVar, cast
|
||||
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.defer import Deferred
|
||||
|
@ -174,7 +174,9 @@ def _check_yield_points(
|
|||
)
|
||||
)
|
||||
changes.append(err)
|
||||
return getattr(e, "value", None)
|
||||
# The `StopIteration` or `_DefGen_Return` contains the return value from the
|
||||
# generator.
|
||||
return cast(T, e.value)
|
||||
|
||||
frame = gen.gi_frame
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue