Package org.python.core

Examples of org.python.core.PyList


        // the charset is important. if the GraphitePickleReporter and this test
        // don't agree, the header is not always correctly unpacked.
        String payload = output.toString("UTF-8");

        PyList result = new PyList();
        int nextIndex = 0;
        while (nextIndex < payload.length()) {
            Bindings bindings = new SimpleBindings();
            bindings.put("payload", payload.substring(nextIndex));
            unpickleScript.eval(bindings);
            result.addAll(result.size(), (PyList) bindings.get("metrics"));
            nextIndex += (Integer) bindings.get("batchLength");
        }

        for (Object aResult : result) {
            PyTuple datapoint = (PyTuple) aResult;
View Full Code Here


    public static PyObject pigToPython(Object object) {
        if (object instanceof Tuple) {
            return pigTupleToPyTuple((Tuple) object);
        } else if (object instanceof DataBag) {
            PyList list = new PyList();
            for (Tuple bagTuple : (DataBag) object) {
                list.add(pigTupleToPyTuple(bagTuple));
            }
            return list;
        } else if (object instanceof Map<?, ?>) {
            PyDictionary newMap = new PyDictionary();
            for (Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
View Full Code Here

        scriptTestData = new ScriptTestData();
        scriptBreakpoint = new ScriptBreakpoint();
    }

    public Component getComponent(String componentName, PyDictionary overriddenData) throws QTasteException {
        PyList oldValues = SaveTestDataValues(overriddenData);
        Component component = null;
        try {
            component = testAPI.getComponent(componentName, testData);
        } finally {
            RestoreTestDataValues(oldValues);
View Full Code Here

        }
        return true;
    }

    protected PyList SaveTestDataValues(PyDictionary pythonArguments) throws QTasteDataException {
        PyList oldValues = new PyList();
        Iterator<?> argIterator = pythonArguments.items().iterator();
        while (argIterator.hasNext()) {
            Object oArg = argIterator.next();
            if (oArg instanceof PyTuple) {
                PyTuple argType = (PyTuple) oArg;
                PyObject[] pyObj = argType.getArray();
                assert pyObj[0] instanceof PyString;
                String key = pyObj[0].toString();
                // store the old value of the passed argument
                Object[] oldValue = new Object[2];
                oldValue[0] = key;
                try {
                    oldValue[1] = testData.getValue(key);
                } catch (QTasteDataException e) {
                    // do nothing, no testdata to overwrite
                    oldValue[1] = null;
                }
                oldValues.add(oldValue);
                testData.setValue(key, pyObj[1].toString());
            }
        }
        return oldValues;
    }
View Full Code Here

            Object javaInstance = pyInstance.__dir__().__tojava__(Object.class);
            debugVar = dumpPythonObject(javaInstance, debugVar);
            return debugVar;
        }
        if (value instanceof PyList) {
            PyList listValue = (PyList) value;
            Object[] dataArray = (Object[]) listValue.getArray();
            for (int i = 0; i < listValue.__len__(); i++) {
                Object o = dataArray[i];
                debugVar.addField(new DebugVariable("[" + i + "]",
                        o.getClass().toString(), o.toString()));
            }
            return debugVar;
View Full Code Here

                }*/

            }
            if (mLocals instanceof PyStringMap) {
                PyStringMap locals = (PyStringMap) mLocals;
                PyList keys = locals.keys();
                Iterator<?> localIt = keys.iterator();
                while (localIt.hasNext()) {
                    Object oMap = localIt.next();
                    if (oMap instanceof String) {
                        String localKey = (String) oMap;
                        Object oValue = locals.get(new PyString(localKey));
View Full Code Here

    public static PyObject pigToPython(Object object) {
        if (object instanceof Tuple) {
            return pigTupleToPyTuple((Tuple) object);
        } else if (object instanceof DataBag) {
            PyList list = new PyList();
            for (Tuple bagTuple : (DataBag) object) {
                list.add(pigTupleToPyTuple(bagTuple));
            }
            return list;
        } else if (object instanceof Map<?, ?>) {
            PyDictionary newMap = new PyDictionary();
            for (Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
View Full Code Here

   {
      try
      {
         final PythonInterpreter interp = this.getCurrentInterpreter();
         PyObject obj = interp.eval("dir(" + selectedToken + ")");
         PyList pyList = (PyList) obj;
         final ScriptInfoPanel info = ScriptInfoPanel.getInstance();
         info.getListModel().clear();
         for (Object o : pyList)
         {
            final String s = o.toString();
View Full Code Here

   * Get PyList from a list column
   *
   * @return PyList
   */
  public PyList getList() {
    return new PyList(column.getList());
  }
View Full Code Here

    public static PyObject pigToPython(Object object) {
        if (object instanceof Tuple) {
            return pigTupleToPyTuple((Tuple) object);
        } else if (object instanceof DataBag) {
            PyList list = new PyList();
            for (Tuple bagTuple : (DataBag) object) {
                list.add(pigTupleToPyTuple(bagTuple));
            }
            return list;
        } else if (object instanceof Map<?, ?>) {
            PyDictionary newMap = new PyDictionary();
            for (Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
View Full Code Here

TOP

Related Classes of org.python.core.PyList

Copyright © 2018 www.massapicom. 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.