MCPcopy Create free account
hub / github.com/numpy/numpy / BytesIOSRandomSize

Class BytesIOSRandomSize

numpy/lib/tests/test_format.py:400–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398
399#BytesIO that reads a random number of bytes at a time
400class BytesIOSRandomSize(BytesIO):
401 def read(self, size=None):
402 import random
403 size = random.randint(1, size)
404 return super().read(size)
405
406
407def roundtrip(arr):

Callers 1

roundtrip_randsizeFunction · 0.85

Calls

no outgoing calls

Tested by 1

roundtrip_randsizeFunction · 0.68