Examples of PyMethod


Examples of org.python.core.PyMethod

        }

        // populate the method map
        for (int i = 0; i < _METHOD_NAMES.length; ++i) {
            String methodName = _METHOD_NAMES[i];
            PyMethod method = null;

            try {
                method = (PyMethod) object.__findattr__(methodName);
            } catch (ClassCastException ex) {
                // the object has an attribute with the methodName but
View Full Code Here

Examples of org.python.core.PyMethod

     *  is returned. IllegalActionException is thrown if there is any
     *  error in calling the method.
     */
    private PyObject _invokeMethod(String methodName, Object[] args)
            throws IllegalActionException {
        PyMethod method = (PyMethod) _methodMap.get(methodName);
        PyObject returnValue = null;

        if (method != null) {
            try {
                if ((args == null) || (args.length == 0)) {
                    returnValue = method.__call__();
                } else {
                    PyObject[] convertedArgs = new PyObject[args.length];

                    for (int i = 0; i < args.length; ++i) {
                        if (!(args[i] instanceof PyObject)) {
View Full Code Here

Examples of org.python.core.PyMethod

        runtime = (Marathon) interpreter.get("marathon", Marathon.class);
    }

    private void readTestExecutor() {
        PyObject marathon = interpreter.get("marathon");
        PyMethod testExecutor = (PyMethod) marathon.__getattr__("execTest");
        if (testExecutor == null) {
            throw new ScriptException("no python test executor, something is wrong with the marathon runtime!");
        }
    }
View Full Code Here

Examples of org.python.core.PyMethod

            this.callable = callable;
        }

        @Override
        public PyObject __get__(PyObject obj, PyObject type) {
            return new PyMethod(this, obj, type);
        }
View Full Code Here

Examples of org.python.core.PyMethod

            proxy.__initProxy__(new Object[0]);
            o = proxy._getPyInstance();
        }
        PyObject ret = o.__findattr__(name);
        if (ret instanceof PyMethod) {
            PyMethod meth = ((PyMethod)ret);
            if (meth.im_func instanceof PyReflectedFunction) {
                PyReflectedFunction func = (PyReflectedFunction)meth.im_func;
                if (func.nargs > 0 && proxy.getClass() == func.argslist[0].declaringClass) {
                    // This function is the default return for the proxy type if the Python instance
                    // hasn't returned something of its own from __findattr__, so do the standard
View Full Code Here

Examples of org.python.core.PyMethod

        super(entry, query);
       
        PythonDataStore dataStore = (PythonDataStore) entry.getDataStore();
        PyObject workspace = dataStore.getWorkspace();
       
        PyMethod get = (PyMethod) workspace.__findattr__("get");
        if (get == null) {
            get = (PyMethod) workspace.__findattr__("__getitem__");
        }
        this.layer = get.__call__(new PyObject[]{new PyString(entry.getName().getLocalPart())});
        this.schema = layer.__findattr__("schema");
   
    }
View Full Code Here

Examples of org.python.core.PyMethod

        return clazz;
    }

    @Override
    protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
        PyMethod bounds = (PyMethod) layer.__findattr__("bounds");
        PyObject filter = convertFilter(query.getFilter());
       
        PyObject result = bounds.__call__(filter != null ? new PyObject[]{filter} : new PyObject[]{});
       
        //do not return the actual envelope synce it is a python object
        return new ReferencedEnvelope((ReferencedEnvelope) result.__tojava__(ReferencedEnvelope.class));
    }
View Full Code Here

Examples of org.python.core.PyMethod

        return new ReferencedEnvelope((ReferencedEnvelope) result.__tojava__(ReferencedEnvelope.class));
    }

    @Override
    protected int getCountInternal(Query query) throws IOException {
        PyMethod count = (PyMethod) layer.__findattr__("count");
       
        PyObject filter = convertFilter(query.getFilter());
        PyObject result = count.__call__(filter != null ? new PyObject[]{filter} : new PyObject[]{});
        return (Integer) result.__tojava__(Integer.class);
    }
View Full Code Here

Examples of org.python.core.PyMethod

    @Override
    protected List<Name> createTypeNames() throws IOException {
        PyObject workspace = getWorkspace();
       
        PyMethod layers = (PyMethod) workspace.__findattr__("layers");
        if (layers == null) {
            layers = (PyMethod) workspace.__findattr__("keys");
        }
        PyList result = (PyList) layers.__call__();
       
        List<Name> typeNames = new ArrayList<Name>();
        for (Object o : result.toArray()) {
            typeNames.add(new NameImpl(o.toString()));
        }
View Full Code Here

Examples of org.python.core.PyMethod

    Iterator it;
   
    public PythonFeatureReader(SimpleFeatureType featureType, PyObject layer) {
        this.featureType = featureType;
       
        PyMethod features = (PyMethod) layer.__findattr__("features");
       
        this.features = (PyGenerator) features.__call__();
        this.it = this.features.iterator();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.