Top Description Fields Constructors Methods
org.python.core

public Class PyModule

extends Object
implements CraftedPyObject, DictPyObject
Class Inheritance
All Implemented Interfaces
org.python.core.DictPyObject, org.python.core.CraftedPyObject
Known Direct Subclasses
org.python.core.JavaModule
Imports
java.lang.invoke.MethodHandles

The Python module object.

Field Summary

Modifier and TypeField and Description
pack-priv final PyDict
dict

Dictionary (globals) of this module.

pack-priv final String
name

Name of this module.

public static final PyType
TYPE

The type of Python object this class implements.

protected final PyType

Constructor Summary

AccessConstructor and Description
pack-priv
PyModule(PyType
actual Python sub-class to being created
type
,
String
of module
name
)

As PyModule(String) for Python sub-class specifying type.

pack-priv
PyModule(String
of module
name
)

Construct an instance of the named module.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
add(PyType
the type
t
)

Add a type by name to the dictionary.

pack-priv void
add(String
to use as key
name
,
Object
value for key
o
)

Add an object by name to the module dictionary.

pack-priv void
exec()

Initialise the module instance.

public PyDict

Returns:

The globals of this module
getDict
()

Implements org.python.core.DictPyObject.getDict.

The global dictionary of a module instance.
public PyType
getType()

Implements org.python.core.CraftedPyObject.getType.

The Python type of this object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

dictback to summary
pack-priv final PyDict dict

Dictionary (globals) of this module. Not null.

nameback to summary
pack-priv final String name

Name of this module. Not null.

TYPEback to summary
public static final PyType TYPE

The type of Python object this class implements.

typeback to summary
protected final PyType type

Constructor Detail

PyModuleback to summary
pack-priv PyModule(PyType type, String name)

As PyModule(String) for Python sub-class specifying type.

Parameters
type:PyType

actual Python sub-class to being created

name:String

of module

PyModuleback to summary
pack-priv PyModule(String name)

Construct an instance of the named module.

Parameters
name:String

of module

Method Detail

addback to summary
pack-priv void add(PyType t)

Add a type by name to the dictionary.

Parameters
t:PyType

the type

addback to summary
pack-priv void add(String name, Object o)

Add an object by name to the module dictionary.

Parameters
name:String

to use as key

o:Object

value for key

execback to summary
pack-priv void exec()

Initialise the module instance. The main action will be to add entries to dict. These become the members (globals) of the module.

getDictback to summary
public PyDict getDict()

Implements org.python.core.DictPyObject.getDict.

The global dictionary of a module instance. This is always a Python dict and never null.

Returns:PyDict

The globals of this module

Annotations
@Override
getTypeback to summary
public PyType getType()

Implements org.python.core.CraftedPyObject.getType.

Doc from org.python.core.CraftedPyObject.getType.

The Python type of this object.

Returns:PyType

type of this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override