pumpkin-api-py 0.1.0.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. pumpkin_api/__init__.py +139 -0
  2. pumpkin_api/app.py +8 -0
  3. pumpkin_api/build.py +35 -0
  4. pumpkin_api/wit/componentize_py_async_support/__init__.py +529 -0
  5. pumpkin_api/wit/componentize_py_async_support/futures.py +93 -0
  6. pumpkin_api/wit/componentize_py_async_support/streams.py +189 -0
  7. pumpkin_api/wit/componentize_py_runtime.pyi +34 -0
  8. pumpkin_api/wit/componentize_py_types.py +19 -0
  9. pumpkin_api/wit/poll_loop.py +440 -0
  10. pumpkin_api/wit/wit_world/__init__.py +70 -0
  11. pumpkin_api/wit/wit_world/exports/__init__.py +19 -0
  12. pumpkin_api/wit/wit_world/exports/metadata.py +22 -0
  13. pumpkin_api/wit/wit_world/imports/__init__.py +0 -0
  14. pumpkin_api/wit/wit_world/imports/command.py +539 -0
  15. pumpkin_api/wit/wit_world/imports/common.py +213 -0
  16. pumpkin_api/wit/wit_world/imports/context.py +70 -0
  17. pumpkin_api/wit/wit_world/imports/entity.py +84 -0
  18. pumpkin_api/wit/wit_world/imports/event.py +434 -0
  19. pumpkin_api/wit/wit_world/imports/gui.py +61 -0
  20. pumpkin_api/wit/wit_world/imports/i18n.py +35 -0
  21. pumpkin_api/wit/wit_world/imports/logging.py +30 -0
  22. pumpkin_api/wit/wit_world/imports/permission.py +71 -0
  23. pumpkin_api/wit/wit_world/imports/player.py +350 -0
  24. pumpkin_api/wit/wit_world/imports/scheduler.py +44 -0
  25. pumpkin_api/wit/wit_world/imports/scoreboard.py +95 -0
  26. pumpkin_api/wit/wit_world/imports/server.py +75 -0
  27. pumpkin_api/wit/wit_world/imports/text.py +89 -0
  28. pumpkin_api/wit/wit_world/imports/world.py +215 -0
  29. pumpkin_api/wit_files/command.wit +189 -0
  30. pumpkin_api/wit_files/common.wit +201 -0
  31. pumpkin_api/wit_files/componentize_py_async_support/__init__.py +529 -0
  32. pumpkin_api/wit_files/componentize_py_async_support/futures.py +93 -0
  33. pumpkin_api/wit_files/componentize_py_async_support/streams.py +189 -0
  34. pumpkin_api/wit_files/componentize_py_runtime.pyi +34 -0
  35. pumpkin_api/wit_files/componentize_py_types.py +19 -0
  36. pumpkin_api/wit_files/context.wit +33 -0
  37. pumpkin_api/wit_files/entity.wit +36 -0
  38. pumpkin_api/wit_files/event.wit +311 -0
  39. pumpkin_api/wit_files/gui.wit +38 -0
  40. pumpkin_api/wit_files/i18n.wit +21 -0
  41. pumpkin_api/wit_files/log.wit +14 -0
  42. pumpkin_api/wit_files/metadata.wit +15 -0
  43. pumpkin_api/wit_files/permission.wit +46 -0
  44. pumpkin_api/wit_files/player.wit +172 -0
  45. pumpkin_api/wit_files/plugin.wit +61 -0
  46. pumpkin_api/wit_files/poll_loop.py +440 -0
  47. pumpkin_api/wit_files/scheduler.wit +24 -0
  48. pumpkin_api/wit_files/scoreboard.wit +72 -0
  49. pumpkin_api/wit_files/server.wit +41 -0
  50. pumpkin_api/wit_files/text.wit +41 -0
  51. pumpkin_api/wit_files/wit_world/__init__.py +70 -0
  52. pumpkin_api/wit_files/wit_world/exports/__init__.py +19 -0
  53. pumpkin_api/wit_files/wit_world/exports/metadata.py +22 -0
  54. pumpkin_api/wit_files/wit_world/imports/__init__.py +0 -0
  55. pumpkin_api/wit_files/wit_world/imports/command.py +539 -0
  56. pumpkin_api/wit_files/wit_world/imports/common.py +213 -0
  57. pumpkin_api/wit_files/wit_world/imports/context.py +70 -0
  58. pumpkin_api/wit_files/wit_world/imports/entity.py +84 -0
  59. pumpkin_api/wit_files/wit_world/imports/event.py +434 -0
  60. pumpkin_api/wit_files/wit_world/imports/gui.py +61 -0
  61. pumpkin_api/wit_files/wit_world/imports/i18n.py +35 -0
  62. pumpkin_api/wit_files/wit_world/imports/logging.py +30 -0
  63. pumpkin_api/wit_files/wit_world/imports/permission.py +71 -0
  64. pumpkin_api/wit_files/wit_world/imports/player.py +350 -0
  65. pumpkin_api/wit_files/wit_world/imports/scheduler.py +44 -0
  66. pumpkin_api/wit_files/wit_world/imports/scoreboard.py +95 -0
  67. pumpkin_api/wit_files/wit_world/imports/server.py +75 -0
  68. pumpkin_api/wit_files/wit_world/imports/text.py +89 -0
  69. pumpkin_api/wit_files/wit_world/imports/world.py +215 -0
  70. pumpkin_api/wit_files/world.wit +169 -0
  71. pumpkin_api_py-0.1.0.dev0.dist-info/METADATA +58 -0
  72. pumpkin_api_py-0.1.0.dev0.dist-info/RECORD +75 -0
  73. pumpkin_api_py-0.1.0.dev0.dist-info/WHEEL +4 -0
  74. pumpkin_api_py-0.1.0.dev0.dist-info/entry_points.txt +2 -0
  75. pumpkin_api_py-0.1.0.dev0.dist-info/licenses/LICENSE +677 -0
