Package org.python.modules
Class _imp
java.lang.Object
org.python.modules._imp
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic PyStringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAcquires the interpreter's import lock for the current thread.static PyObjectfind_module(String name) static PyObjectfind_module(String name, PyObject path) static PyObjectstatic PyObjectstatic booleanis_builtin(String name) static booleanstatic PyObjectload_compiled(String name, PyString pathname) Return a module with the givenname, the result of executing the compiled code at the givenpathname.static PyObjectload_compiled(String name, PyString pathname, PyObject file) Return a module with the givenname, the result of executing the compiled code in the givenfilestream.static PyObjectload_dynamic(String name, String pathname) static PyObjectload_dynamic(String name, String pathname, PyObject file) static PyObjectload_module(String name, PyObject file, PyObject filename, PyTuple data) static PyObjectload_source(String modname, String filename) static PyObjectload_source(String modname, String filename, PyObject file) static booleanReturn true if the import lock is currently held, else false.static PyStringmakeCompiledFilename(PyString filename) Variant ofimp.makeCompiledFilename(String)dealing with encoded bytes.static PyModulenew_module(String name) static voidRelease the interpreter's import lock.static PyObject
-
Field Details
-
__doc__
-
PY_SOURCE
public static final int PY_SOURCE- See Also:
-
PY_COMPILED
public static final int PY_COMPILED- See Also:
-
C_EXTENSION
public static final int C_EXTENSION- See Also:
-
PKG_DIRECTORY
public static final int PKG_DIRECTORY- See Also:
-
C_BUILTIN
public static final int C_BUILTIN- See Also:
-
PY_FROZEN
public static final int PY_FROZEN- See Also:
-
IMP_HOOK
public static final int IMP_HOOK- See Also:
-
-
Constructor Details
-
_imp
public _imp()
-
-
Method Details
-
load_dynamic
-
load_dynamic
-
load_source
-
load_source
-
reload
-
load_compiled
Return a module with the givenname, the result of executing the compiled code at the givenpathname. If this path is aPyUnicode, it is used exactly; if it is aPyStringit is taken to be file-system encoded.- Parameters:
name- the module namepathname- to the compiled module (becomes__file__)- Returns:
- the module called
name
-
load_compiled
Return a module with the givenname, the result of executing the compiled code in the givenfilestream.- Parameters:
name- the module namepathname- a file path that is not null (becomes__file__)file- stream from which the compiled code is taken- Returns:
- the module called
name
-
find_module
-
find_module
-
load_module
-
makeCompiledFilename
Variant ofimp.makeCompiledFilename(String)dealing with encoded bytes. In the context where this is used from Python, a result in encoded bytes is preferable. -
get_magic
-
get_suffixes
-
new_module
-
is_builtin
-
is_frozen
-
acquire_lock
public static void acquire_lock()Acquires the interpreter's import lock for the current thread. This lock should be used by import hooks to ensure thread-safety when importing modules. -
release_lock
public static void release_lock()Release the interpreter's import lock. -
lock_held
public static boolean lock_held()Return true if the import lock is currently held, else false.- Returns:
- true if the import lock is currently held, else false.
-