|
Panda3D
|
Public Member Functions | |
| def | __init__ |
| def | checkmagic |
| Sub-methods of __init__ - override as needed #############. | |
| def | contents |
| Informational methods. | |
| def | extract |
| Core method - Override as needed #########. | |
| def | get_code |
| This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname. | |
| def | loadtoc |
Public Attributes | |
| lib | |
| path | |
| pymagic | |
| start | |
| toc | |
Static Public Attributes | |
| int | HDRLEN = 12 |
| string | MAGIC = 'PYL\0' |
| os = None | |
| int | TOCPOS = 8 |
| dictionary | TOCTMPLT = {} |
| int | TRLLEN = 0 |
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')
| def __init__ | ( | self, | |
path = None, |
|||
start = 0 |
|||
| ) |
Reimplemented in ZlibArchive.
| def checkmagic | ( | self | ) |
Sub-methods of __init__ - override as needed #############.
Overridable. Check to see if the file object self.lib actually has a file we understand.
Reimplemented in CArchive.
| def contents | ( | self | ) |
Informational methods.
Return a list of the contents Default implementation assumes self.toc is a dict like object. Not required by ArchiveImporter.
Reimplemented in CArchive.
| def extract | ( | self, | |
| name | |||
| ) |
Core method - Override as needed #########.
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
Reimplemented in ZlibArchive, and CArchive.
| def get_code | ( | self, | |
| parent, | |||
| modname, | |||
| fqname | |||
| ) |
This is what is called by FuncImporter ####### Since an Archive is flat, we ignore parent and modname.
| 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.
Reimplemented in CArchive.
int HDRLEN = 12 [static] |
Reimplemented in ZlibArchive, and CArchive.
string MAGIC = 'PYL\0' [static] |
Reimplemented in ZlibArchive, and CArchive.
os = None [static] |
int TOCPOS = 8 [static] |
Reimplemented in ZlibArchive.
dictionary TOCTMPLT = {} [static] |
Reimplemented in ZlibArchive, and CArchive.
int TRLLEN = 0 [static] |
Reimplemented in ZlibArchive, and CArchive.
1.7.3