()
| 20 | logging.getLogger("neo4j").setLevel(logging.ERROR) |
| 21 | |
| 22 | def always_get_an_event_loop() -> asyncio.AbstractEventLoop: |
| 23 | try: |
| 24 | # If there is already an event loop, use it. |
| 25 | loop = asyncio.get_event_loop() |
| 26 | except RuntimeError: |
| 27 | # If in a sub-thread, create a new event loop. |
| 28 | logger.info("Creating a new event loop in a sub-thread.") |
| 29 | loop = asyncio.new_event_loop() |
| 30 | asyncio.set_event_loop(loop) |
| 31 | return loop |
| 32 | |
| 33 | |
| 34 | def extract_first_complete_json(s: str): |