Collects info about imports for a module.
Methods
|
|
__init__
__str__
addImport
importedSymbols
items
|
|
__init__
|
__init__ ( self )
|
|
__str__
|
__str__ ( self )
|
|
addImport
|
addImport (
self,
moduleName,
symbolName=None,
asName=None,
)
Add information about an import statement to the saved info.
Parameters
- moduleName
- The name of the module involved in the import.
For example, in
from X import Y , X is the moduleName and
in import A.B , A.B is the moduleName.
- symbolName
- The name of the symbol being imported. For
example, in
from X import Y , Y is the symbolName.
- asName
- The name within the module by which symbolName can
be referenced. Usually, this is the same as symbolName, but
by using the
import X as Y syntax, the name can be changed.
|
|
importedSymbols
|
importedSymbols ( self, moduleName )
Exceptions
|
|
ValueError( 'No symbols imported for module', moduleName )
|
|
|
items
|
items ( self )
Returns a sequence of tuples containing module names and the
symbols imported from them.
|
|