Returns all the classes found in a sorted map for the given list of packages
183667
public SortedMap<String, Class<?>> getClassesMap(Package... packages) {
        SortedMap<String, Class<?>> answer = new TreeMap<String, Class<?>>();
        Map<String, ClassResource> urlSet = new HashMap<String, ClassResource>();
        for (Package aPackage : packages) {
            addPackageResources(aPackage, urlSet, classLoaders);
        }
        for (ClassResource classResource : urlSet.values()) {
            Set<Class<?>> classes = getClassesForPackage(classResource, null, null);
            for (Class<?> aClass : classes) {
                answer.put(aClass.getName(), aClass);
            }
        }
        return answer;
    }
426826
def GetAllPackages(classification):
		
		packages = []
		for visibility in Blueprint.visibility_stoi.keys():
			try:
				for r in Blueprint.GetPackages(classification,visibility):  packages.append(dict(r.items()+{'Visibility':visibility}.items()))
			except:
				pass
		if len(packages):  return(packages)
1232186
def collect_loaded_packages() -> List[Tuple[str, str]]:
    
    dists = get_installed_distributions()
    get_dist_files = DistFilesFinder()
    file_table = {}
    for dist in dists:
        for file in get_dist_files(dist):
            file_table[file] = dist
    used_dists = set()
    # we greedily load all values to a list to avoid weird
    # "dictionary changed size during iteration" errors
    for module in list(sys.modules.values()):
        try:
            dist = file_table[module.__file__]
        except (AttributeError, KeyError):
            continue
        used_dists.add(dist)
    return sorted((dist.project_name, dist.version) for dist in used_dists)
721903
def find_packages(name, pkg_dir):
    """"""
    for c in (FileSystemPackageBuilder, ZipPackageBuilder, ExcelPackageBuilder):

        package_path, cache_path = c.make_package_path(pkg_dir, name)

        if package_path.exists():

            yield c.type_code, package_path, cache_path
440615
public static List<String> getAllClassesInPackage(String packageName) {
		List<String> classesNames = new Vector<>();
		// create scanner and disable default filters (that is the 'false' argument)
		final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
		// add include filters which matches all the classes (or use your own)
		provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*")));

		// get matching classes defined in the package
		final Set<BeanDefinition> classes = provider.findCandidateComponents(packageName);

		// this is how you can load the class type from BeanDefinition instance
		for (BeanDefinition bean : classes) {
			classesNames.add(bean.getBeanClassName());
		}
		return classesNames;
	}
901699
def classes(self):
        
        p = lambda o: isinstance(o, Class) and self._docfilter(o)
        return sorted(filter(p, self.doc.values()))
321927
private static Set<Class<?>> findEnumClassesWithFile(final String packageName, final Path dir) {
		Set<Class<?>> classes = new HashSet<>();
		try (Stream<Path> stream = Files.walk(dir)) {
			stream.filter(entry -> entry.getFileName().toString().endsWith(".class")).forEach(file -> {
				StringJoiner joiner = new StringJoiner(".", packageName + ".", "");
				dir.relativize(file).forEach(p -> joiner.add(p.toString()));
				String className = joiner.toString().replaceAll(".class$", "");
				loadEnum(className).ifPresent(classes::add);
			});
		} catch (IOException e) {
			LOG.error(e.getMessage(), e);
		}

		return classes;
	}
1272546
public List<String> findPackages() {
    List<String>	result;
    Iterator<String> packages;

    result   = new ArrayList<>();
    packages = m_Cache.packages();
    while (packages.hasNext())
      result.add(packages.next());
    Collections.sort(result, new StringCompare());

    return result;
  }
597485
def load_classes(package_str):
    ''''''

    _logger.debug('Loading all modules from %s', package_str)
    package = importlib.import_module(package_str)
    package_path = package.__path__
    _logger.debug('Searching for modules in package %s (%s)', package_str, package_path)
    for _, name, ispkg in pkgutil.iter_modules(package_path, package_str + "."):
        if not ispkg:
            _logger.debug('Found module: %s', name)
            module = importlib.import_module(name)
            if hasattr(module, CLASS_NAME_ATTR):
                class_name = getattr(module, CLASS_NAME_ATTR)
                _logger.debug('Found class: %s', class_name)
                clasz = getattr(module, class_name)

                if package_str not in _dynamo_cache:
                    _dynamo_cache[package_str] = CaseInsensitiveDict()
                
                if class_name not in _dynamo_cache[package_str]:
                    _dynamo_cache[package_str][class_name] = clasz
                    _logger.debug('Correctly loaded class: %s from: "%s"', class_name, package_str)
                else:
                    _logger.warning('Already loaded class: %s from: "%s"', class_name, package_str)
            else:
                _logger.warning('Module inside %s does not contain required attribute: %s', package_str, CLASS_NAME_ATTR)
        else:
            _logger.warning('Ignoring package: %s', name)

    if package_str in _dynamo_cache:
        return _dynamo_cache[package_str]
    else:
        return None
