MCPcopy Index your code
hub / github.com/RustPython/RustPython / read_uint4

Function read_uint4

Lib/pickletools.py:273–285  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

271
272
273def 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
287uint4 = ArgumentDescriptor(
288 name='uint4',

Callers 2

read_bytes4Function · 0.85
read_unicodestring4Function · 0.85

Calls 2

lenFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected