MCPcopy Create free account
hub / github.com/EasyIME/PIME / consume

Method consume

python/python3/tornado/test/iostream_test.py:698–715  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

696
697 @gen.coroutine
698 def consume():
699 remaining = nbytes
700 while remaining > 0:
701 if r.random() > 0.5:
702 # read_bytes()
703 size = r.randint(1, min(1000, remaining))
704 data = yield rs.read_bytes(size)
705 consume_hash.update(data)
706 remaining -= size
707 else:
708 # read_into()
709 size = r.randint(1, min(1000, remaining))
710 buf = bytearray(size)
711 n = yield rs.read_into(buf)
712 assert n == size
713 consume_hash.update(buf)
714 remaining -= size
715 assert remaining == 0
716
717 try:
718 yield [produce(), consume()]

Callers

nothing calls this directly

Calls 3

read_bytesMethod · 0.80
read_intoMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected