r""" >>> import io >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00')) 255 >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1 True
(f)
| 292 | |
| 293 | |
| 294 | def read_uint8(f): |
| 295 | r""" |
| 296 | >>> import io |
| 297 | >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00')) |
| 298 | 255 |
| 299 | >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1 |
| 300 | True |
| 301 | """ |
| 302 | |
| 303 | data = f.read(8) |
| 304 | if len(data) == 8: |
| 305 | return _unpack("<Q", data)[0] |
| 306 | raise ValueError("not enough data in stream to read uint8") |
| 307 | |
| 308 | uint8 = ArgumentDescriptor( |
| 309 | name='uint8', |
no test coverage detected