PythonCondaInterpreter extends Interpreter { public static List<String> getRestArgsFromMatcher(Matcher m) { return new ArrayList<>(Arrays.asList(m.group(1).split(" "))); } PythonCondaInterpreter(Properties property); @Override void open(); @Override void close(); @Override InterpreterResult interpret(String st, InterpreterContext context); String getCurrentCondaEnvName(); void setCurrentCondaEnvName(String currentCondaEnvName); static String runCondaCommandForTextOutput(String title, List<String> commands); static String wrapCondaBasicOutputStyle(String title, String content); static String wrapCondaTableOutputStyle(String title, Map<String, String> kv); static Map<String, String> parseCondaCommonStdout(String out); @Override void cancel(InterpreterContext context); @Override FormType getFormType(); @Override int getProgress(InterpreterContext context); @Override Scheduler getScheduler(); static String runCommand(List<String> commands); static String runCommand(String... command); static List<String> getRestArgsFromMatcher(Matcher m); static final String ZEPPELIN_PYTHON; static final String CONDA_PYTHON_PATH; static final String DEFAULT_ZEPPELIN_PYTHON; static final Pattern PATTERN_OUTPUT_ENV_LIST; static final Pattern PATTERN_COMMAND_ENV_LIST; static final Pattern PATTERN_COMMAND_ENV; static final Pattern PATTERN_COMMAND_LIST; static final Pattern PATTERN_COMMAND_CREATE; static final Pattern PATTERN_COMMAND_ACTIVATE; static final Pattern PATTERN_COMMAND_DEACTIVATE; static final Pattern PATTERN_COMMAND_INSTALL; static final Pattern PATTERN_COMMAND_UNINSTALL; static final Pattern PATTERN_COMMAND_HELP; static final Pattern PATTERN_COMMAND_INFO; }
@Test public void testGetRestArgsFromMatcher() { Matcher m = PythonCondaInterpreter.PATTERN_COMMAND_ENV.matcher("env remove --name test --yes"); m.matches(); List<String> restArgs = PythonCondaInterpreter.getRestArgsFromMatcher(m); List<String> expected = Arrays.asList(new String[]{"remove", "--name", "test", "--yes"}); assertEquals(expected, restArgs); }