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

Method waituntil

aiohttp/parsers.py:432–456  ·  view source on GitHub ↗

waituntil() reads until `stop` bytes sequence.

(self, stop, limit=None)

Source from the content-addressed store, hash-verified

430 self._writer.send((yield))
431
432 def waituntil(self, stop, limit=None):
433 """waituntil() reads until `stop` bytes sequence."""
434 assert isinstance(stop, bytes) and stop, \
435 'bytes is required: {!r}'.format(stop)
436
437 stop_len = len(stop)
438
439 while True:
440 if self._helper.exception:
441 raise self._helper.exception
442
443 pos = self._data.find(stop)
444 if pos >= 0:
445 size = pos + stop_len
446 if limit is not None and size > limit:
447 raise errors.LineLimitExceededParserError(
448 'Line is too long. %s' % bytes(self._data), limit)
449
450 return self._data[:size]
451 else:
452 if limit is not None and len(self._data) > limit:
453 raise errors.LineLimitExceededParserError(
454 'Line is too long. %s' % bytes(self._data), limit)
455
456 self._writer.send((yield))
457
458 def skip(self, size):
459 """skip() skips specified amount of bytes."""

Callers 6

__call__Method · 0.80
test_waituntil_limitFunction · 0.80
test_waituntil_limit2Function · 0.80
test_waituntil_limit3Function · 0.80
test_waituntilFunction · 0.80
test_waituntil_excFunction · 0.80

Calls 1

sendMethod · 0.45

Tested by 5

test_waituntil_limitFunction · 0.64
test_waituntil_limit2Function · 0.64
test_waituntil_limit3Function · 0.64
test_waituntilFunction · 0.64
test_waituntil_excFunction · 0.64