Return an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().g
()
| 819 | _set_event_loop_policy(policy) |
| 820 | |
| 821 | def get_event_loop(): |
| 822 | """Return an asyncio event loop. |
| 823 | |
| 824 | When called from a coroutine or a callback (e.g. scheduled with call_soon |
| 825 | or similar API), this function will always return the running event loop. |
| 826 | |
| 827 | If there is no running event loop set, the function will return |
| 828 | the result of `get_event_loop_policy().get_event_loop()` call. |
| 829 | """ |
| 830 | # NOTE: this function is implemented in C (see _asynciomodule.c) |
| 831 | current_loop = _get_running_loop() |
| 832 | if current_loop is not None: |
| 833 | return current_loop |
| 834 | return _get_event_loop_policy().get_event_loop() |
| 835 | |
| 836 | |
| 837 | def set_event_loop(loop): |
nothing calls this directly
no test coverage detected
searching dependent graphs…