class PythonModule(_ModuleIteratorHelper): (source)
Method | __eq__ |
PythonModules with the same name are equal. |
Method | __init__ |
Create a PythonModule. Do not construct this directly, instead inspect a PythonPath or other PythonModule instances. |
Method | __repr__ |
Return a string representation including the module name. |
Method | isLoaded |
Determine if the module is loaded into sys.modules. |
Method | isPackage |
Returns true if this module is also a package, and might yield something from iterModules. |
Method | iterAttributes |
List all the attributes defined in this module. |
Method | load |
Load this module. |
Method | walkModules |
Similar to iterModules , this yields self, and then every module in my package or entry, and every submodule in each package or entry. |
Instance Variable | filePath |
a FilePath-like object which points to the location of this module. |
Instance Variable | name |
the fully qualified python name of this module. |
Instance Variable | parentPath |
Undocumented |
Instance Variable | pathEntry |
a PathEntry instance which this module was located from. |
Method | _getEntry |
Implement in subclasses to specify what path entry submodules will come from. |
Method | _packagePaths |
Yield a sequence of FilePath-like objects which represent path segments. |
Method | _subModuleName |
submodules of this module are prefixed with our name. |
Inherited from _ModuleIteratorHelper
:
Method | __getitem__ |
Retrieve a module from below this path or package. |
Method | __iter__ |
Implemented to raise NotImplementedError for clarity, so that attempting to loop over this object won't call __getitem__. |
Method | iterModules |
Loop over the modules present below this entry or package on PYTHONPATH. |
Parameters | |
name | see ivar |
filePath | see ivar |
pathEntry | see ivar |
List all the attributes defined in this module.
Note: Future work is planned here to make it possible to list python attributes on a module without loading the module by inspecting ASTs or bytecode, but currently any iteration of PythonModule objects insists they must be loaded, and will use inspect.getmodule.
Returns | |
a generator yielding PythonAttribute instances describing the attributes of this module. | |
Raises | |
NotImplementedError | if this module is not loaded. |
Parameters | |
default | if specified, the value to return in case of an error. |
Returns | |
types.ModuleType. | a genuine python module. |
Raises | |
Exception | Importing modules is a risky business; the erorrs of any code run at module scope may be raised from here, as well as ImportError if something bizarre happened to the system path between the discovery of this PythonModule object and the attempt to import it. If you specify a default, the error will be swallowed entirely, and not logged. |
Similar to iterModules
, this yields self, and then every module in my package or entry, and every submodule in each package or entry.
In other words, this is deep, and iterModules
is shallow.
Returns | |
a PathEntry instance. |