r""" >>> import io >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00')) 255 >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31) True
(f)
| 250 | |
| 251 | |
| 252 | def read_int4(f): |
| 253 | r""" |
| 254 | >>> import io |
| 255 | >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00')) |
| 256 | 255 |
| 257 | >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31) |
| 258 | True |
| 259 | """ |
| 260 | |
| 261 | data = f.read(4) |
| 262 | if len(data) == 4: |
| 263 | return _unpack("<i", data)[0] |
| 264 | raise ValueError("not enough data in stream to read int4") |
| 265 | |
| 266 | int4 = ArgumentDescriptor( |
| 267 | name='int4', |
no test coverage detected
searching dependent graphs…