r""" >>> import io >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00')) 255 >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31 True
(f)
| 271 | |
| 272 | |
| 273 | def read_uint4(f): |
| 274 | r""" |
| 275 | >>> import io |
| 276 | >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00')) |
| 277 | 255 |
| 278 | >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31 |
| 279 | True |
| 280 | """ |
| 281 | |
| 282 | data = f.read(4) |
| 283 | if len(data) == 4: |
| 284 | return _unpack("<I", data)[0] |
| 285 | raise ValueError("not enough data in stream to read uint4") |
| 286 | |
| 287 | uint4 = ArgumentDescriptor( |
| 288 | name='uint4', |
no test coverage detected