Documentation of 'org.python.jsr223.PyScriptEngineScope' Java class
PyScriptEngineScope
org.python.jsr223

Class PyScriptEngineScope

  • All Implemented Interfaces:
    java.io.Serializable


    public final class PyScriptEngineScope
    extends PyObject
    JSR 223 does not map well to Jython's concept of "locals" and "globals". Instead, SimpleScriptContext provides ENGINE_SCOPE and GLOBAL_SCOPE, each with its own bindings. We adapt this multi-scope object for use as both a local and global dictionary.
    See Also:
    Serialized Form
    • Field Detail

      • TYPE

        public static final PyType TYPE
    • Method Detail

      • pyGetContext

        public PyObject pyGetContext()
      • pyGetEngine

        public PyObject pyGetEngine()
      • scope_keys

        public PyObject scope_keys()
      • __getitem__

        public PyObject __getitem__(PyObject key)
        Description copied from class: PyObject
        Equivalent to the standard Python __getitem__ method. This method should not be overridden. Override the __finditem__ method instead.
        Overrides:
        __getitem__ in class PyObject
        Parameters:
        key - the key to lookup in this container.
        Returns:
        the value corresponding to that key.
        See Also:
        PyObject.__finditem__(PyObject)
      • __iter__

        public PyObject __iter__()
        Description copied from class: PyObject
        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:
         for (PyObject item : seq.asIterable()) {
             // Do something with item
         }
         
        Overrides:
        __iter__ in class PyObject
      • __contains__

        public boolean __contains__(PyObject obj)
        Description copied from class: PyObject
        Equivalent to the standard Python __contains__ method.
        Overrides:
        __contains__ in class PyObject
        Parameters:
        obj - the element to search for in this container.
        Returns:
        the result of the search.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class PyObject
      • __finditem__

        public PyObject __finditem__(PyObject key)
        Description copied from class: PyObject
        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.
        Overrides:
        __finditem__ in class PyObject
        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__(java.lang.String key)
        Description copied from class: PyObject
        A variant of the __finditem__ method which accepts a Java String as 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!!!!!!!!
        Overrides:
        __finditem__ in class PyObject
        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:
        PyObject.__finditem__(PyObject)
      • __setitem__

        public void __setitem__(PyObject key,
                                PyObject value)
        Description copied from class: PyObject
        Equivalent to the standard Python __setitem__ method.
        Overrides:
        __setitem__ in class PyObject
        Parameters:
        key - the key whose value will be set
        value - the value to set this key to
      • __setitem__

        public void __setitem__(java.lang.String key,
                                PyObject value)
        Description copied from class: PyObject
        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.
        Overrides:
        __setitem__ in class PyObject
        Parameters:
        key - the key whose value will be set - must be an interned string .
        value - the value to set this key to
        See Also:
        PyObject.__setitem__(PyObject, PyObject)
      • __delitem__

        public void __delitem__(PyObject key)
        Description copied from class: PyObject
        Equivalent to the standard Python __delitem__ method.
        Overrides:
        __delitem__ in class PyObject
        Parameters:
        key - the key to be removed from the container
      • __delitem__

        public void __delitem__(java.lang.String key)
        Description copied from class: PyObject
        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.
        Overrides:
        __delitem__ in class PyObject
        Parameters:
        key - the key who will be removed - must be an interned string .
        See Also:
        PyObject.__delitem__(PyObject)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.