private static @NotNull List<PyPackage> collectPackagesInModule(@NotNull Module module) {
    final String[] metadataExtensions = {"egg-info", "dist-info"};
    final List<PyPackage> result = new SmartList<>();

    for (VirtualFile srcRoot : PyUtil.getSourceRoots(module)) {
      for (VirtualFile metadata : VfsUtil.getChildren(srcRoot, file -> ArrayUtil.contains(file.getExtension(), metadataExtensions))) {
        final String[] nameAndVersionAndRest = metadata.getNameWithoutExtension().split("-", 3);
        if (nameAndVersionAndRest.length >= 2) {
          result.add(new PyPackage(nameAndVersionAndRest[0], nameAndVersionAndRest[1]));
        }
      }
    }

    return result;
  }
private static @NotNull List<PyPackage> collectPackagesInModule(@NotNull Module module)