MCPcopy Create free account
hub / github.com/ActiveState/code / unpack_pyc

Function unpack_pyc

recipes/Python/577880_Inspect__a_PYC_File/recipe-577880.py:42–49  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

40 return template % tuple(ord(char) for char in bytes_value)
41
42def unpack_pyc(filename):
43 f = open(filename, "rb")
44 magic = f.read(4)
45 unixtime = struct.unpack("L", f.read(4))[0]
46 timestamp = time.asctime(time.localtime(unixtime))
47 code = marshal.load(f)
48 f.close()
49 return filename, magic, unixtime, timestamp, code
50
51def show_consts(consts, level=0):
52 indent = INDENT*level

Callers 1

show_fileFunction · 0.85

Calls 7

asctimeMethod · 0.80
localtimeMethod · 0.80
openFunction · 0.50
readMethod · 0.45
unpackMethod · 0.45
loadMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected