| Modifier and Type | Class and Description |
|---|---|
| public static class | imp.
A bundle of a file name, the file's content and a last modified time, with no behaviour. |
| pack-priv static enum | imp.
A two-way selector given to
|
| Modifier and Type | Field and Description |
|---|---|
| private static final PyTuple | |
| private static final int | |
| public static final int | |
| private static LimitedCache | fileSystemDecodeCache
This cache supports |
| private static final boolean | |
| private static Logger | |
| public static final int | |
| private static final PyObject | nonEmptyFromlist
A non-empty fromlist for __import__'ing sub-modules. |
| private static final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static PyObject | |
| public static PyModule | |
| public static String | Returns: the compiledFilename eventually used; or null if a compiledFilename couldn't be determined or if an error was thrown while writing to the cache file.Stores the bytes in compiledSource in compiledFilename. |
| public static boolean | |
| private static void | |
| private static void | |
| public static byte[] | Returns: Java byte code as arrayof module (class name will be name$py) name, File file containing the source source)Compile Python source in file to a class file represented by a byte array. |
| public static byte[] | Returns: Java byte code as arrayof module (class name will be name$py) name, File file containing the source source, String explicit source file name (or filename)null to use that in source)Compile Python source in file to a class file represented by a byte array. |
| public static byte[] | Returns: Java byte code as arrayof module (class name will be name$py) name, File file containing the source source, String explicit source file name (or sourceFilename, String null to use that in source)ignored (huh?) compiledFilename)
Deprecated
Use
compileSource(String, File, String) instead.
Compile Python source in file to a class file represented by a byte array. |
| public static byte[] | Returns: Java byte code as arrayof module (class name will be name$py) name, InputStream open input stream (will be closed) source, String of source (or filename)null if unknown)Compile Python source to a class file represented by a byte array. |
| public static byte[] | Returns: Java byte code as arrayof module (class name will be name$py) name, InputStream open input stream (will be closed) source, String of source (or filename, long null if unknown)last-modified time of source, to annotate class mtime)Compile Python source to a class file represented by a byte array. |
| pack-priv static PyObject | |
| public static PyObject | createFromCode(String name, PyCode c)
Returns a module with the given name whose contents are the results of running c. |
| public static PyObject | Returns: the module objectfully-qualified name of the module name, PyCode code supplying the module c, String to become moduleLocation)__file__ if not nullReturn a Python module with the given |
| pack-priv static PyObject | Returns: the module ornull on failure (if testing).module name on which to base the class name as name, InputStream name + "$py"stream from which to read class file (closed when read) fp, boolean if testing, String true, failures are signalled by a null not an exceptionused for identification in messages and the constructor of the named class. sourceName, String used for identification in messages and compiledName)__file__.As |
| pack-priv static PyObject | Returns: the module ornull on failure (if testing).module name on which to base the class name as name, InputStream name + "$py"stream from which to read class file (closed when read) fp, boolean if testing, String true, failures are signalled by a null not an exceptionused for identification in messages and the constructor of the named class. sourceName, String used for identification in messages and compiledName, long __file__.time expected to match sourceLastModified)MTime annotation in the class fileAs |
| pack-priv static PyObject | Returns: the module ornull on failure (if testing).module name on which to base the class name as name, InputStream name + "$py"stream from which to read class file (closed when read) fp, boolean if testing, String true, failures are signalled by a null not an exceptionused for identification in messages. sourceName, String used for identification in messages and compiledName, long __file__.time expected to match sourceLastModified, imp.MTime annotation in the class filechoose what to use as the file name when initialising the class sourceCreate a Python module from its compiled form, reading the class file from the open input stream passed in (which is closed once read). |
| public static PyObject | |
| public static PyObject | |
| public static PyObject | Returns: created moduleof the module to create (class will be name$py) name, InputStream opened on the (Jython) source to compile (will be closed) fp, String of the source backing filename, String fp (to embed in class as data)in which to write the compiled class outFilename, long last modified time of the file backing mtime)fpCompile Jython source (as an |
| private static void | ensureFromList(PyObject
module we are importing from mod, PyObject tuple of names to import fromlist, String of module we are importing from (as given, may be relative) name)Ensure that the items mentioned in the from-list of an import are actually present, even if they are modules we have not imported yet. |
| private static void | ensureFromList(PyObject
module we are importing from mod, PyObject tuple of names to import fromlist, String of module we are importing from (as given, may be relative) name, boolean true, when this method calls itself recursive)Ensure that the items mentioned in the from-list of an import are actually present, even if they are modules we have not imported yet. |
| public static String | Returns: String form of the objectp (or null).assumed to be a (partial) file path p, boolean if true and raiseImportError)p cannot be decoded raise ImportError.A wrapper for |
| public static String | Returns: String form of the objectp.assumed to be a (partial) file path p)For project internal use, equivalent to |
| pack-priv static PyObject | Returns: the module if we can load it (ornull if we can't).simple name of the module. name, String fully-qualified (dotted) name of the module (ending in moduleName, PyList name).__path__ of the enclosing package (or null if top level).Try to load a Python module from |
| private static String | Returns: the parent name for a modulethe __dict__ of a loaded module that is the context of the import statement dict, int used for relative and absolute imports. -1 means try both, 0 means absolute
only, positive ints represent the level to look upward for a relative path (1
means current package, 2 means one level up). See PEP 328 at
http://www.python.org/dev/peps/pep-0328/ level)Find the parent package name for a module. |
| public static int | |
| public static PyObject | |
| public static ClassLoader | Returns: the parent class loader for Jython or null if both the current and context class loaders are null.Selects the parent class loader for Jython, to be used for dynamically loaded classes and resources. |
| pack-priv static PyObject | Returns: the importer object for the path element orPy.None for "fall-back".normally cache, PyList sys.path_importer_cachenormally (@code sys.path_hooks} hooks, PyObject an element of p)sys.path or of a package's __path__Return an importer object for an element of |
| public static ClassLoader | |
| private static PyObject | Returns: the named module (nevernull or None)fully-qualified name of module to import name, StringBuilder import a.b.c.mused as a workspace as the search descends the package hierarchy parentName)Top of the import logic in the case of a simple |
| private static PyObject | Returns: the named module (never returnsnull or None)fully-qualified name of module to import name, StringBuilder a.b.c.m.used as a workspace as the search descends the package hierarchy parentName, String the "outer" name by which the module is known fullName, PyObject a.b.c.m.names to import from the module fromlist)n1, n2, n3.Top of the import logic in the case of a complex |
| private static PyObject | Returns: the last named module (nevernull or None)top module of the import mod, StringBuilder used as a workspace as the search descends the package hierarchy parentName, String b.c.ma.b.c.mnames to import from the module fromlist)n1, n2, n3.Iterate through the components (after the first) of a fully-qualified module name
|
| private static PyObject | Returns: an imported module (Java or Python)qualified name of the package/module to import (may be relative) name, boolean if true, return the top module in the name, otherwise the last top, PyObject the __dict__ of the importing module (used to navigate a relative import) modDict, PyObject list of names being imported fromlist, int 0=absolute, n>0=relative levels to go up - 1, -1=try relative then absolute. level)Import a module by name. |
| private static PyObject | import_next(PyObject
if not mod, StringBuilder null, a package where the module may be an attribute.parent name of the module. (Buffer is appended with "." and parentName, String name.the (simple) name of the module to load name, String name to use with the outerFullName, PyObject JavaImportHelper.if not fromlist)null the import is from <module> import <fromlist>Try to import the module named by parentName.name. |
| public static void | |
| public static void | |
| public static void | |
| public static PyObject[] | importFrom(String mod, String[] names, PyFrame frame)
Deprecated
use importFrom with level param.
replaced by importFrom with level param. |
| public static PyObject[] | importFrom(String mod, String[] names, PyFrame frame, int level)
Called from jython generated code when a statement like "from spam.eggs import foo, bar" is executed. |
| public static PyObject[] | importFromAs(String mod, String[] names, PyFrame frame)
Deprecated
use importFromAs with level param.
replaced by importFromAs with level param. |
| public static PyObject[] | importFromAs(String mod, String[] names, String[] asnames, PyFrame frame, int level)
Called from jython generated code when a statement like "from spam.eggs import foo as spam" is executed. |
| public static PyObject | Returns: an imported module (Java or Python)the name of the package to import name, boolean if true, return the top module in the name, otherwise the last top)Import a module by name. |
| public static PyObject | Returns: an imported module (Java or Python)the fully-qualified name of the package/module to import name, boolean if true, return the top module in the name, otherwise the last top, PyObject the __dict__ of the importing module (used for name in relative import) modDict, PyObject list of names being imported fromlist, int 0=absolute, n>0=relative levels to go up, -1=try relative then absolute. level)Import a module by name. |
| public static PyObject | |
| public static PyObject | |
| public static PyObject | importOneAs(String mod, PyFrame frame)
Deprecated
Called from jython generated code when a statement like "import spam as foo" is executed. |
| public static PyObject | importOneAs(String mod, PyFrame frame, int level)
Called from jython generated code when a statement like "import spam as foo" is executed. |
| private static boolean | isAncestor(ClassLoader possibleAncestor, ClassLoader subject)
True iff a |
| public static PyObject | |
| private static PyObject | Returns: the module namedname of module name)Load a built-in module by reference to |
| public static PyObject | |
| pack-priv static PyObject | |
| pack-priv static PyObject | Returns: the module if we can load it (ornull if we can't).the sys module of the interpreter importing the module. sys, String by which to look for files or a directory representing the module. name, String name by which to enter the module in modName, String sys.modules.where to look for the location)name.Import a module defined in Python by loading it from source (or a compiled
|
| private static void | loadNames(PyObject
the names to load from the module names, PyObject the fully imported module module, PyObject the namespace into which names will be loaded locals, boolean if true, if the name starts with an underscore '_' do not add it to locals filter)From a module, load the attributes found in |
| public static String | makeCompiledFilename(String filename)
Remove the last three characters of a file name and add the compiled suffix "$py.class". |
| private static InputStream | |
| private static byte[] | Returns: bytes readto read fp)Read a stream as a new byte array and close the stream. |
| public static byte[] | Returns: the class file bytes as an array ornull on failure (if testing).of source file (used for identification in error/log messages) name, InputStream stream from which to read class file (closed when read) fp, boolean if testing)true, failures are signalled by a null not an exceptionAs |
| public static byte[] | Returns: the class file bytes as an array ornull on failure (if testing).of source file (used for identification in error/log messages) name, InputStream stream from which to read class file (closed when read) fp, boolean if testing, long true, failures are signalled by a null not an exceptiontime expected to match sourceLastModified)MTime annotation in the class fileAs |
| public static imp. | Returns: theCodeData bundle or null on failure (if testing).of source file (used for identification in error/log messages) name, InputStream stream from which to read class file (closed when read) fp, boolean if testing)true, failures are signalled by a null not an exceptionAs |
| public static imp. | Returns: theCodeData bundle or null on failure (if testing).of source file (used for identification in error/log messages) name, InputStream stream from which to read class file (closed when read) fp, boolean if testing, long true, failures are signalled by a null not an exceptiontime expected to match sourceLastModified)MTime annotation in the class fileCreate a |
| pack-priv static PyObject | |
| private static void |