1# *********************************************************** 2# ******* WARNING: AUTOGENERATED! ALL EDITS WILL BE LOST ****** 3# ************************************************************* 4from ._run import GLOBAL_RUN_CONTEXT, _NO_SEND 5from ._ki import LOCALS_KEY_KI_PROTECTION_ENABLED 6from ._instrumentation import Instrument 7 8# fmt: off 9 10 11async def wait_readable(sock): 12 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 13 try: 14 return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_readable(sock) 15 except AttributeError: 16 raise RuntimeError("must be called from async context") 17 18 19async def wait_writable(sock): 20 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 21 try: 22 return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_writable(sock) 23 except AttributeError: 24 raise RuntimeError("must be called from async context") 25 26 27def notify_closing(handle): 28 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 29 try: 30 return GLOBAL_RUN_CONTEXT.runner.io_manager.notify_closing(handle) 31 except AttributeError: 32 raise RuntimeError("must be called from async context") 33 34 35def register_with_iocp(handle): 36 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 37 try: 38 return GLOBAL_RUN_CONTEXT.runner.io_manager.register_with_iocp(handle) 39 except AttributeError: 40 raise RuntimeError("must be called from async context") 41 42 43async def wait_overlapped(handle, lpOverlapped): 44 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 45 try: 46 return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_overlapped(handle, lpOverlapped) 47 except AttributeError: 48 raise RuntimeError("must be called from async context") 49 50 51async def write_overlapped(handle, data, file_offset=0): 52 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 53 try: 54 return await GLOBAL_RUN_CONTEXT.runner.io_manager.write_overlapped(handle, data, file_offset) 55 except AttributeError: 56 raise RuntimeError("must be called from async context") 57 58 59async def readinto_overlapped(handle, buffer, file_offset=0): 60 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 61 try: 62 return await GLOBAL_RUN_CONTEXT.runner.io_manager.readinto_overlapped(handle, buffer, file_offset) 63 except AttributeError: 64 raise RuntimeError("must be called from async context") 65 66 67def current_iocp(): 68 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 69 try: 70 return GLOBAL_RUN_CONTEXT.runner.io_manager.current_iocp() 71 except AttributeError: 72 raise RuntimeError("must be called from async context") 73 74 75def monitor_completion_key(): 76 locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True 77 try: 78 return GLOBAL_RUN_CONTEXT.runner.io_manager.monitor_completion_key() 79 except AttributeError: 80 raise RuntimeError("must be called from async context") 81 82 83# fmt: on 84