Examples of PyString


Examples of org.python.core.PyString

                    .append(metricName)
                    .append(".")
                    .append(valueName)
                    .toString();
            }
            PyTuple tuple = new PyTuple(new PyString(metricName),
                new PyTuple(new PyLong(timestamp), new PyString(value)));
            metrics.add(tuple);
            if(metrics.size() >= batchSize) {
                writeMetrics();
            }
        }
View Full Code Here

Examples of org.python.core.PyString

    }

    private String encode(String arg) {
        if (arg == null)
            return "None";
        return (new PyString(arg)).__repr__().toString();
    }
View Full Code Here

Examples of org.python.core.PyString

        PyObject builtin = interpreterEval("__builtin__");
        PyObject pyString;
        if (value == null)
            pyString = Py.None;
        else
            pyString = new PyString(value);
        builtin.__setattr__(varname, pyString);
    }
View Full Code Here

Examples of org.python.core.PyString

    private void clearModuleDefinitions() {
        interpreterExec("import sys");
        interpreterExec("from java.awt import Color");
        PySystemState system = (PySystemState) interpreter.get("sys");
        PyStringMap modules = (PyStringMap) system.__getattr__("modules");
        PyObject builtin = modules.get(new PyString("__builtin__"));
        modules.clear();
        modules.__setitem__("__builtin__", builtin);
    }
View Full Code Here

Examples of org.python.core.PyString

                String key = (String) entry.getKey();
                String value = entry.getValue().toString();
                PyObject pyValue;
                if ((value.startsWith("\"") && value.endsWith("\"")) || (value.startsWith("'") || value.endsWith("'"))) {
                    value = value.substring(1, value.length() - 1);
                    pyValue = new PyString(value);
                } else {
                    try {
                        int v = Integer.parseInt(value);
                        pyValue = new PyInteger(v);
                    } catch (NumberFormatException e) {
                        try {
                            double v = Double.parseDouble(value);
                            pyValue = new PyFloat(v);
                        } catch (NumberFormatException e1) {
                            pyValue = new PyString(value);
                        }
                    }
                }
                builtin.__setattr__(key, pyValue);
            } catch (Throwable t) {
View Full Code Here

Examples of org.python.core.PyString

    public String encode(String arg) {
        if (arg == null)
            return "None";
        String decodedArg = PyString.decode_UnicodeEscape(arg, 0, arg.length(), "", true);
        return (new PyString(decodedArg)).__repr__().toString();
    }
View Full Code Here

Examples of org.python.core.PyString

public class PythonEscape {
    public static String encode(String arg) {
        if (arg == null)
            return "None";
        return (new PyString(arg)).__repr__().toString();
    }
View Full Code Here

Examples of org.python.core.PyString

                  }
                  PySystemState  state = Py.getSystemState();
                  state.argv.clear();
                  if( argv != null ) {
                    for (String str : argv ) {
                      state.argv.append(new PyString(str));
                    }
                  } else {
                    LOG.warn(PigContext.PIG_CMD_ARGS_REMAINDERS
                      + " is empty. This is not expected unless on testing." );
                  }
View Full Code Here

Examples of org.python.core.PyString

   * Get PyString from a string column
   *
   * @return PyString
   */
  public PyString getString() {
    return new PyString(column.getString());
  }
View Full Code Here

Examples of org.python.core.PyString

        String testRoot = getJythonTestRoot();
        String xmlReportFile = getOptionalXmlReportFilename();
        String ignoreFile = getOptionalIgnoreFile();

        PythonInterpreter interp = createInterpreterWithArgs(xmlReportFile, ignoreFile);
        interp.getSystemState().path.insert(0, new PyString(binding));
        interp.getSystemState().path.insert(0, new PyString(testRoot));

        LOGGER.info("About to call Jython test script: '" + testScript
                + "' with '" + testRoot + "' added to Jython path");

        int maxInvocations = Integer.getInteger(TEST_INVOCATIONS_SYSTEM_PROPERTY, 1);
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.