MCPcopy Index your code
hub / github.com/python/cpython / read_uint2

Function read_uint2

Lib/pickletools.py:231–243  ·  view source on GitHub ↗

r""" >>> import io >>> read_uint2(io.BytesIO(b'\xff\x00')) 255 >>> read_uint2(io.BytesIO(b'\xff\xff')) 65535

(f)

Source from the content-addressed store, hash-verified

229
230
231def read_uint2(f):
232 r"""
233 >>> import io
234 >>> read_uint2(io.BytesIO(b'\xff\x00'))
235 255
236 >>> read_uint2(io.BytesIO(b'\xff\xff'))
237 65535
238 """
239
240 data = f.read(2)
241 if len(data) == 2:
242 return _unpack("<H", data)[0]
243 raise ValueError("not enough data in stream to read uint2")
244
245uint2 = ArgumentDescriptor(
246 name='uint2',

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…