873766
def getClassInPackageFromName(className, pkg):
    
    # TODO: more efficiency!
    n = getAvClassNamesInPackage(pkg)
    i = n.index(className)
    c = getAvailableClassesInPackage(pkg)
    return c[i]
111507
def find_all(name, opts={})
      # opts ||= {}
      all = [@packages.select {|x| x.name.to_s == name.to_s },
      find_all_by_provides(name, opts)].flatten.compact
      filter(all, opts)
    end
623621
@SuppressWarnings("unchecked")
  private static List<Class<RDDProcessor>> findProcessorClassesInPackage(String packageName) {
    List<Class<RDDProcessor>> streamProcClasses = new ArrayList<Class<RDDProcessor>>();
    try {
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      String path = packageName.replace('.', '/');
      Enumeration<URL> resources = classLoader.getResources(path);
      Set<String> classes = new TreeSet<String>();
      while (resources.hasMoreElements()) {
        URL resource = (URL) resources.nextElement();
        classes.addAll(findClasses(resource.getFile(), packageName));
      }
      for (String classInPackage : classes) {
        Class<?> theClass = classLoader.loadClass(classInPackage);
        if (RDDProcessor.class.isAssignableFrom(theClass))
          streamProcClasses.add((Class<RDDProcessor>) theClass);
      }
    } catch (Exception e) {
      // safe to squelch this as it's just looking for streamProcs to run
      e.printStackTrace();
    }
    return streamProcClasses;
  }
604309
public ImmutableSet<ClassInfo> getAllClassesRecursive(String packageName) {
    checkNotNull(packageName);
    String packagePrefix = packageName + '.';
    ImmutableSet.Builder<ClassInfo> builder = ImmutableSet.builder();
    ImmutableSet<ClassInfo> allClasses = getAllClasses();
    List<String> debugData = Lists.newLinkedList();
    for (ClassInfo classInfo : allClasses) {
      if (classInfo.getName().startsWith(packagePrefix)) {
        builder.add(classInfo);
        debugData.add(classInfo.getResourceName() + "\n");
      }
    }
    return builder.build();
  }
1183768
public static List<String> getAllClasses() throws PackageManager.NameNotFoundException, IOException {
        List<String> classNames = new ArrayList<>();
        for (String path : getSourcePaths()) {
            try {
                DexFile dexfile;
                if (path.endsWith(EXTRACTED_SUFFIX)) {
                    //NOT use new DexFile(path), because it will throw "permission error in /data/dalvik-cache"
                    dexfile = DexFile.loadDex(path, path + ".tmp", 0);
                } else {
                    dexfile = new DexFile(path);
                }
                Enumeration<String> dexEntries = dexfile.entries();
                while (dexEntries.hasMoreElements()) {
                    classNames.add(dexEntries.nextElement());
                }
            } catch (IOException e) {
                throw new IOException("Error at loading dex file '" + path + "'");
            }
        }
        return classNames;
    }
318169
def getAvailableClassesInPackage(package):
    
    l = list(x[1] for x in inspect.getmembers(package, inspect.isclass))

    modules = list(x[1] for x in inspect.getmembers(package, inspect.ismodule))
    for m in modules:
        l.extend(list(x[1] for x in inspect.getmembers(m, inspect.isclass)))
    l = [x for x in l if x.__name__[0] != "_"]
    n = 0
    while n < len(l):
        cls = l[n]
        if not cls.__module__.startswith(package.__name__):
            l.pop(n)
            n -= 1
        n += 1
    return l
53839
synchronized public static <T> Set<ClassInfo> getNonAbstractSubClassInfoSet(Class<T> parentClass, String... packageNames) {
        if (packageNames == null || packageNames.length == 0) {
            packageNames = defaultPackages();
        }
        try (ScanResult scanResult =
                     new ClassGraph()
                             .enableAllInfo()
                             .whitelistPackages(packageNames)
                             .scan()) {
            ClassInfoList classInfos = parentClass.isInterface() ?
                    scanResult.getClassesImplementing(parentClass.getName()) :
                    scanResult.getSubclasses(parentClass.getName());
            return classInfos
                    .stream()
                    .filter(classInfo -> !classInfo.isAbstract())
                    .collect(Collectors.toSet());
        }
    }
1062630
public static List<Class<?>> scanPackage(String... packages) throws IOException, ClassNotFoundException {
        List<Class<?>> list = new ArrayList<>();
        for (String pkg : packages) {
            list.addAll(getClasses(pkg));
        }
        return list;
    }