Created context with certain exit function. Parameters ---------- exit_f : Callable[[], None] The function to call when exiting the context. Returns ------- res : Any The created context.
(exit_f: Callable[[], None])
| 41 | |
| 42 | |
| 43 | def _deferred(exit_f: Callable[[], None]): |
| 44 | """Created context with certain exit function. |
| 45 | |
| 46 | Parameters |
| 47 | ---------- |
| 48 | exit_f : Callable[[], None] |
| 49 | The function to call when exiting the context. |
| 50 | |
| 51 | Returns |
| 52 | ------- |
| 53 | res : Any |
| 54 | The created context. |
| 55 | """ |
| 56 | |
| 57 | @contextmanager |
| 58 | def context(): |
| 59 | try: |
| 60 | yield |
| 61 | finally: |
| 62 | exit_f() |
| 63 | |
| 64 | return context() |
| 65 | |
| 66 | |
| 67 | def _do_nothing(*args, **kwargs): # pylint: disable=unused-argument |
no test coverage detected
searching dependent graphs…