Skip to content

Commit 1c0ca83

Browse files
committed
extmod/uasyncio: Fix syntax of generator functions
1 parent ab0258f commit 1c0ca83

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

extmod/uasyncio/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def set(self):
2323
def clear(self):
2424
self.state = False
2525

26-
async def wait(self):
26+
def wait(self):
2727
if not self.state:
2828
# Event not set, put the calling task on the event's waiting queue
2929
self.waiting.push(core.cur_task)

extmod/uasyncio/funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from . import core
55

66

7-
def _run(waiter, aw):
7+
async def _run(waiter, aw):
88
try:
99
result = await aw
1010
status = True
@@ -61,7 +61,7 @@ def remove(t):
6161
pass
6262

6363

64-
async def gather(*aws, return_exceptions=False):
64+
def gather(*aws, return_exceptions=False):
6565
if not aws:
6666
return []
6767

extmod/uasyncio/lock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def release(self):
2828
# No Task waiting so unlock
2929
self.state = 0
3030

31-
async def acquire(self):
31+
def acquire(self):
3232
if self.state != 0:
3333
# Lock unavailable, put the calling Task on the waiting queue
3434
self.waiting.push(core.cur_task)

extmod/uasyncio/stream.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def wait_closed(self):
2626
# TODO yield?
2727
self.s.close()
2828

29-
async def read(self, n=-1):
29+
def read(self, n=-1):
3030
r = b""
3131
while True:
3232
yield core._io_queue.queue_read(self.s)
@@ -38,11 +38,11 @@ async def read(self, n=-1):
3838
return r
3939
r += r2
4040

41-
async def readinto(self, buf):
41+
def readinto(self, buf):
4242
yield core._io_queue.queue_read(self.s)
4343
return self.s.readinto(buf)
4444

45-
async def readexactly(self, n):
45+
def readexactly(self, n):
4646
r = b""
4747
while n:
4848
yield core._io_queue.queue_read(self.s)
@@ -54,7 +54,7 @@ async def readexactly(self, n):
5454
n -= len(r2)
5555
return r
5656

57-
async def readline(self):
57+
def readline(self):
5858
l = b""
5959
while True:
6060
yield core._io_queue.queue_read(self.s)
@@ -73,10 +73,10 @@ def write(self, buf):
7373
buf = buf[ret:]
7474
self.out_buf += buf
7575

76-
async def drain(self):
76+
def drain(self):
7777
if not self.out_buf:
7878
# Drain must always yield, so a tight loop of write+drain can't block the scheduler.
79-
return await core.sleep_ms(0)
79+
return (yield from core.sleep_ms(0))
8080
mv = memoryview(self.out_buf)
8181
off = 0
8282
while off < len(mv):
@@ -93,7 +93,7 @@ async def drain(self):
9393

9494

9595
# Create a TCP stream connection to a remote host
96-
async def open_connection(host, port):
96+
def open_connection(host, port):
9797
from uerrno import EINPROGRESS
9898
import usocket as socket
9999

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy