Skip to content

Commit 7aaa344

Browse files
committed
Don't use _nowait version of put
1 parent d5206fd commit 7aaa344

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/string_processing_pipeline.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class HiSayer:
4040

4141
async def run(self):
4242
for i in range(20):
43-
self.out_lines.put_nowait(f"Hi hi for the {i+1}:th time...")
44-
self.out_lines.task_done()
43+
await self.out_lines.put(f"Hi hi for the {i+1}:th time...")
4544

4645

4746
class StringSplitter:
@@ -52,8 +51,8 @@ class StringSplitter:
5251
async def run(self):
5352
while not self.in_lines.empty():
5453
s = await self.in_lines.get()
55-
self.out_leftpart.put_nowait(s[: int(len(s) / 2)])
56-
self.out_rightpart.put_nowait(s[int(len(s) / 2) :])
54+
await self.out_leftpart.put(s[: int(len(s) / 2)])
55+
await self.out_rightpart.put(s[int(len(s) / 2) :])
5756

5857

5958
class LowerCaser:
@@ -63,7 +62,7 @@ class LowerCaser:
6362
async def run(self):
6463
while not self.in_lines.empty():
6564
s = await self.in_lines.get()
66-
self.out_lines.put_nowait(s.lower())
65+
await self.out_lines.put(s.lower())
6766

6867

6968
class UpperCaser:
@@ -73,7 +72,7 @@ class UpperCaser:
7372
async def run(self):
7473
while not self.in_lines.empty():
7574
s = await self.in_lines.get()
76-
self.out_lines.put_nowait(s.upper())
75+
await self.out_lines.put(s.upper())
7776

7877

7978
class StringJoiner:
@@ -85,7 +84,7 @@ async def run(self):
8584
while not self.in_leftpart.empty() or not self.in_rightpart.empty():
8685
leftpart = await self.in_leftpart.get()
8786
rightpart = await self.in_rightpart.get()
88-
self.out_lines.put_nowait(f"{leftpart}{rightpart}")
87+
await self.out_lines.put(f"{leftpart}{rightpart}")
8988

9089

9190
class Printer:

0 commit comments

Comments
 (0)