()
| 17 | ENCODER = None |
| 18 | |
| 19 | def always_get_an_event_loop() -> asyncio.AbstractEventLoop: |
| 20 | try: |
| 21 | # If there is already an event loop, use it. |
| 22 | loop = asyncio.get_event_loop() |
| 23 | except RuntimeError: |
| 24 | # If in a sub-thread, create a new event loop. |
| 25 | logger.info("Creating a new event loop in a sub-thread.") |
| 26 | loop = asyncio.new_event_loop() |
| 27 | asyncio.set_event_loop(loop) |
| 28 | return loop |
| 29 | |
| 30 | |
| 31 | def extract_first_complete_json(s: str): |
nothing calls this directly
no outgoing calls
no test coverage detected