()
| 27 | |
| 28 | |
| 29 | def is_running_trio() -> bool: |
| 30 | try: |
| 31 | # sniffio is a dependency of trio. |
| 32 | |
| 33 | # See https://github.com/python-trio/trio/issues/2802 |
| 34 | import sniffio |
| 35 | |
| 36 | if sniffio.current_async_library() == "trio": |
| 37 | return True |
| 38 | except ImportError: # pragma: nocover |
| 39 | pass |
| 40 | |
| 41 | return False |
| 42 | |
| 43 | |
| 44 | def create_event() -> Event: |