@@ -0,0 +1,189 @@
1
+ import componentize_py_runtime
2
+ import componentize_py_async_support
3
+ import weakref
4
+
5
+ from typing import TypeVar, Generic, Self, cast
6
+ from types import TracebackType
7
+ from componentize_py_async_support import _ReturnCode
8
+
9
+ class ByteStreamReader:
10
+ def __init__(self, type_: int, handle: int):
11
+ self.writer_dropped = False
12
+ self.type_ = type_
13
+ self.handle: int | None = handle
14
+ self.finalizer = weakref.finalize(self, componentize_py_runtime.stream_drop_readable, type_, handle)
15
+
16
+ async def read(self, max_count: int) -> bytes:
17
+ if self.writer_dropped:
18
+ return bytes()
19
+
20
+ code, values = await self._read(max_count)
21
+
22
+ if code == _ReturnCode.DROPPED:
23
+ self.writer_dropped = True
24
+
25
+ return values
26
+
27
+ async def _read(self, max_count: int) -> tuple[int, bytes]:
28
+ if self.handle is not None:
29
+ return cast(tuple[int, bytes], await componentize_py_async_support.await_result(
30
+ componentize_py_runtime.stream_read(self.type_, self.handle, max_count)
31
+ ))
32
+ else:
33
+ raise AssertionError
34
+
35
+ def __enter__(self) -> Self:
36
+ return self
37
+
38
+ def __exit__(self,
39
+ exc_type: type[BaseException] | None,
40
+ exc_value: BaseException | None,
41
+ traceback: TracebackType | None) -> bool | None:
42
+ self.finalizer.detach()
43
+ handle = self.handle
44
+ self.handle = None
45
+ if handle is not None:
46
+ componentize_py_runtime.stream_drop_readable(self.type_, handle)
47
+ return None
48
+
49
+ class ByteStreamWriter:
50
+ def __init__(self, type_: int, handle: int):
51
+ self.reader_dropped = False
52
+ self.type_ = type_
53
+ self.handle: int | None = handle
54
+ self.finalizer = weakref.finalize(self, componentize_py_runtime.stream_drop_writable, type_, handle)
55
+
56
+ async def write(self, source: bytes) -> int:
57
+ if self.reader_dropped:
58
+ return 0
59
+
60
+ code, count = await self._write(source)
61
+
62
+ if code == _ReturnCode.DROPPED:
63
+ self.reader_dropped = True
64
+
65
+ return count
66
+
67
+ async def _write(self, source: bytes) -> tuple[int, int]:
68
+ if self.handle is not None:
69
+ return await componentize_py_async_support.await_result(
70
+ componentize_py_runtime.stream_write(self.type_, self.handle, source)
71
+ )
72
+ else:
73
+ raise AssertionError
74
+
75
+ async def write_all(self, source: bytes) -> int:
76
+ total = 0
77
+
78
+ while len(source) > 0 and not self.reader_dropped:
79
+ count = await self.write(source)
80
+ source = source[count:]
81
+ total += count
82
+
83
+ return total
84
+
85
+ def __enter__(self) -> Self:
86
+ return self
87
+
88
+ def __exit__(self,
89
+ exc_type: type[BaseException] | None,
90
+ exc_value: BaseException | None,
91
+ traceback: TracebackType | None) -> bool | None:
92
+ self.finalizer.detach()
93
+ handle = self.handle
94
+ self.handle = None
95
+ if handle is not None:
96
+ componentize_py_runtime.stream_drop_writable(self.type_, handle)
97
+ return None
98
+
99
+ T = TypeVar('T')
100
+
101
+ class StreamReader(Generic[T]):
102
+ def __init__(self, type_: int, handle: int):
103
+ self.writer_dropped = False
104
+ self.type_ = type_
105
+ self.handle: int | None = handle
106
+ self.finalizer = weakref.finalize(self, componentize_py_runtime.stream_drop_readable, type_, handle)
107
+
108
+ async def read(self, max_count: int) -> list[T]:
109
+ if self.writer_dropped:
110
+ return []
111
+
112
+ code, values = await self._read(max_count)
113
+
114
+ if code == _ReturnCode.DROPPED:
115
+ self.writer_dropped = True
116
+
117
+ return values
118
+
119
+ async def _read(self, max_count: int) -> tuple[int, list[T]]:
120
+ if self.handle is not None:
121
+ return cast(tuple[int, list[T]], await componentize_py_async_support.await_result(
122
+ componentize_py_runtime.stream_read(self.type_, self.handle, max_count)
123
+ ))
124
+ else:
125
+ raise AssertionError
126
+
127
+ def __enter__(self) -> Self:
128
+ return self
129
+
130
+ def __exit__(self,
131
+ exc_type: type[BaseException] | None,
132
+ exc_value: BaseException | None,
133
+ traceback: TracebackType | None) -> bool | None:
134
+ self.finalizer.detach()
135
+ handle = self.handle
136
+ self.handle = None
137
+ if handle is not None:
138
+ componentize_py_runtime.stream_drop_readable(self.type_, handle)
139
+ return None
140
+
141
+ class StreamWriter(Generic[T]):
142
+ def __init__(self, type_: int, handle: int):
143
+ self.reader_dropped = False
144
+ self.type_ = type_
145
+ self.handle: int | None = handle
146
+ self.finalizer = weakref.finalize(self, componentize_py_runtime.stream_drop_writable, type_, handle)
147
+
148
+ async def write(self, source: list[T]) -> int:
149
+ if self.reader_dropped:
150
+ return 0
151
+
152
+ code, count = await self._write(source)
153
+
154
+ if code == _ReturnCode.DROPPED:
155
+ self.reader_dropped = True
156
+
157
+ return count
158
+
159
+ async def _write(self, source: list[T]) -> tuple[int, int]:
160
+ if self.handle is not None:
161
+ return await componentize_py_async_support.await_result(
162
+ componentize_py_runtime.stream_write(self.type_, self.handle, source)
163
+ )
164
+ else:
165
+ raise AssertionError
166
+
167
+ async def write_all(self, source: list[T]) -> int:
168
+ total = 0
169
+
170
+ while len(source) > 0 and not self.reader_dropped:
171
+ count = await self.write(source)
172
+ source = source[count:]
173
+ total += count
174
+
175
+ return total
176
+
177
+ def __enter__(self) -> Self:
178
+ return self
179
+
180
+ def __exit__(self,
181
+ exc_type: type[BaseException] | None,
182
+ exc_value: BaseException | None,
183
+ traceback: TracebackType | None) -> bool | None:
184
+ self.finalizer.detach()
185
+ handle = self.handle
186
+ self.handle = None
187
+ if handle is not None:
188
+ componentize_py_runtime.stream_drop_writable(self.type_, handle)
189
+ return None
@@ -0,0 +1,34 @@
1
+ from typing import Any
2
+ from componentize_py_types import Result
3
+
4
+ def call_task_return(index: int, borrows: int, result: Any) -> None: ...
5
+
6
+ def waitable_set_drop(set: int) -> None: ...
7
+
8
+ def context_set(value: Any) -> None: ...
9
+
10
+ def context_get() -> Any: ...
11
+
12
+ def waitable_join(waitable: int, set: int) -> None: ...
13
+
14
+ def subtask_drop(task: int) -> None: ...
15
+
16
+ def waitable_set_new() -> int: ...
17
+
18
+ def promise_get_result(event: int, promise: int) -> Any: ...
19
+
20
+ def future_read(ty: int, future: int) -> Result[Any, tuple[int, int]]: ...
21
+
22
+ def future_write(ty: int, future: int, value: Any) -> Result[tuple[int, int], tuple[int, int]]: ...
23
+
24
+ def future_drop_readable(ty: int, future: int) -> None: ...
25
+
26
+ def future_drop_writable(ty: int, future: int) -> None: ...
27
+
28
+ def stream_read(ty: int, stream: int, max_count: int) -> Result[tuple[int, bytes | list[Any]], tuple[int, int]]: ...
29
+
30
+ def stream_write(ty: int, stream: int, values: bytes | list[Any]) -> Result[tuple[int, int], tuple[int, int]]: ...
31
+
32
+ def stream_drop_readable(ty: int, stream: int) -> None: ...
33
+
34
+ def stream_drop_writable(ty: int, stream: int) -> None: ...
@@ -0,0 +1,19 @@
1
+ from typing import TypeVar, Generic, Union
2
+ from dataclasses import dataclass
3
+
4
+ S = TypeVar('S')
5
+ @dataclass
6
+ class Some(Generic[S]):
7
+ value: S
8
+
9
+ T = TypeVar('T')
10
+ @dataclass
11
+ class Ok(Generic[T]):
12
+ value: T
13
+
14
+ E = TypeVar('E')
15
+ @dataclass(frozen=True)
16
+ class Err(Generic[E], Exception):
17
+ value: E
18
+
19
+ Result = Union[Ok[T], Err[E]]
@@ -0,0 +1,440 @@
1
+ """Defines a custom `asyncio` event loop backed by `wasi:io/poll#poll`.
2
+
3
+ This also includes helper classes and functions for working with `wasi:http`.
4
+
5
+ This is only useful for `wasi:http@0.2.x`; `wasi:http@0.3.x` uses a different
6
+ mechanism to model concurrency.
7
+ """
8
+
9
+ import asyncio
10
+ import socket
11
+ import subprocess
12
+
13
+ from componentize_py_types import Ok, Err
14
+ from wit_world.imports import types, streams, poll, outgoing_handler
15
+ from wit_world.imports.types import (
16
+ IncomingBody,
17
+ OutgoingBody,
18
+ OutgoingRequest,
19
+ IncomingResponse,
20
+ )
21
+ from wit_world.imports.streams import StreamError_Closed, InputStream
22
+ from wit_world.imports.poll import Pollable
23
+ from typing import Optional, cast
24
+
25
+ # Maximum number of bytes to read at a time
26
+ READ_SIZE: int = 16 * 1024
27
+
28
+
29
+ async def send(request: OutgoingRequest) -> IncomingResponse:
30
+ """Send the specified request and wait asynchronously for the response."""
31
+
32
+ future = outgoing_handler.handle(request, None)
33
+
34
+ while True:
35
+ response = future.get()
36
+ if response is None:
37
+ await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
38
+ else:
39
+ if isinstance(response, Ok):
40
+ if isinstance(response.value, Ok):
41
+ return response.value.value
42
+ else:
43
+ raise response.value
44
+ else:
45
+ raise response
46
+
47
+
48
+ class Stream:
49
+ """Reader abstraction over `wasi:http/types#incoming-body`."""
50
+
51
+ def __init__(self, body: IncomingBody):
52
+ self.body: Optional[IncomingBody] = body
53
+ self.stream: Optional[InputStream] = body.stream()
54
+
55
+ async def next(self) -> Optional[bytes]:
56
+ """Wait for the next chunk of data to arrive on the stream.
57
+
58
+ This will return `None` when the end of the stream has been reached.
59
+ """
60
+ while True:
61
+ try:
62
+ if self.stream is None:
63
+ return None
64
+ else:
65
+ buffer = self.stream.read(READ_SIZE)
66
+ if len(buffer) == 0:
67
+ await register(
68
+ cast(PollLoop, asyncio.get_event_loop()),
69
+ self.stream.subscribe(),
70
+ )
71
+ else:
72
+ return buffer
73
+ except Err as e:
74
+ if isinstance(e.value, StreamError_Closed):
75
+ if self.stream is not None:
76
+ self.stream.__exit__(None, None, None)
77
+ self.stream = None
78
+ if self.body is not None:
79
+ IncomingBody.finish(self.body)
80
+ self.body = None
81
+ else:
82
+ raise e
83
+
84
+
85
+ class Sink:
86
+ """Writer abstraction over `wasi:http/types#outgoing-body`."""
87
+
88
+ def __init__(self, body: OutgoingBody):
89
+ self.body = body
90
+ self.stream = body.write()
91
+
92
+ async def send(self, chunk: bytes):
93
+ """Write the specified bytes to the sink.
94
+
95
+ This may need to yield according to the backpressure requirements of the sink.
96
+ """
97
+ offset = 0
98
+ flushing = False
99
+ while True:
100
+ count = self.stream.check_write()
101
+ if count == 0:
102
+ await register(
103
+ cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe()
104
+ )
105
+ elif offset == len(chunk):
106
+ if flushing:
107
+ return
108
+ else:
109
+ self.stream.flush()
110
+ flushing = True
111
+ else:
112
+ count = min(count, len(chunk) - offset)
113
+ self.stream.write(chunk[offset : offset + count])
114
+ offset += count
115
+
116
+ def close(self):
117
+ """Close the stream, indicating no further data will be written."""
118
+
119
+ self.stream.__exit__(None, None, None)
120
+ self.stream = None
121
+ OutgoingBody.finish(self.body, None)
122
+ self.body = None
123
+
124
+
125
+ class PollLoop(asyncio.AbstractEventLoop):
126
+ """Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
127
+
128
+ def __init__(self):
129
+ self.wakers = []
130
+ self.running = False
131
+ self.handles = []
132
+ self.exception = None
133
+
134
+ def get_debug(self):
135
+ return False
136
+
137
+ def run_until_complete(self, future):
138
+ future = asyncio.ensure_future(future, loop=self)
139
+
140
+ self.running = True
141
+ asyncio.events._set_running_loop(self)
142
+ while self.running and not future.done():
143
+ handles = self.handles
144
+ self.handles = []
145
+ for handle in handles:
146
+ if not handle._cancelled:
147
+ handle._run()
148
+
149
+ if self.wakers:
150
+ [pollables, wakers] = list(map(list, zip(*self.wakers)))
151
+
152
+ new_wakers = []
153
+ ready = [False] * len(pollables)
154
+ for index in poll.poll(pollables):
155
+ ready[index] = True
156
+
157
+ for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
158
+ if ready:
159
+ pollable.__exit__(None, None, None)
160
+ waker.set_result(None)
161
+ else:
162
+ new_wakers.append((pollable, waker))
163
+
164
+ self.wakers = new_wakers
165
+
166
+ if self.exception is not None:
167
+ raise self.exception
168
+
169
+ return future.result()
170
+
171
+ def is_running(self):
172
+ return self.running
173
+
174
+ def is_closed(self):
175
+ return not self.running
176
+
177
+ def stop(self):
178
+ self.running = False
179
+
180
+ def close(self):
181
+ self.running = False
182
+
183
+ def shutdown_asyncgens(self):
184
+ pass
185
+
186
+ def call_exception_handler(self, context):
187
+ self.exception = context.get("exception", None)
188
+
189
+ def call_soon(self, callback, *args, context=None):
190
+ handle = asyncio.Handle(callback, args, self, context)
191
+ self.handles.append(handle)
192
+ return handle
193
+
194
+ def create_task(self, coroutine):
195
+ return asyncio.Task(coroutine, loop=self)
196
+
197
+ def create_future(self):
198
+ return asyncio.Future(loop=self)
199
+
200
+ # The remaining methods should be irrelevant for our purposes and thus unimplemented
201
+
202
+ def run_forever(self):
203
+ raise NotImplementedError
204
+
205
+ async def shutdown_default_executor(self):
206
+ raise NotImplementedError
207
+
208
+ def _timer_handle_cancelled(self, handle):
209
+ raise NotImplementedError
210
+
211
+ def call_later(self, delay, callback, *args, context=None):
212
+ raise NotImplementedError
213
+
214
+ def call_at(self, when, callback, *args, context=None):
215
+ raise NotImplementedError
216
+
217
+ def time(self):
218
+ raise NotImplementedError
219
+
220
+ def call_soon_threadsafe(self, callback, *args, context=None):
221
+ raise NotImplementedError
222
+
223
+ def run_in_executor(self, executor, func, *args):
224
+ raise NotImplementedError
225
+
226
+ def set_default_executor(self, executor):
227
+ raise NotImplementedError
228
+
229
+ async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0):
230
+ raise NotImplementedError
231
+
232
+ async def getnameinfo(self, sockaddr, flags=0):
233
+ raise NotImplementedError
234
+
235
+ async def create_connection(
236
+ self,
237
+ protocol_factory,
238
+ host=None,
239
+ port=None,
240
+ *,
241
+ ssl=None,
242
+ family=0,
243
+ proto=0,
244
+ flags=0,
245
+ sock=None,
246
+ local_addr=None,
247
+ server_hostname=None,
248
+ ssl_handshake_timeout=None,
249
+ ssl_shutdown_timeout=None,
250
+ happy_eyeballs_delay=None,
251
+ interleave=None,
252
+ ):
253
+ raise NotImplementedError
254
+
255
+ async def create_server(
256
+ self,
257
+ protocol_factory,
258
+ host=None,
259
+ port=None,
260
+ *,
261
+ family=socket.AF_UNSPEC,
262
+ flags=socket.AI_PASSIVE,
263
+ sock=None,
264
+ backlog=100,
265
+ ssl=None,
266
+ reuse_address=None,
267
+ reuse_port=None,
268
+ ssl_handshake_timeout=None,
269
+ ssl_shutdown_timeout=None,
270
+ start_serving=True,
271
+ ):
272
+ raise NotImplementedError
273
+
274
+ async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True):
275
+ raise NotImplementedError
276
+
277
+ async def start_tls(
278
+ self,
279
+ transport,
280
+ protocol,
281
+ sslcontext,
282
+ *,
283
+ server_side=False,
284
+ server_hostname=None,
285
+ ssl_handshake_timeout=None,
286
+ ssl_shutdown_timeout=None,
287
+ ):
288
+ raise NotImplementedError
289
+
290
+ async def create_unix_connection(
291
+ self,
292
+ protocol_factory,
293
+ path=None,
294
+ *,
295
+ ssl=None,
296
+ sock=None,
297
+ server_hostname=None,
298
+ ssl_handshake_timeout=None,
299
+ ssl_shutdown_timeout=None,
300
+ ):
301
+ raise NotImplementedError
302
+
303
+ async def create_unix_server(
304
+ self,
305
+ protocol_factory,
306
+ path=None,
307
+ *,
308
+ sock=None,
309
+ backlog=100,
310
+ ssl=None,
311
+ ssl_handshake_timeout=None,
312
+ ssl_shutdown_timeout=None,
313
+ start_serving=True,
314
+ ):
315
+ raise NotImplementedError
316
+
317
+ async def connect_accepted_socket(
318
+ self,
319
+ protocol_factory,
320
+ sock,
321
+ *,
322
+ ssl=None,
323
+ ssl_handshake_timeout=None,
324
+ ssl_shutdown_timeout=None,
325
+ ):
326
+ raise NotImplementedError
327
+
328
+ async def create_datagram_endpoint(
329
+ self,
330
+ protocol_factory,
331
+ local_addr=None,
332
+ remote_addr=None,
333
+ *,
334
+ family=0,
335
+ proto=0,
336
+ flags=0,
337
+ reuse_address=None,
338
+ reuse_port=None,
339
+ allow_broadcast=None,
340
+ sock=None,
341
+ ):
342
+ raise NotImplementedError
343
+
344
+ async def connect_read_pipe(self, protocol_factory, pipe):
345
+ raise NotImplementedError
346
+
347
+ async def connect_write_pipe(self, protocol_factory, pipe):
348
+ raise NotImplementedError
349
+
350
+ async def subprocess_shell(
351
+ self,
352
+ protocol_factory,
353
+ cmd,
354
+ *,
355
+ stdin=subprocess.PIPE,
356
+ stdout=subprocess.PIPE,
357
+ stderr=subprocess.PIPE,
358
+ **kwargs,
359
+ ):
360
+ raise NotImplementedError
361
+
362
+ async def subprocess_exec(
363
+ self,
364
+ protocol_factory,
365
+ *args,
366
+ stdin=subprocess.PIPE,
367
+ stdout=subprocess.PIPE,
368
+ stderr=subprocess.PIPE,
369
+ **kwargs,
370
+ ):
371
+ raise NotImplementedError
372
+
373
+ def add_reader(self, fd, callback, *args):
374
+ raise NotImplementedError
375
+
376
+ def remove_reader(self, fd):
377
+ raise NotImplementedError
378
+
379
+ def add_writer(self, fd, callback, *args):
380
+ raise NotImplementedError
381
+
382
+ def remove_writer(self, fd):
383
+ raise NotImplementedError
384
+
385
+ async def sock_recv(self, sock, nbytes):
386
+ raise NotImplementedError
387
+
388
+ async def sock_recv_into(self, sock, buf):
389
+ raise NotImplementedError
390
+
391
+ async def sock_recvfrom(self, sock, bufsize):
392
+ raise NotImplementedError
393
+
394
+ async def sock_recvfrom_into(self, sock, buf, nbytes=0):
395
+ raise NotImplementedError
396
+
397
+ async def sock_sendall(self, sock, data):
398
+ raise NotImplementedError
399
+
400
+ async def sock_sendto(self, sock, data, address):
401
+ raise NotImplementedError
402
+
403
+ async def sock_connect(self, sock, address):
404
+ raise NotImplementedError
405
+
406
+ async def sock_accept(self, sock):
407
+ raise NotImplementedError
408
+
409
+ async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None):
410
+ raise NotImplementedError
411
+
412
+ def add_signal_handler(self, sig, callback, *args):
413
+ raise NotImplementedError
414
+
415
+ def remove_signal_handler(self, sig):
416
+ raise NotImplementedError
417
+
418
+ def set_task_factory(self, factory):
419
+ raise NotImplementedError
420
+
421
+ def get_task_factory(self):
422
+ raise NotImplementedError
423
+
424
+ def get_exception_handler(self):
425
+ raise NotImplementedError
426
+
427
+ def set_exception_handler(self, handler):
428
+ raise NotImplementedError
429
+
430
+ def default_exception_handler(self, context):
431
+ raise NotImplementedError
432
+
433
+ def set_debug(self, enabled):
434
+ raise NotImplementedError
435
+
436
+
437
+ async def register(loop: PollLoop, pollable: Pollable):
438
+ waker = loop.create_future()
439
+ loop.wakers.append((pollable, waker))
440
+ await waker