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

Function read_code

Lib/pkgutil.py:24–34  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

22
23
24def read_code(stream):
25 # This helper is needed in order for the PEP 302 emulation to
26 # correctly handle compiled files
27 import marshal
28
29 magic = stream.read(4)
30 if magic != importlib.util.MAGIC_NUMBER:
31 return None
32
33 stream.read(12) # Skip rest of the header
34 return marshal.load(stream)
35
36
37def walk_packages(path=None, prefix='', onerror=None):

Callers 1

_get_code_from_fileFunction · 0.90

Calls 2

readMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…