public void updatePyPICache(@NotNull PyPackageService service) throws IOException { service.LAST_TIME_CHECKED = System.currentTimeMillis(); service.PY_PACKAGES.clear(); if (service.PYPI_REMOVED) return; parsePyPIList(parsePyPIListFromWeb(PYPI_LIST_URL, true), service); }
private void parsePyPIList(@NotNull List<String> packages, @NotNull PyPackageService service) { myPackageNames = null; for (String pyPackage : packages) { try { final String packageName = URLDecoder.decode(pyPackage, "UTF-8"); if (!packageName.contains(" ")) { service.PY_PACKAGES.put(packageName, ""); } } catch (UnsupportedEncodingException e) { LOG.warn(e.getMessage()); } } }
public void parsePyPIList(final List<String> packages, final PyPackageService service) { myPackageNames = null; for (String pyPackage : packages) { try { final Matcher matcher = PYPI_PATTERN.matcher(URLDecoder.decode(pyPackage, "UTF-8")); if (matcher.find()) { final String packageName = matcher.group(1); final String packageVersion = matcher.group(2); if (!packageName.contains(" ")) service.PY_PACKAGES.put(packageName, packageVersion); } } catch (UnsupportedEncodingException e) { LOG.warn(e.getMessage()); } } }