Representation of modules.
Class |
|
Inferred information about a module. |
Function | get |
Joins a dotted-name prefix and a relative name. |
Function | get |
Return all the prefixes of a module name. |
Function | get |
Get the module name, or None if we can't determine it. |
Function | get |
Figure out a package name for a module. |
Function | infer |
Convert a filename to a module relative to pythonpath. |
Function | path |
Converts a filename into a dotted module name. |
Function | strip |
Undocumented |
Joins a dotted-name prefix and a relative name. Args: prefix: A dotted name, e.g. foo.bar.baz relative_name: A dotted name with possibly some leading dots, e.g. ..x.y Returns: The relative name appended to the prefix, after going up one level for each leading dot. e.g. foo.bar.baz + ..hello.world -> foo.bar.hello.world None if the relative name has too many leading dots.
Return all the prefixes of a module name. e.g. x.y.z => x, x.y, x.y.z Args: module_name: module name Returns: List of prefixes
Convert a filename to a module relative to pythonpath. This method tries to deduce the module name from the pythonpath and the filename. This will not always be possible. (It depends on the filename starting with an entry in the pythonpath.) Args: filename: The filename of a Python file. E.g. "foo/bar/baz.py". pythonpath: The path Python uses to search for modules. Returns: A Module object.