| java.lang.Object org.python.core.imp
imp | public class imp (Code) | | Utility functions for "import" support.
|
Method Summary | |
public static PyModule | addModule(String name) If the given name is found in sys.modules, the entry from there is
returned. | public static String | cacheCompiledSource(String sourceFilename, String compiledFilename, byte[] compiledSource) Stores the bytes in compiledSource in compiledFilename. | public static boolean | caseok(File file, String filename, int namelen) | public static byte[] | compileSource(String name, File file, String sourceFilename, String compiledFilename) | static byte[] | compileSource(String name, InputStream fp, String filename) | static PyObject | createFromClass(String name, Class c) | static PyObject | createFromCode(String name, PyCode c) Returns a module with the given name whose contents are the results of
running c. | static PyObject | createFromCode(String name, PyCode c, String moduleLocation) | static PyObject | createFromPyClass(String name, InputStream fp, boolean testing, String fileName) | public static PyObject | createFromSource(String name, InputStream fp, String filename) | static PyObject | createFromSource(String name, InputStream fp, String filename, String outFilename) | public static String | defaultEmptyPathDirectory(String directoryName) If directoryName is empty, return a correct directory name for a path. | static PyObject | find_module(String name, String moduleName, PyList path) | static PyObject | getPathImporter(PyObject cache, PyList hooks, PyObject p) | public static ClassLoader | getSyspathJavaLoader() | public static void | importAll(String mod, PyFrame frame) Called from jython generated code when a statement like "from spam.eggs
import *" is executed. | public static PyObject[] | importFrom(String mod, String[] names, PyFrame frame) Called from jython generated code when a stamenet like "from spam.eggs
import foo, bar" is executed. | public static PyObject[] | importFromAs(String mod, String[] names, String[] asnames, PyFrame frame) Called from jython generated code when a statement like "from spam.eggs
import foo as spam" is executed. | public static PyObject | importName(String name, boolean top) Import a module by name. | public static synchronized PyObject | importName(String name, boolean top, PyObject modDict, PyObject fromlist) Import a module by name. | public static PyObject | importOne(String mod, PyFrame frame) Called from jython generated code when a statement like "import spam" is
executed. | public static PyObject | importOneAs(String mod, PyFrame frame) Called from jython generated code when a statement like "import spam as
foo" is executed. | public static PyObject | load(String name) Load the module by name. | public static PyObject | loadFromCompiled(String name, InputStream stream, String filename) | static PyObject | loadFromLoader(PyObject importer, String name) | static PyObject | loadFromSource(String name, String modName, PyObject entry) | static PyObject | reload(PyJavaClass c) | static PyObject | reload(PyModule m) | static PyObject | replacePathItem(PyObject path) |
APIVersion | final public static int APIVersion(Code) | | |
addModule | public static PyModule addModule(String name)(Code) | | If the given name is found in sys.modules, the entry from there is
returned. Otherwise a new PyModule is created for the name and added to
sys.modules
|
cacheCompiledSource | public static String cacheCompiledSource(String sourceFilename, String compiledFilename, byte[] compiledSource)(Code) | | Stores the bytes in compiledSource in compiledFilename.
If compiledFilename is null it's set to the results of
makeCompiledFilename(sourcefileName)
If sourceFilename is null or set to UNKNOWN_SOURCEFILE null is returned
the compiledFilename eventually used or null if acompiledFilename couldn't be determined of if an error was thrownwhile writing to the cache file. |
caseok | public static boolean caseok(File file, String filename, int namelen)(Code) | | |
createFromCode | static PyObject createFromCode(String name, PyCode c)(Code) | | Returns a module with the given name whose contents are the results of
running c. __file__ is set to whatever is in c.
|
defaultEmptyPathDirectory | public static String defaultEmptyPathDirectory(String directoryName)(Code) | | If directoryName is empty, return a correct directory name for a path.
If directoryName is not an empty string, this method returns directoryName unchanged.
|
importAll | public static void importAll(String mod, PyFrame frame)(Code) | | Called from jython generated code when a statement like "from spam.eggs
import *" is executed.
|
importFrom | public static PyObject[] importFrom(String mod, String[] names, PyFrame frame)(Code) | | Called from jython generated code when a stamenet like "from spam.eggs
import foo, bar" is executed.
|
importFromAs | public static PyObject[] importFromAs(String mod, String[] names, String[] asnames, PyFrame frame)(Code) | | Called from jython generated code when a statement like "from spam.eggs
import foo as spam" is executed.
|
importName | public static PyObject importName(String name, boolean top)(Code) | | Import a module by name.
Parameters: name - the name of the package to import Parameters: top - if true, return the top module in the name, otherwise the last an imported module (Java or Python) |
importName | public static synchronized PyObject importName(String name, boolean top, PyObject modDict, PyObject fromlist)(Code) | | Import a module by name. This is the default call for
__builtin__.__import__.
Parameters: name - the name of the package to import Parameters: top - if true, return the top module in the name, otherwise the last Parameters: modDict - the __dict__ of an already imported module an imported module (Java or Python) |
importOne | public static PyObject importOne(String mod, PyFrame frame)(Code) | | Called from jython generated code when a statement like "import spam" is
executed.
|
importOneAs | public static PyObject importOneAs(String mod, PyFrame frame)(Code) | | Called from jython generated code when a statement like "import spam as
foo" is executed.
|
load | public static PyObject load(String name)(Code) | | Load the module by name. Upon loading the module it will be added to
sys.modules.
Parameters: name - the name of the module to load the loaded module |
|
|