Interface PythonLikeObject

All Known Subinterfaces:
PythonBytesLikeObject, PythonIterator<T>, PythonLikeFunction, PythonNumber
All Known Implementing Classes:
AbstractPythonLikeObject, ArithmeticError, AttributeError, BinaryDunderBuiltin, BlockingIOError, BoundPythonLikeFunction, BrokenPipeError, BufferError, BytesWarning, ChildProcessError, ConnectionAbortedError, ConnectionError, ConnectionRefusedError, ConnectionResetError, CPythonBackedPythonLikeObject, CPythonException, CPythonType, DelegatePythonIterator, DeprecationWarning, DictItemView, DictKeyView, DictValueView, Ellipsis, EncodingWarning, EOFError, FileExistsError, FileNotFoundError, FloatingPointError, FutureWarning, GeneratedFunctionMethodReference, GeneratorExit, ImportError, ImportWarning, IndentationError, IndexError, InterruptedError, IsADirectoryError, JavaMethodReference, JavaObjectWrapper, KeyboardInterrupt, KeyError, LookupError, MemoryError, ModuleNotFoundError, MultiDispatchJavaMethodReference, NameError, NotADirectoryError, NotImplemented, NotImplementedError, OSError, OverflowError, PendingDeprecationWarning, PermissionError, ProcessLookupError, PythonAssertionError, PythonBaseException, PythonBoolean, PythonByteArray, PythonBytes, PythonCell, PythonCode, PythonComplex, PythonDate, PythonDateTime, PythonDecimal, PythonException, PythonFloat, PythonGenerator, PythonInteger, PythonKnownFunctionType, PythonLikeDict, PythonLikeFrozenSet, PythonLikeFunctionWrapper, PythonLikeGenericType, PythonLikeList, PythonLikeSet, PythonLikeTuple, PythonLikeType, PythonModule, PythonNone, PythonObjectWrapper, PythonRange, PythonSlice, PythonString, PythonSuperObject, PythonTime, PythonTimeDelta, PythonTraceback, PythonTzinfo, RecursionError, ReferenceError, ResourceWarning, RuntimeError, RuntimeWarning, StopAsyncIteration, StopIteration, SyntaxError, SyntaxWarning, SystemError, SystemExit, TabError, TernaryDunderBuiltin, TimeoutError, TypeError, UnaryDunderBuiltin, UnboundLocalError, UnicodeDecodeError, UnicodeEncodeError, UnicodeError, UnicodeTranslateError, UnicodeWarning, UserWarning, ValueError, Warning, ZeroDivisionError

public interface PythonLikeObject
Represents an Object that can be interacted with like a Python Object. A PythonLikeObject can refer to a Java Object, a CPython Object, or be an Object constructed by the Java Python Interpreter.
  • Method Details

    • $getAttributeOrNull

      PythonLikeObject $getAttributeOrNull(String attributeName)
      Gets an attribute by name.
      Parameters:
      attributeName - Name of the attribute to get
      Returns:
      The attribute of the object that corresponds with attributeName
      Throws:
      AttributeError - if the attribute does not exist
    • $getAttributeOrError

      default PythonLikeObject $getAttributeOrError(String attributeName)
      Gets an attribute by name.
      Parameters:
      attributeName - Name of the attribute to get
      Returns:
      The attribute of the object that corresponds with attributeName
      Throws:
      AttributeError - if the attribute does not exist
    • $setAttribute

      void $setAttribute(String attributeName, PythonLikeObject value)
      Sets an attribute by name.
      Parameters:
      attributeName - Name of the attribute to set
      value - Value to set the attribute to
    • $deleteAttribute

      void $deleteAttribute(String attributeName)
      Delete an attribute by name.
      Parameters:
      attributeName - Name of the attribute to delete
    • $getType

      PythonLikeType $getType()
      Returns the type describing the object
      Returns:
      the type describing the object
    • $getGenericType

      default PythonLikeType $getGenericType()
      Return a generic version of $getType(). This is used in bytecode generation and not at runtime. For example, for a list of integers, this return list[int], while getType returns list. Both methods are needed so type([1,2,3]) is type(['a', 'b', 'c']) return True.
      Returns:
      the generic version of this object's type. Must not be used in identity checks.
    • $method$__getattribute__

      default PythonLikeObject $method$__getattribute__(PythonString pythonName)
    • $method$__setattr__

      default PythonLikeObject $method$__setattr__(PythonString pythonName, PythonLikeObject value)
    • $method$__delattr__

      default PythonLikeObject $method$__delattr__(PythonString pythonName)
    • $method$__eq__

      default PythonLikeObject $method$__eq__(PythonLikeObject other)
    • $method$__ne__

      default PythonLikeObject $method$__ne__(PythonLikeObject other)
    • $method$__str__

      default PythonString $method$__str__()
    • $method$__repr__

      default PythonLikeObject $method$__repr__()
    • $method$__format__

      default PythonLikeObject $method$__format__()
    • $method$__format__

      default PythonLikeObject $method$__format__(PythonLikeObject formatString)
    • $method$__hash__

      default PythonLikeObject $method$__hash__()