@@ -85,18 +85,19 @@ calling :meth:`PushMultipartParser.close` explicitly.
8585Dealing with IO
8686---------------
8787
88- The :meth: `parse() <PushMultipartParser.parse> ` method does not know how to fetch more
89- data, it just stops yielding events and waits for you to call it again with more
90- data. This makes the parser loop more complicated than it needs to be in most situations.
91-
92- If you can provide a blocking or async function that returns the next chunk, then
93- you can reduce the parser loop complexity a bit and switch to
88+ The :meth: `parse() <PushMultipartParser.parse> ` method does not know how to
89+ fetch more data. It just stops yielding events and waits for you to call it
90+ again with the next chunk. This low-level mode of operation is very flexible,
91+ but sometimes more complicated than it needs to be.
92+
93+ If you can provide some blocking or async function that returns the next chunk
94+ when called, then you can skip some of the complexity of
95+ :meth: `parse() <PushMultipartParser.parse> ` and use
9496:meth: `parse_blocking() <PushMultipartParser.parse_blocking> ` or
95- :meth: `parse_async() <PushMultipartParser.parse_async> `, depending on your
96- environment.
97+ :meth: `parse_async() <PushMultipartParser.parse_async> ` instead.
9798
98- Here is a simplified parser loop that reads from a *blocking * stream like a
99- socket or ``environ[wsgi.input] ``:
99+ Here is what the parser loop may look like in a *blocking * environment. Instead
100+ of an abstract blocking stream you could also read from a socket or ``environ[wsgi.input] ``:
100101
101102.. code-block :: python
102103
@@ -107,7 +108,7 @@ socket or ``environ[wsgi.input]``:
107108 for event in parser.parse_blocking(stream.read):
108109 pass # Handle parser events
109110
110- And here is the same loop with an ` awaitable ` read function :
111+ And here is the same loop with an * awaitable * stream :
111112
112113.. code-block :: python
113114
0 commit comments