def extract(self, name):
(typ, pos, length) = self.toc.get(name, (0, None, 0))
if pos is None:
return None
with self.lib:
self.lib.seek(self.start + pos)
obj = self.lib.read(length)
try:
if self.cipher:
obj = self.cipher.decrypt(obj)
obj = zlib.decompress(obj)
if typ in (PYZ_TYPE_MODULE, PYZ_TYPE_PKG):
obj = marshal.loads(obj)
except EOFError:
raise ImportError("PYZ entry '%s' failed to unmarshal" % name)
return typ, obj
评论列表
文章目录