def available_extensions(base_class, path):

    with _extensions_lock:
        key = (base_class, path)
        if key in _extensions_cache:
            return _extensions_cache[key]

        def print_log(m, e=None):
            LOG.warning("Cannot import module '%s'", m)
            if e is not None:
                LOG.debug(e, exc_info=True)

        extensions = []
        LOG.debug("Scanning available '%s' extensions for %s",
                  base_class, path)
        root_module = importlib.import_module(path)
        module_path = os.path.dirname(root_module.__file__)
        packages = pkgutil.walk_packages(
            path=[module_path],
            prefix=path + '.',
            onerror=print_log)
        for _, name, is_pkg in packages:
            if not is_pkg:
                try:
                    module = importlib.import_module(name)
                except Exception:  # pylint: disable=broad-except
                    print_log(name)
                    continue
                members = inspect.getmembers(module, inspect.isclass)
                for item, klass in members:
                    if klass != base_class and issubclass(klass, base_class):
                        LOG.debug("Extension '%s' found!", item)
                        extensions.append(klass)

        if extensions:
            _extensions_cache[key] = extensions
        else:
            LOG.error("Extensions not found")

        return extensions
Launch a subprocess running C{pyflakes}.
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/extensions.py/available_extensions--crossover with--dataset/ETHPy150Open patrys/PythonChecker/pyflakes/test/test_api.py/IntegrationTests.runPyflakes