Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
command_context.py
Go to the documentation of this file.
1from contextlib import ExitStack, contextmanager
2from typing import ContextManager, Generator, TypeVar
3
4_T = TypeVar("_T", covariant=True)
5
6
8 def __init__(self) -> None:
10 self._in_main_context = False
11 self._main_context = ExitStack()
12
13 @contextmanager
14 def main_context(self) -> Generator[None, None, None]:
15 assert not self._in_main_context
16
17 self._in_main_context = True
18 try:
19 with self._main_context:
20 yield
21 finally:
22 self._in_main_context = False
23
24 def enter_context(self, context_provider: ContextManager[_T]) -> _T:
25 assert self._in_main_context
26
27 return self._main_context.enter_context(context_provider)
_T enter_context(self, ContextManager[_T] context_provider)
for i