Package org.python.core
Class PyObject
- java.lang.Object
-
- org.python.core.PyObject
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
JavaImporter,PrecompiledImporter,PrecompiledImporter.PrecompiledLoader,PyBeanEvent,PyBuiltinFunction,PyCell,PyClass,PyClassMethod,PyCode,PyComplex,PyCompoundCallable,PyConnection,PyCursor,PyDescriptor,PyDictionary,PyFile,PyFloat,PyFrame,PyFunction,PyInstance,PyInteger,PyIterator,PyJavaPackage,PyLong,PyMethod,PyModule,PyNone,PyObjectDerived,PyProperty,PyReflectedField,PyReflectedFunction,PySequence,PySingleton,PySlice,PyStatement,PyStaticMethod,PyStringMap,PySuper,PySystemState,PyTraceback,PyType,ZipFileImporter,ZipFileImporter.ZipFileLoader,zxJDBC
public class PyObject extends java.lang.Object implements java.io.SerializableAll objects known to the Jython runtime system are represented by an instance of the classPyObjector one of its subclasses.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPyObject.ConversionException
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Stringexposed_name
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PyObject__abs__()Equivalent to the standard Python __abs__ method.PyObject__add__(PyObject other)Equivalent to the standard Python __add__ methodPyObject__and__(PyObject other)Equivalent to the standard Python __and__ methodPyObject__call__()A variant of the __call__ method with no arguments.PyObject__call__(PyObject arg0)A variant of the __call__ method with one argument.PyObject__call__(PyObject[] args)A variant of the __call__ method when no keywords are passed.PyObject__call__(PyObject[] args, java.lang.String[] keywords)The basic method to override when implementing a callable object.PyObject__call__(PyObject arg0, PyObject arg1)A variant of the __call__ method with two arguments.PyObject__call__(PyObject arg1, PyObject[] args, java.lang.String[] keywords)A variant of the __call__ method with one extra initial argument.PyObject__call__(PyObject arg0, PyObject arg1, PyObject arg2)A variant of the __call__ method with three arguments.PyObject__call__(PyObject arg0, PyObject arg1, PyObject arg2, PyObject arg3)A variant of the __call__ method with four arguments.int__cmp__(PyObject other)Equivalent to the standard Python __cmp__ method.PyObject__coerce__(PyObject pyo)Equivalent to the standard Python __coerce__ method.java.lang.Object__coerce_ex__(PyObject o)Implements numeric coercionPyComplex__complex__()Equivalent to the standard Python __complex__ method.boolean__contains__(PyObject o)Equivalent to the standard Python __contains__ method.void__delattr__(java.lang.String name)A variant of the __delattr__ method which accepts a String as the key.void__delattr__(PyString name)Equivalent to the standard Python __delattr__ method.void__delete__(PyObject obj)void__delitem__(java.lang.String key)A variant of the __delitem__ method which accepts a String as the key.void__delitem__(PyObject key)Equivalent to the standard Python __delitem__ method.void__delslice__(PyObject start, PyObject stop)void__delslice__(PyObject s_start, PyObject s_stop, PyObject s_step)PyObject__dir__()Equivalent to the standard Python __dir__ method.PyObject__div__(PyObject other)Equivalent to the standard Python __div__ methodPyObject__divmod__(PyObject other)Equivalent to the standard Python __divmod__ methodPyObject__eq__(PyObject other)Equivalent to the standard Python __eq__ method.PyObject__findattr__(java.lang.String name)A variant of the __findattr__ method which accepts a JavaStringas the name.PyObject__findattr__(PyString name)Very similar to the standard Python __getattr__ method.PyObject__finditem__(int key)A variant of the __finditem__ method which accepts a primitiveintas the key.PyObject__finditem__(java.lang.String key)A variant of the __finditem__ method which accepts a JavaStringas the key.PyObject__finditem__(PyObject key)Very similar to the standard Python __getitem__ method.PyFloat__float__()Equivalent to the standard Python __float__ method.PyObject__floordiv__(PyObject other)Equivalent to the standard Python __floordiv__ methodPyObject__ge__(PyObject other)Equivalent to the standard Python __ge__ method.PyObject__get__(PyObject obj, PyObject type)PyObject__getattr__(java.lang.String name)A variant of the __getattr__ method which accepts a JavaStringas the name.PyObject__getattr__(PyString name)Equivalent to the standard Python __getattr__ method.PyObject__getitem__(int key)Equivalent to the standard Python __getitem__ method.PyObject__getitem__(PyObject key)Equivalent to the standard Python __getitem__ method.PyTuple__getnewargs__()PyObject__getslice__(PyObject start, PyObject stop)PyObject__getslice__(PyObject s_start, PyObject s_stop, PyObject s_step)PyObject__gt__(PyObject other)Equivalent to the standard Python __gt__ method.PyInteger__hash__()Equivalent to the standard Python __hash__ method.PyString__hex__()Equivalent to the standard Python __hex__ method Should only be overridden by numeric objects that can be reasonably represented as a hexadecimal string.PyObject__iadd__(PyObject other)Equivalent to the standard Python __iadd__ methodPyObject__iand__(PyObject other)Equivalent to the standard Python __iand__ methodPyObject__idiv__(PyObject other)Equivalent to the standard Python __idiv__ methodPyObject__idivmod__(PyObject other)Equivalent to the standard Python __idivmod__ methodPyObject__ifloordiv__(PyObject other)Equivalent to the standard Python __ifloordiv__ methodPyObject__ilshift__(PyObject other)Equivalent to the standard Python __ilshift__ methodPyObject__imod__(PyObject other)Equivalent to the standard Python __imod__ methodPyObject__imul__(PyObject other)Equivalent to the standard Python __imul__ methodPyObject__int__()Equivalent to the standard Python __int__ method.PyObject__invert__()Equivalent to the standard Python __invert__ method.PyObject__ior__(PyObject other)Equivalent to the standard Python __ior__ methodPyObject__ipow__(PyObject other)Equivalent to the standard Python __ipow__ methodPyObject__irshift__(PyObject other)Equivalent to the standard Python __irshift__ methodPyObject__isub__(PyObject other)Equivalent to the standard Python __isub__ methodPyObject__iter__()Return an iterator that is used to iterate the element of this sequence.PyObject__iternext__()Return the next element of the sequence that this is an iterator for.PyObject__itruediv__(PyObject other)Equivalent to the standard Python __itruediv__ methodPyObject__ixor__(PyObject other)Equivalent to the standard Python __ixor__ methodPyObject__le__(PyObject other)Equivalent to the standard Python __le__ method.int__len__()Equivalent to the standard Python __len__ method.PyLong__long__()Equivalent to the standard Python __long__ method.PyObject__lshift__(PyObject other)Equivalent to the standard Python __lshift__ methodPyObject__lt__(PyObject other)Equivalent to the standard Python __lt__ method.PyObject__mod__(PyObject other)Equivalent to the standard Python __mod__ methodPyObject__mul__(PyObject other)Equivalent to the standard Python __mul__ methodPyObject__ne__(PyObject other)Equivalent to the standard Python __ne__ method.PyObject__neg__()Equivalent to the standard Python __neg__ method.boolean__nonzero__()Equivalent to the standard Python __nonzero__ method.PyObject__not__()Implements boolean notPyString__oct__()Equivalent to the standard Python __oct__ method.PyObject__or__(PyObject other)Equivalent to the standard Python __or__ methodPyObject__pos__()Equivalent to the standard Python __pos__ method.PyObject__pow__(PyObject other)Equivalent to the standard Python __pow__ methodPyObject__pow__(PyObject o2, PyObject o3)Implements the three argument power function.PyObject__radd__(PyObject other)Equivalent to the standard Python __radd__ methodPyObject__rand__(PyObject other)Equivalent to the standard Python __rand__ methodPyObject__rdiv__(PyObject other)Equivalent to the standard Python __rdiv__ methodPyObject__rdivmod__(PyObject other)Equivalent to the standard Python __rdivmod__ methodPyObject__reduce__()Used for pickling.PyString__repr__()Equivalent to the standard Python __repr__ method.PyObject__rfloordiv__(PyObject other)Equivalent to the standard Python __rfloordiv__ methodPyObject__rlshift__(PyObject other)Equivalent to the standard Python __rlshift__ methodPyObject__rmod__(PyObject other)Equivalent to the standard Python __rmod__ methodPyObject__rmul__(PyObject other)Equivalent to the standard Python __rmul__ methodPyObject__ror__(PyObject other)Equivalent to the standard Python __ror__ methodPyObject__rpow__(PyObject other)Equivalent to the standard Python __rpow__ methodPyObject__rrshift__(PyObject other)Equivalent to the standard Python __rrshift__ methodPyObject__rshift__(PyObject other)Equivalent to the standard Python __rshift__ methodPyObject__rsub__(PyObject other)Equivalent to the standard Python __rsub__ methodPyObject__rtruediv__(PyObject other)Equivalent to the standard Python __rtruediv__ methodPyObject__rxor__(PyObject other)Equivalent to the standard Python __rxor__ methodvoid__set__(PyObject obj, PyObject value)void__setattr__(java.lang.String name, PyObject value)A variant of the __setattr__ method which accepts a String as the key.void__setattr__(PyString name, PyObject value)Equivalent to the standard Python __setattr__ method.void__setitem__(int key, PyObject value)A variant of the __setitem__ method which accepts a primitiveintas the key.void__setitem__(java.lang.String key, PyObject value)A variant of the __setitem__ method which accepts a String as the key.void__setitem__(PyObject key, PyObject value)Equivalent to the standard Python __setitem__ method.void__setslice__(PyObject start, PyObject stop, PyObject value)void__setslice__(PyObject s_start, PyObject s_stop, PyObject s_step, PyObject value)PyString__str__()Equivalent to the standard Python __str__ method.PyObject__sub__(PyObject other)Equivalent to the standard Python __sub__ methodjava.lang.Object__tojava__(java.lang.Class c)Equivalent to the Jython __tojava__ method.PyObject__truediv__(PyObject other)Equivalent to the standard Python __truediv__ methodPyUnicode__unicode__()PyObject__xor__(PyObject other)Equivalent to the standard Python __xor__ methodPyObject_add(PyObject o2)Implements the Python expressionthis + o2PyObject_and(PyObject o2)Implements the Python expressionthis & o2PyObject_callextra(PyObject[] args, java.lang.String[] keywords, PyObject starargs, PyObject kwargs)Deprecated.int_cmp(PyObject o)Implements cmp(this, other)PyObject_div(PyObject o2)Implements the Python expressionthis / o2PyObject_divmod(PyObject o2)Implements the Python expressionthis divmod o2PyObject_doget(PyObject container)PyObject_doget(PyObject container, PyObject wherefound)boolean_doset(PyObject container, PyObject value)PyObject_eq(PyObject o)Implements the Python expressionthis == other.PyObject_floordiv(PyObject o2)Implements the Python expressionthis // o2PyObject_ge(PyObject o)Implements the Python expressionthis >= other.PyObject_gt(PyObject o)Implements the Python expressionthis > other.PyObject_in(PyObject o)Implementsinoperator.PyObject_is(PyObject o)Implementsisoperator.PyObject_isnot(PyObject o)Implementsis notoperator.PyObject_jcall(java.lang.Object[] args)PyObject_jcallexc(java.lang.Object[] args)A convenience function for PyProxy's.void_jthrow(java.lang.Throwable t)PyObject_le(PyObject o)Implements the Python expressionthis <= other.PyObject_lshift(PyObject o2)Implements the Python expressionthis << o2PyObject_lt(PyObject o)Implements the Python expressionthis < other.PyObject_mod(PyObject o2)Implements the Python expressionthis % o2PyObject_mul(PyObject o2)Implements the Python expressionthis * o2PyObject_ne(PyObject o)Implements the Python expressionthis !PyObject_notin(PyObject o)Implementsnot inoperator.PyObject_or(PyObject o2)Implements the Python expressionthis | o2PyObject_pow(PyObject o2)Implements the Python expressionthis ** o2PyObject_rshift(PyObject o2)Implements the Python expressionthis >> o2PyObject_sub(PyObject o2)Implements the Python expressionthis - o2PyObject_truediv(PyObject o2)Implements the Python expressionthis / o2PyObject_xor(PyObject o2)Implements the Python expressionthis ^ o2intasInt(int index)longasLong(int index)java.lang.StringasName(int index)java.lang.StringasString(int index)java.lang.StringasStringOrNull(int index)voiddelDict()voiddelType()voiddispatch__init__(PyType type, PyObject[] args, java.lang.String[] keywords)Dispatch __init__ behaviorbooleanequals(java.lang.Object ob_other)Should almost never be overridden.PyObjectfastGetClass()PyObjectfastGetDict()xxx implements where meaningfulPyObjectgetDict()xxx implements where meaningfulPyObjectgetDoc()PyTypegetType()inthashCode()booleanimplementsDescrDelete()booleanimplementsDescrSet()PyObjectinvoke(java.lang.String name)Shortcut for calling a method on a PyObject with no args.PyObjectinvoke(java.lang.String name, PyObject arg1)Shortcut for calling a method on a PyObject with one arg.PyObjectinvoke(java.lang.String name, PyObject[] args)PyObjectinvoke(java.lang.String name, PyObject[] args, java.lang.String[] keywords)Shortcut for calling a method on a PyObject from Java.PyObjectinvoke(java.lang.String name, PyObject arg1, PyObject arg2)Shortcut for calling a method on a PyObject with two args.booleanisCallable()booleanisDataDescr()booleanisMappingType()booleanisNumberType()booleanisSequenceType()voidnoAttributeError(java.lang.String name)voidreadonlyAttributeError(java.lang.String name)java.lang.StringsafeRepr()voidsetDict(PyObject newDict)voidsetType(PyType type)java.lang.StringtoString()static voidtypeSetup(PyObject dict, PyType.Newstyle marker)
-
-
-
Field Detail
-
exposed_name
public static final java.lang.String exposed_name
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PyObject
public PyObject(PyType objtype)
-
PyObject
public PyObject()
The standard constructor for aPyObject. It will set the__class__field to correspond to the specific subclass ofPyObjectbeing instantiated.
-
-
Method Detail
-
typeSetup
public static void typeSetup(PyObject dict, PyType.Newstyle marker)
-
getType
public PyType getType()
-
setType
public void setType(PyType type)
-
delType
public void delType()
-
fastGetClass
public PyObject fastGetClass()
-
getDoc
public PyObject getDoc()
-
dispatch__init__
public void dispatch__init__(PyType type, PyObject[] args, java.lang.String[] keywords)
Dispatch __init__ behavior
-
__repr__
public PyString __repr__()
Equivalent to the standard Python __repr__ method. This method should not typically need to be overrriden. The easiest way to configure the string representation of aPyObjectis to override the standard JavatoStringmethod.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
safeRepr
public java.lang.String safeRepr() throws PyIgnoreMethodTag- Throws:
PyIgnoreMethodTag
-
__str__
public PyString __str__()
Equivalent to the standard Python __str__ method. This method should not typically need to be overridden. The easiest way to configure the string representation of aPyObjectis to override the standard JavatoStringmethod.
-
__unicode__
public PyUnicode __unicode__()
-
__hash__
public final PyInteger __hash__()
Equivalent to the standard Python __hash__ method. This method can not be overridden. Instead, you should override the standard JavahashCodemethod to return an appropriate hash code for thePyObject.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object ob_other)
Should almost never be overridden. If overridden, it is the subclasses responsibility to ensure thata.equals(b) == trueiffcmp(a,b) == 0- Overrides:
equalsin classjava.lang.Object
-
__nonzero__
public boolean __nonzero__()
Equivalent to the standard Python __nonzero__ method. Returns whether of not a givenPyObjectis considered true.
-
__tojava__
public java.lang.Object __tojava__(java.lang.Class c)
Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special objectPy.NoConversionif thisPyObjectcan not be converted to the desired Java class.- Parameters:
c- the Class to convert thisPyObjectto.
-
__call__
public PyObject __call__(PyObject[] args, java.lang.String[] keywords)
The basic method to override when implementing a callable object. The first len(args)-len(keywords) members of args[] are plain arguments. The last len(keywords) arguments are the values of the keyword arguments.- Parameters:
args- all arguments to the function (including keyword arguments).keywords- the keywords used for all keyword arguments.
-
__call__
public PyObject __call__(PyObject arg1, PyObject[] args, java.lang.String[] keywords)
A variant of the __call__ method with one extra initial argument. This variant is used to allow method invocations to be performed efficiently. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
arg1- the first argument to the function.args- the last arguments to the function (including keyword arguments).keywords- the keywords used for all keyword arguments.
-
__call__
public PyObject __call__(PyObject[] args)
A variant of the __call__ method when no keywords are passed. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
args- all arguments to the function.
-
__call__
public PyObject __call__()
A variant of the __call__ method with no arguments. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.
-
__call__
public PyObject __call__(PyObject arg0)
A variant of the __call__ method with one argument. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
arg0- the single argument to the function.
-
__call__
public PyObject __call__(PyObject arg0, PyObject arg1)
A variant of the __call__ method with two arguments. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
arg0- the first argument to the function.arg1- the second argument to the function.
-
__call__
public PyObject __call__(PyObject arg0, PyObject arg1, PyObject arg2)
A variant of the __call__ method with three arguments. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
arg0- the first argument to the function.arg1- the second argument to the function.arg2- the third argument to the function.
-
__call__
public PyObject __call__(PyObject arg0, PyObject arg1, PyObject arg2, PyObject arg3)
A variant of the __call__ method with four arguments. The default behavior is to invoke__call__(args, keywords)with the appropriate arguments. The only reason to override this function would be for improved performance.- Parameters:
arg0- the first argument to the function.arg1- the second argument to the function.arg2- the third argument to the function.arg3- the fourth argument to the function.
-
_callextra
public PyObject _callextra(PyObject[] args, java.lang.String[] keywords, PyObject starargs, PyObject kwargs)
Deprecated.
-
isCallable
public boolean isCallable()
-
isMappingType
public boolean isMappingType()
-
isNumberType
public boolean isNumberType()
-
isSequenceType
public boolean isSequenceType()
-
__len__
public int __len__()
Equivalent to the standard Python __len__ method. Part of the mapping discipline.- Returns:
- the length of the object
-
__finditem__
public PyObject __finditem__(PyObject key)
Very similar to the standard Python __getitem__ method. Instead of throwing a KeyError if the item isn't found, this just returns null. Classes that wish to implement __getitem__ should override this method instead (with the appropriate semantics.- Parameters:
key- the key to lookup in this container- Returns:
- the value corresponding to key or null if key is not found
-
__finditem__
public PyObject __finditem__(int key)
A variant of the __finditem__ method which accepts a primitiveintas the key. By default, this method will call__finditem__(PyObject key)with the appropriate args. The only reason to override this method is for performance.- Parameters:
key- the key to lookup in this sequence.- Returns:
- the value corresponding to key or null if key is not found.
- See Also:
__finditem__(PyObject)
-
__finditem__
public PyObject __finditem__(java.lang.String key)
A variant of the __finditem__ method which accepts a JavaStringas the key. By default, this method will call__finditem__(PyObject key)with the appropriate args. The only reason to override this method is for performance. Warning: key must be an interned string!!!!!!!!- Parameters:
key- the key to lookup in this sequence - must be an interned string .- Returns:
- the value corresponding to key or null if key is not found.
- See Also:
__finditem__(PyObject)
-
__getitem__
public PyObject __getitem__(int key)
Equivalent to the standard Python __getitem__ method. This variant takes a primitiveintas the key. This method should not be overridden. Override the__finditem__method instead.- Parameters:
key- the key to lookup in this container.- Returns:
- the value corresponding to that key.
- Throws:
Py.KeyError- if the key is not found.- See Also:
__finditem__(int)
-
__getitem__
public PyObject __getitem__(PyObject key)
Equivalent to the standard Python __getitem__ method. This method should not be overridden. Override the__finditem__method instead.- Parameters:
key- the key to lookup in this container.- Returns:
- the value corresponding to that key.
- Throws:
Py.KeyError- if the key is not found.- See Also:
__finditem__(PyObject)
-
__setitem__
public void __setitem__(PyObject key, PyObject value)
Equivalent to the standard Python __setitem__ method.- Parameters:
key- the key whose value will be setvalue- the value to set this key to
-
__setitem__
public void __setitem__(java.lang.String key, PyObject value)A variant of the __setitem__ method which accepts a String as the key. This String must be interned. By default, this will call__setitem__(PyObject key, PyObject value)with the appropriate args. The only reason to override this method is for performance.- Parameters:
key- the key whose value will be set - must be an interned string .value- the value to set this key to- See Also:
__setitem__(PyObject, PyObject)
-
__setitem__
public void __setitem__(int key, PyObject value)A variant of the __setitem__ method which accepts a primitiveintas the key. By default, this will call__setitem__(PyObject key, PyObject value)with the appropriate args. The only reason to override this method is for performance.- Parameters:
key- the key whose value will be setvalue- the value to set this key to- See Also:
__setitem__(PyObject, PyObject)
-
__delitem__
public void __delitem__(PyObject key)
Equivalent to the standard Python __delitem__ method.- Parameters:
key- the key to be removed from the container- Throws:
Py.KeyError- if the key is not found in the container
-
__delitem__
public void __delitem__(java.lang.String key)
A variant of the __delitem__ method which accepts a String as the key. This String must be interned. By default, this will call__delitem__(PyObject key)with the appropriate args. The only reason to override this method is for performance.- Parameters:
key- the key who will be removed - must be an interned string .- Throws:
Py.KeyError- if the key is not found in the container- See Also:
__delitem__(PyObject)
-
__setslice__
public void __setslice__(PyObject s_start, PyObject s_stop, PyObject s_step, PyObject value)
-
__iter__
public PyObject __iter__()
Return an iterator that is used to iterate the element of this sequence. From version 2.2, this method is the primary protocol for looping over sequences.If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:
public PyObject __iter__() { return new PySequenceIter(this); }When iterating over a python sequence from java code, it should be done with code like this:PyObject iter = seq.__iter__(); for (PyObject item; (item = iter.__iternext__()) != null;) { // Do somting with item }- Since:
- 2.2
-
__iternext__
public PyObject __iternext__()
Return the next element of the sequence that this is an iterator for. Returns null when the end of the sequence is reached.- Since:
- 2.2
-
__findattr__
public final PyObject __findattr__(PyString name)
Very similar to the standard Python __getattr__ method. Instead of throwing a AttributeError if the item isn't found, this just returns null. By default, this method will call__findattr__(name.internedString)with the appropriate args. Classes that wish to implement __getattr__ should override this method instead (with the appropriate semantics.- Parameters:
name- the name to lookup in this namespace- Returns:
- the value corresponding to name or null if name is not found
-
__findattr__
public PyObject __findattr__(java.lang.String name)
A variant of the __findattr__ method which accepts a JavaStringas the name. Warning: name must be an interned string!- Parameters:
name- the name to lookup in this namespace must be an interned string .- Returns:
- the value corresponding to name or null if name is not found
- See Also:
__findattr__(PyString)
-
__getattr__
public final PyObject __getattr__(PyString name)
Equivalent to the standard Python __getattr__ method. This method can not be overridden. Override the__findattr__method instead.- Parameters:
name- the name to lookup in this namespace- Returns:
- the value corresponding to name
- Throws:
Py.AttributeError- if the name is not found.- See Also:
__findattr__(PyString)
-
__getattr__
public final PyObject __getattr__(java.lang.String name)
A variant of the __getattr__ method which accepts a JavaStringas the name. This method can not be overridden. Override the__findattr__method instead. Warning: name must be an interned string!!!!!!!!- Parameters:
name- the name to lookup in this namespace must be an interned string .- Returns:
- the value corresponding to name
- Throws:
Py.AttributeError- if the name is not found.- See Also:
__findattr__(java.lang.String)
-
noAttributeError
public void noAttributeError(java.lang.String name)
-
readonlyAttributeError
public void readonlyAttributeError(java.lang.String name)
-
__setattr__
public final void __setattr__(PyString name, PyObject value)
Equivalent to the standard Python __setattr__ method. This method can not be overridden.- Parameters:
name- the name to lookup in this namespace- Throws:
Py.AttributeError- if the name is not found.- See Also:
__setattr__(java.lang.String, PyObject)
-
__setattr__
public void __setattr__(java.lang.String name, PyObject value)A variant of the __setattr__ method which accepts a String as the key. This String must be interned.- Parameters:
name- the name whose value will be set - must be an interned string .value- the value to set this name to- See Also:
__setattr__(PyString, PyObject)
-
__delattr__
public final void __delattr__(PyString name)
Equivalent to the standard Python __delattr__ method. This method can not be overridden.- Parameters:
name- the name to which will be removed- Throws:
Py.AttributeError- if the name doesn't exist- See Also:
__delattr__(java.lang.String)
-
__delattr__
public void __delattr__(java.lang.String name)
A variant of the __delattr__ method which accepts a String as the key. This String must be interned. By default, this will call__delattr__(PyString name)with the appropriate args. The only reason to override this method is for performance.- Parameters:
name- the name which will be removed - must be an interned string .- Throws:
Py.AttributeError- if the name doesn't exist- See Also:
__delattr__(PyString)
-
__dir__
public PyObject __dir__()
Equivalent to the standard Python __dir__ method.- Returns:
- a list of names defined by this object.
-
__coerce_ex__
public java.lang.Object __coerce_ex__(PyObject o)
Implements numeric coercion- Parameters:
o- the other object involved in the coercion- Returns:
- null if no coercion is possible; a single PyObject to use to replace o if this is unchanged; or a PyObject[2] consisting of replacements for this and o.
-
__coerce__
public final PyObject __coerce__(PyObject pyo)
Equivalent to the standard Python __coerce__ method. This method can not be overridden. To implement __coerce__ functionality, override __coerce_ex__ instead.- Parameters:
pyo- the other object involved in the coercion.- Returns:
- a tuple of this object and pyo coerced to the same type or Py.None if no coercion is possible.
- See Also:
__coerce_ex__(org.python.core.PyObject)
-
__cmp__
public int __cmp__(PyObject other)
Equivalent to the standard Python __cmp__ method.- Parameters:
other- the object to compare this with.- Returns:
- -1 if this < 0; 0 if this == o; +1 if this > o; -2 if no comparison is implemented
-
__eq__
public PyObject __eq__(PyObject other)
Equivalent to the standard Python __eq__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
__ne__
public PyObject __ne__(PyObject other)
Equivalent to the standard Python __ne__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
__le__
public PyObject __le__(PyObject other)
Equivalent to the standard Python __le__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
__lt__
public PyObject __lt__(PyObject other)
Equivalent to the standard Python __lt__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
__ge__
public PyObject __ge__(PyObject other)
Equivalent to the standard Python __ge__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
__gt__
public PyObject __gt__(PyObject other)
Equivalent to the standard Python __gt__ method.- Parameters:
other- the object to compare this with.- Returns:
- the result of the comparison.
-
_cmp
public final int _cmp(PyObject o)
Implements cmp(this, other)- Parameters:
o- the object to compare this with.- Returns:
- -1 if this < 0; 0 if this == o; +1 if this > o
-
_eq
public final PyObject _eq(PyObject o)
Implements the Python expressionthis == other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_ne
public final PyObject _ne(PyObject o)
Implements the Python expressionthis != other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_le
public final PyObject _le(PyObject o)
Implements the Python expressionthis <= other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_lt
public final PyObject _lt(PyObject o)
Implements the Python expressionthis < other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_ge
public final PyObject _ge(PyObject o)
Implements the Python expressionthis >= other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_gt
public final PyObject _gt(PyObject o)
Implements the Python expressionthis > other.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_is
public PyObject _is(PyObject o)
Implementsisoperator.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_isnot
public PyObject _isnot(PyObject o)
Implementsis notoperator.- Parameters:
o- the object to compare this with.- Returns:
- the result of the comparison
-
_in
public final PyObject _in(PyObject o)
Implementsinoperator.- Parameters:
o- the container to search for this element.- Returns:
- the result of the search.
-
_notin
public final PyObject _notin(PyObject o)
Implementsnot inoperator.- Parameters:
o- the container to search for this element.- Returns:
- the result of the search.
-
__contains__
public boolean __contains__(PyObject o)
Equivalent to the standard Python __contains__ method.- Parameters:
o- the element to search for in this container.- Returns:
- the result of the search.
-
__not__
public PyObject __not__()
Implements boolean not- Returns:
- not this.
-
__hex__
public PyString __hex__()
Equivalent to the standard Python __hex__ method Should only be overridden by numeric objects that can be reasonably represented as a hexadecimal string.- Returns:
- a string representing this object as a hexadecimal number.
-
__oct__
public PyString __oct__()
Equivalent to the standard Python __oct__ method. Should only be overridden by numeric objects that can be reasonably represented as an octal string.- Returns:
- a string representing this object as an octal number.
-
__int__
public PyObject __int__()
Equivalent to the standard Python __int__ method. Should only be overridden by numeric objects that can be reasonably coerced into an integer.- Returns:
- an integer corresponding to the value of this object.
-
__long__
public PyLong __long__()
Equivalent to the standard Python __long__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python long.- Returns:
- a PyLong corresponding to the value of this object.
-
__float__
public PyFloat __float__()
Equivalent to the standard Python __float__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python float.- Returns:
- a float corresponding to the value of this object.
-
__complex__
public PyComplex __complex__()
Equivalent to the standard Python __complex__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python complex number.- Returns:
- a complex number corresponding to the value of this object.
-
__pos__
public PyObject __pos__()
Equivalent to the standard Python __pos__ method.- Returns:
- +this.
-
__neg__
public PyObject __neg__()
Equivalent to the standard Python __neg__ method.- Returns:
- -this.
-
__abs__
public PyObject __abs__()
Equivalent to the standard Python __abs__ method.- Returns:
- abs(this).
-
__invert__
public PyObject __invert__()
Equivalent to the standard Python __invert__ method.- Returns:
- ~this.
-
__pow__
public PyObject __pow__(PyObject o2, PyObject o3)
Implements the three argument power function.- Parameters:
o2- the power to raise this number to.o3- the modulus to perform this operation in or null if no modulo is to be used- Returns:
- this object raised to the given power in the given modulus
-
__add__
public PyObject __add__(PyObject other)
Equivalent to the standard Python __add__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the add, or null if this operation is not defined
-
__radd__
public PyObject __radd__(PyObject other)
Equivalent to the standard Python __radd__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the add, or null if this operation is not defined.
-
__iadd__
public PyObject __iadd__(PyObject other)
Equivalent to the standard Python __iadd__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the add, or null if this operation is not defined
-
_add
public final PyObject _add(PyObject o2)
Implements the Python expressionthis + o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the add.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__sub__
public PyObject __sub__(PyObject other)
Equivalent to the standard Python __sub__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the sub, or null if this operation is not defined
-
__rsub__
public PyObject __rsub__(PyObject other)
Equivalent to the standard Python __rsub__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the sub, or null if this operation is not defined.
-
__isub__
public PyObject __isub__(PyObject other)
Equivalent to the standard Python __isub__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the sub, or null if this operation is not defined
-
_sub
public final PyObject _sub(PyObject o2)
Implements the Python expressionthis - o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the sub.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__mul__
public PyObject __mul__(PyObject other)
Equivalent to the standard Python __mul__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the mul, or null if this operation is not defined
-
__rmul__
public PyObject __rmul__(PyObject other)
Equivalent to the standard Python __rmul__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the mul, or null if this operation is not defined.
-
__imul__
public PyObject __imul__(PyObject other)
Equivalent to the standard Python __imul__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the mul, or null if this operation is not defined
-
_mul
public final PyObject _mul(PyObject o2)
Implements the Python expressionthis * o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the mul.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__div__
public PyObject __div__(PyObject other)
Equivalent to the standard Python __div__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the div, or null if this operation is not defined
-
__rdiv__
public PyObject __rdiv__(PyObject other)
Equivalent to the standard Python __rdiv__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the div, or null if this operation is not defined.
-
__idiv__
public PyObject __idiv__(PyObject other)
Equivalent to the standard Python __idiv__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the div, or null if this operation is not defined
-
_div
public final PyObject _div(PyObject o2)
Implements the Python expressionthis / o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the div.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__floordiv__
public PyObject __floordiv__(PyObject other)
Equivalent to the standard Python __floordiv__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the floordiv, or null if this operation is not defined
-
__rfloordiv__
public PyObject __rfloordiv__(PyObject other)
Equivalent to the standard Python __rfloordiv__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the floordiv, or null if this operation is not defined.
-
__ifloordiv__
public PyObject __ifloordiv__(PyObject other)
Equivalent to the standard Python __ifloordiv__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the floordiv, or null if this operation is not defined
-
_floordiv
public final PyObject _floordiv(PyObject o2)
Implements the Python expressionthis // o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the floordiv.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__truediv__
public PyObject __truediv__(PyObject other)
Equivalent to the standard Python __truediv__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the truediv, or null if this operation is not defined
-
__rtruediv__
public PyObject __rtruediv__(PyObject other)
Equivalent to the standard Python __rtruediv__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the truediv, or null if this operation is not defined.
-
__itruediv__
public PyObject __itruediv__(PyObject other)
Equivalent to the standard Python __itruediv__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the truediv, or null if this operation is not defined
-
_truediv
public final PyObject _truediv(PyObject o2)
Implements the Python expressionthis / o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the truediv.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__mod__
public PyObject __mod__(PyObject other)
Equivalent to the standard Python __mod__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the mod, or null if this operation is not defined
-
__rmod__
public PyObject __rmod__(PyObject other)
Equivalent to the standard Python __rmod__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the mod, or null if this operation is not defined.
-
__imod__
public PyObject __imod__(PyObject other)
Equivalent to the standard Python __imod__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the mod, or null if this operation is not defined
-
_mod
public final PyObject _mod(PyObject o2)
Implements the Python expressionthis % o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the mod.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__divmod__
public PyObject __divmod__(PyObject other)
Equivalent to the standard Python __divmod__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the divmod, or null if this operation is not defined
-
__rdivmod__
public PyObject __rdivmod__(PyObject other)
Equivalent to the standard Python __rdivmod__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the divmod, or null if this operation is not defined.
-
__idivmod__
public PyObject __idivmod__(PyObject other)
Equivalent to the standard Python __idivmod__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the divmod, or null if this operation is not defined
-
_divmod
public final PyObject _divmod(PyObject o2)
Implements the Python expressionthis divmod o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the divmod.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__pow__
public PyObject __pow__(PyObject other)
Equivalent to the standard Python __pow__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the pow, or null if this operation is not defined
-
__rpow__
public PyObject __rpow__(PyObject other)
Equivalent to the standard Python __rpow__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the pow, or null if this operation is not defined.
-
__ipow__
public PyObject __ipow__(PyObject other)
Equivalent to the standard Python __ipow__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the pow, or null if this operation is not defined
-
_pow
public final PyObject _pow(PyObject o2)
Implements the Python expressionthis ** o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the pow.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__lshift__
public PyObject __lshift__(PyObject other)
Equivalent to the standard Python __lshift__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the lshift, or null if this operation is not defined
-
__rlshift__
public PyObject __rlshift__(PyObject other)
Equivalent to the standard Python __rlshift__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the lshift, or null if this operation is not defined.
-
__ilshift__
public PyObject __ilshift__(PyObject other)
Equivalent to the standard Python __ilshift__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the lshift, or null if this operation is not defined
-
_lshift
public final PyObject _lshift(PyObject o2)
Implements the Python expressionthis << o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the lshift.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__rshift__
public PyObject __rshift__(PyObject other)
Equivalent to the standard Python __rshift__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the rshift, or null if this operation is not defined
-
__rrshift__
public PyObject __rrshift__(PyObject other)
Equivalent to the standard Python __rrshift__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the rshift, or null if this operation is not defined.
-
__irshift__
public PyObject __irshift__(PyObject other)
Equivalent to the standard Python __irshift__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the rshift, or null if this operation is not defined
-
_rshift
public final PyObject _rshift(PyObject o2)
Implements the Python expressionthis >> o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the rshift.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__and__
public PyObject __and__(PyObject other)
Equivalent to the standard Python __and__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the and, or null if this operation is not defined
-
__rand__
public PyObject __rand__(PyObject other)
Equivalent to the standard Python __rand__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the and, or null if this operation is not defined.
-
__iand__
public PyObject __iand__(PyObject other)
Equivalent to the standard Python __iand__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the and, or null if this operation is not defined
-
_and
public final PyObject _and(PyObject o2)
Implements the Python expressionthis & o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the and.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__or__
public PyObject __or__(PyObject other)
Equivalent to the standard Python __or__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the or, or null if this operation is not defined
-
__ror__
public PyObject __ror__(PyObject other)
Equivalent to the standard Python __ror__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the or, or null if this operation is not defined.
-
__ior__
public PyObject __ior__(PyObject other)
Equivalent to the standard Python __ior__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the or, or null if this operation is not defined
-
_or
public final PyObject _or(PyObject o2)
Implements the Python expressionthis | o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the or.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
__xor__
public PyObject __xor__(PyObject other)
Equivalent to the standard Python __xor__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the xor, or null if this operation is not defined
-
__rxor__
public PyObject __rxor__(PyObject other)
Equivalent to the standard Python __rxor__ method- Parameters:
other- the object to perform this binary operation with (the left-hand operand).- Returns:
- the result of the xor, or null if this operation is not defined.
-
__ixor__
public PyObject __ixor__(PyObject other)
Equivalent to the standard Python __ixor__ method- Parameters:
other- the object to perform this binary operation with (the right-hand operand).- Returns:
- the result of the xor, or null if this operation is not defined
-
_xor
public final PyObject _xor(PyObject o2)
Implements the Python expressionthis ^ o2- Parameters:
o2- the object to perform this binary operation with.- Returns:
- the result of the xor.
- Throws:
Py.TypeError- if this operation can't be performed with these operands.
-
_jcallexc
public PyObject _jcallexc(java.lang.Object[] args) throws java.lang.Throwable
A convenience function for PyProxy's.- Parameters:
args- call arguments.- Throws:
java.lang.Throwable
-
_jthrow
public void _jthrow(java.lang.Throwable t)
-
_jcall
public PyObject _jcall(java.lang.Object[] args)
-
invoke
public PyObject invoke(java.lang.String name, PyObject[] args, java.lang.String[] keywords)
Shortcut for calling a method on a PyObject from Java. This form is equivalent to o.__getattr__(name).__call__(args, keywords)- Parameters:
name- the name of the method to call. This must be an interned string!args- an array of the arguments to the call.keywords- the keywords to use in the call.- Returns:
- the result of calling the method name with args and keywords.
-
invoke
public PyObject invoke(java.lang.String name)
Shortcut for calling a method on a PyObject with no args.- Parameters:
name- the name of the method to call. This must be an interned string!- Returns:
- the result of calling the method name with no args
-
invoke
public PyObject invoke(java.lang.String name, PyObject arg1)
Shortcut for calling a method on a PyObject with one arg.- Parameters:
name- the name of the method to call. This must be an interned string!arg1- the one argument of the method.- Returns:
- the result of calling the method name with arg1
-
invoke
public PyObject invoke(java.lang.String name, PyObject arg1, PyObject arg2)
Shortcut for calling a method on a PyObject with two args.- Parameters:
name- the name of the method to call. This must be an interned string!arg1- the first argument of the method.arg2- the second argument of the method.- Returns:
- the result of calling the method name with arg1 and arg2
-
fastGetDict
public PyObject fastGetDict()
xxx implements where meaningful- Returns:
- internal object per instance dict or null
-
getDict
public PyObject getDict()
xxx implements where meaningful- Returns:
- internal object __dict__ or null
-
setDict
public void setDict(PyObject newDict)
-
delDict
public void delDict()
-
implementsDescrSet
public boolean implementsDescrSet()
-
implementsDescrDelete
public boolean implementsDescrDelete()
-
isDataDescr
public boolean isDataDescr()
-
__delete__
public void __delete__(PyObject obj)
-
__reduce__
public PyObject __reduce__()
Used for pickling.- Returns:
- a tuple of (class, tuple)
-
__getnewargs__
public PyTuple __getnewargs__()
-
asString
public java.lang.String asString(int index) throws PyObject.ConversionException- Throws:
PyObject.ConversionException
-
asStringOrNull
public java.lang.String asStringOrNull(int index) throws PyObject.ConversionException- Throws:
PyObject.ConversionException
-
asName
public java.lang.String asName(int index) throws PyObject.ConversionException- Throws:
PyObject.ConversionException
-
asInt
public int asInt(int index) throws PyObject.ConversionException- Throws:
PyObject.ConversionException
-
asLong
public long asLong(int index) throws PyObject.ConversionException- Throws:
PyObject.ConversionException
-
-