forked from goodboy/tractor
1
0
Fork 0

Make `mypy` happy

310_plus
Tyler Goodlet 2022-01-23 17:33:09 -05:00
parent ef7921ce11
commit 742e004810
1 changed files with 9 additions and 4 deletions

View File

@ -30,6 +30,7 @@ from typing import (
Callable, Callable,
AsyncIterator, AsyncIterator,
AsyncGenerator, AsyncGenerator,
Iterator,
) )
import tractor import tractor
@ -483,7 +484,7 @@ async def _breakpoint(
@cm @cm
def _open_pdb() -> PdbwTeardown: def _open_pdb() -> Iterator[PdbwTeardown]:
# XXX: setting these flags on the pdb instance are absolutely # XXX: setting these flags on the pdb instance are absolutely
# critical to having ctrl-c work in the ``trio`` standard way! The # critical to having ctrl-c work in the ``trio`` standard way! The
@ -498,7 +499,8 @@ def _open_pdb() -> PdbwTeardown:
try: try:
yield pdb yield pdb
except bdb.BdbQuit: except bdb.BdbQuit:
_pdb_release_hook() if _pdb_release_hook:
_pdb_release_hook()
raise raise
@ -592,13 +594,16 @@ def shield_sigint(
def disable_sigint( def disable_sigint(
pdb: Optional[PdbwTeardown] = None pdb: Optional[PdbwTeardown] = None
) -> None: ) -> Iterator[None]:
__tracebackhide__ = True __tracebackhide__ = True
# ensure the ``contextlib.contextmanager`` frame inside the wrapping # ensure the ``contextlib.contextmanager`` frame inside the wrapping
# ``.__exit__()`` method isn't shown either. # ``.__exit__()`` method isn't shown either.
frame = sys._getframe() frame = sys._getframe()
frame.f_back.f_globals['__tracebackhide__'] = True last_f = frame.f_back
if last_f:
last_f.f_globals['__tracebackhide__'] = True
# NOTE: this seems like a form of cpython bug wherein # NOTE: this seems like a form of cpython bug wherein
# it's likely that ``functools.WRAPPER_ASSIGNMENTS`` should # it's likely that ``functools.WRAPPER_ASSIGNMENTS`` should
# probably contain this attr name? # probably contain this attr name?