# Archive

from direct.pyinst.archive_rt import Archive

A base class for a repository of python code objects. The extract method is used by imputil.ArchiveImporter to get code objects by name (fully qualified name), so an enduser "import a.b" would become extract('a.__init__') extract('a.b')

## Inheritance:

Archive:

## Methods of Archive:

__init__
checkmagic
contents
extract
get_code
loadtoc

__init__ def __init__(self, path=None, start=0) Initialize an Archive. If path is omitted, it will be an empty Archive.

checkmagic def checkmagic(self) Overridable. Check to see if the file object self.lib actually has a file we understand.

contents def contents(self) Return a list of the contents Default implementation assumes self.toc is a dict like object. Not required by ArchiveImporter.

extract def extract(self, name) Get the object corresponding to name, or None. For use with imputil ArchiveImporter, object is a python code object. 'name' is the name as specified in an 'import name'. 'import a.b' will become: extract('a') (return None because 'a' is not a code object) extract('a.__init__') (return a code object) extract('a.b') (return a code object) Default implementation: self.toc is a dict self.toc[name] is pos self.lib has the code object marshal-ed at pos

get_code def get_code(self, parent, modname, fqname) Undocumented function.

loadtoc def loadtoc(self) Overridable. Default: After magic comes an int (4 byte native) giving the position of the TOC within self.lib. Default: The TOC is a marshal-able string.