MCPcopy
hub / github.com/aio-libs/aiohttp / unset_parser

Method unset_parser

aiohttp/parsers.py:204–225  ·  view source on GitHub ↗

unset parser, send eof to the parser and then remove it.

(self)

Source from the content-addressed store, hash-verified

202 return output
203
204 def unset_parser(self):
205 """unset parser, send eof to the parser and then remove it."""
206 if self._parser is None:
207 return
208
209 # TODO: write test
210 if hasattr(self._loop, 'is_closed'):
211 if self._loop.is_closed():
212 # TODO: log something
213 return
214
215 try:
216 self._parser.throw(EofStream())
217 except StopIteration:
218 self._output.feed_eof()
219 except EofStream:
220 self._output.set_exception(self._eof_exc_class())
221 except Exception as exc:
222 self._output.set_exception(exc)
223 finally:
224 self._output = None
225 self._parser = None
226
227
228class StreamWriter(asyncio.streams.StreamWriter):

Callers 9

set_parserMethod · 0.95
test_set_parser_unsetFunction · 0.95
test_unset_parser_stopFunction · 0.95
releaseMethod · 0.80
_releaseMethod · 0.80
startMethod · 0.80

Calls 4

EofStreamClass · 0.85
throwMethod · 0.80
feed_eofMethod · 0.45
set_exceptionMethod · 0.45

Tested by 5

test_set_parser_unsetFunction · 0.76
test_unset_parser_stopFunction · 0.76