Skip to content

Commit c6244bf

Browse files
committed
don't use yield; touch up documentation
1 parent cf028c6 commit c6244bf

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

asyncio/core.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ def sleep_ms(t, sgen=SingletonGenerator()):
9696
# CIRCUITPY-CHANGE: doc
9797
"""Sleep for *t* milliseconds.
9898
99-
This is a coroutine, and a MicroPython extension.
99+
This is a MicroPython extension.
100+
101+
Returns a coroutine.
100102
"""
101103

102104
# CIRCUITPY-CHANGE: add debugging hint
@@ -108,9 +110,9 @@ def sleep_ms(t, sgen=SingletonGenerator()):
108110
# Pause task execution for the given time (in seconds)
109111
def sleep(t):
110112
# CIRCUITPY-CHANGE: doc
111-
"""Sleep for *t* seconds
113+
"""Sleep for *t* seconds.
112114
113-
This is a coroutine.
115+
Returns a coroutine.
114116
"""
115117

116118
return sleep_ms(int(t * 1000))

asyncio/event.py

-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ async def wait(self):
5757
# CIRCUITPY-CHANGE: doc
5858
"""Wait for the event to be set. If the event is already set then it returns
5959
immediately.
60-
61-
This is a coroutine.
6260
"""
6361

6462
if not self.state:

asyncio/funcs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ async def wait_for(aw, timeout, sleep=core.sleep):
4242
this should be trapped by the caller.
4343
4444
Returns the return value of *aw*.
45-
46-
This is a coroutine.
4745
"""
4846

4947
aw = core._promote_to_task(aw)
@@ -80,7 +78,9 @@ def wait_for_ms(aw, timeout):
8078
# CIRCUITPY-CHANGE: doc
8179
"""Similar to `wait_for` but *timeout* is an integer in milliseconds.
8280
83-
This is a coroutine, and a MicroPython extension.
81+
This is a MicroPython extension.
82+
83+
Returns a coroutine.
8484
"""
8585

8686
return wait_for(aw, timeout, core.sleep_ms)

asyncio/lock.py

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ async def acquire(self):
6767
# CIRCUITPY-CHANGE: doc
6868
"""Wait for the lock to be in the unlocked state and then lock it in an
6969
atomic way. Only one task can acquire the lock at any one time.
70-
71-
This is a coroutine.
7270
"""
7371

7472
if self.state != 0:

asyncio/stream.py

+3-19
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ def close(self):
4343
async def wait_closed(self):
4444
# CIRCUITPY-CHANGE: doc
4545
"""Wait for the stream to close.
46-
47-
This is a coroutine.
4846
"""
4947

5048
# TODO yield?
@@ -54,8 +52,6 @@ async def wait_closed(self):
5452
async def read(self, n):
5553
# CIRCUITPY-CHANGE: doc
5654
"""Read up to *n* bytes and return them.
57-
58-
This is a coroutine.
5955
"""
6056

6157
await core._io_queue.queue_read(self.s)
@@ -67,7 +63,7 @@ async def readinto(self, buf):
6763
6864
Return the number of bytes read into *buf*
6965
70-
This is a coroutine, and a MicroPython extension.
66+
This is a MicroPython extension.
7167
"""
7268

7369
# CIRCUITPY-CHANGE: await, not yield
@@ -81,9 +77,7 @@ async def readexactly(self, n):
8177
8278
Raises an ``EOFError`` exception if the stream ends before reading
8379
*n* bytes.
84-
85-
This is a coroutine.
86-
"""
80+
"""
8781

8882
r = b""
8983
while n:
@@ -101,8 +95,6 @@ async def readexactly(self, n):
10195
async def readline(self):
10296
# CIRCUITPY-CHANGE: doc
10397
"""Read a line and return it.
104-
105-
This is a coroutine.
10698
"""
10799

108100
l = b""
@@ -133,8 +125,6 @@ def write(self, buf):
133125
async def drain(self):
134126
# CIRCUITPY-CHANGE: doc
135127
"""Drain (write) all buffered output data out to the stream.
136-
137-
This is a coroutine.
138128
"""
139129

140130
mv = memoryview(self.out_buf)
@@ -162,8 +152,6 @@ async def open_connection(host, port, ssl=None, server_hostname=None):
162152
163153
Returns a pair of streams: a reader and a writer stream. Will raise a socket-specific
164154
``OSError`` if the host could not be resolved or if the connection could not be made.
165-
166-
This is a coroutine.
167155
"""
168156

169157
from uerrno import EINPROGRESS
@@ -188,7 +176,7 @@ async def open_connection(host, port, ssl=None, server_hostname=None):
188176
s = ssl.wrap_socket(s, server_hostname=server_hostname, do_handshake_on_connect=False)
189177
s.setblocking(False)
190178
ss = Stream(s)
191-
yield core._io_queue.queue_write(s)
179+
await core._io_queue.queue_write(s)
192180
return ss, ss
193181

194182

@@ -214,8 +202,6 @@ def close(self):
214202

215203
async def wait_closed(self):
216204
"""Wait for the server to close.
217-
218-
This is a coroutine.
219205
"""
220206

221207
await self.task
@@ -263,8 +249,6 @@ async def start_server(cb, host, port, backlog=5):
263249
writer streams for the connection.
264250
265251
Returns a `Server` object.
266-
267-
This is a coroutine.
268252
"""
269253

270254
import socket

0 commit comments

Comments
 (0)