r""" >>> import io >>> read_bytes1(io.BytesIO(b"\x00")) b'' >>> read_bytes1(io.BytesIO(b"\x03abcdef")) b'abc'
(f)
| 470 | |
| 471 | |
| 472 | def read_bytes1(f): |
| 473 | r""" |
| 474 | >>> import io |
| 475 | >>> read_bytes1(io.BytesIO(b"\x00")) |
| 476 | b'' |
| 477 | >>> read_bytes1(io.BytesIO(b"\x03abcdef")) |
| 478 | b'abc' |
| 479 | """ |
| 480 | |
| 481 | n = read_uint1(f) |
| 482 | assert n >= 0 |
| 483 | data = f.read(n) |
| 484 | if len(data) == n: |
| 485 | return data |
| 486 | raise ValueError("expected %d bytes in a bytes1, but only %d remain" % |
| 487 | (n, len(data))) |
| 488 | |
| 489 | bytes1 = ArgumentDescriptor( |
| 490 | name="bytes1", |
nothing calls this directly
no test coverage detected
searching dependent graphs…