@@ -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
4746class 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
5958class 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
6968class 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
7978class 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
9190class Printer :
0 commit comments