Return the set of dependent modules for used modules,
        classes and routines.
513408
def _find_dependent_modules(self, module):
        
        dms = set()
        for um in inspect.getmembers(module, inspect.ismodule):
            dms.add(um[1])

        for uc in inspect.getmembers(module, inspect.isclass):
            self._add_obj_module(dms, uc[1])
        for ur in inspect.getmembers(module, inspect.isroutine):
            self._add_obj_module(dms, ur[1])

        return dms
471532
def get_modules():
    '''
    
    '''
    modules = []
    module_list = exec_action('modules', 'list', action_parameter='--only-names')
    if not module_list:
        return None

    for module in module_list:
        if module not in ['help', 'usage', 'version']:
            modules.append(module)
    return modules
1206458
public static List<Dependency> getAllDependencies(final Module module) {
        final Set<Dependency> dependencies = new HashSet<Dependency>();
        final List<String> producedArtifacts = new ArrayList<String>();
        for(final Artifact artifact: getAllArtifacts(module)){
            producedArtifacts.add(artifact.getGavc());
        }

        dependencies.addAll(getAllDependencies(module, producedArtifacts));

        return new ArrayList<Dependency>(dependencies);
    }
1274570
def load_modules(self):
        """"""
        if self.INTERFACES_MODULE is None:
            raise NotImplementedError("A module containing interfaces modules "
                                      "should be setup in INTERFACES_MODULE !")
        else:
            for module, permission in self.modules.items():
                i = getattr(self.INTERFACES_MODULE,
                            module).Interface(self, permission)
                self.interfaces[module] = i
1362868
def get_all_classes(module_name):
    """"""
    module = importlib.import_module(module_name)
    return getmembers(module, lambda m: isclass(m) and not isabstract(m))
1112451
def get_modules(self):
        
        plugins = []
        for path in self.package.__path__:
            if os.path.isdir(path):
                plugins.extend(self._find_plugins_in_dir(path))

        return plugins
1080868
def _build_all_dependencies(self):
        '''
        
        '''
        ret = {}
        for model, schema in six.iteritems(self._models()):
            dep_list = self._build_dependent_model_list(schema)
            ret[model] = dep_list
        return ret
49474
def get_module_plugins(module, classobj):
    
    try:
        names = module.__all__
    except AttributeError:
        names = [x for x in vars(module) if not x.startswith('_')]
    for name in names:
        try:
            obj = getattr(module, name)
        except AttributeError:
            continue
        try:
            if issubclass(obj, classobj):
                yield obj
        except TypeError:
            continue
742048
def dependencies_as_list(self):
        """"""
        dependencies = []
        for dependency in self.dependencies:
            dependencies.append(dependency.name)
        return dependencies
193651
def get_imported_modules(self, module):
    """"""
    for name, member in inspect.getmembers(module):
      if inspect.ismodule(member):
        yield name, member
750136
def dependencies(self, sort=False):
        
        alldeps = []
        if sort:
            def key(obj):
                # sort deps such that we get functions, variables, self.
                if not isinstance(obj, Variable):
                    return (0, 0)
                else:
                    return (1, obj.vtype)
            
            deps = sorted(self._deps, key=key)
        else:
            deps = self._deps
        
        for dep in deps:
            alldeps.extend(dep.dependencies(sort=sort))
        alldeps.append(self)
        return alldeps
1137416
def _get_loaded_modules():
        """"""
        output = subprocess.check_output(['apache2ctl', '-M'])
        if six.PY3:
            output = output.decode('utf-8')
        modules = []
        for line in output.splitlines():
            # Each line of the enabled module output looks like:
            #  module_name (static|shared)
            # Plus a header line at the top of the output which is stripped
            # out by the regex.
            matcher = re.search(r'^ (\S*)_module (\S*)', line)
            if matcher:
                modules.append(matcher.group(1))
        return modules
68200
def collect_modules(self):
        
        try:
            res = {}
            m = sys.modules
            for k in m:
                # Don't report submodules (e.g. django.x, django.y, django.z)
                # Skip modules that begin with underscore
                if ('.' in k) or k[0] == '_':
                    continue
                if m[k]:
                    try:
                        d = m[k].__dict__
                        if "version" in d and d["version"]:
                            res[k] = self.jsonable(d["version"])
                        elif "__version__" in d and d["__version__"]:
                            res[k] = self.jsonable(d["__version__"])
                        else:
                            res[k] = get_distribution(k).version
                    except DistributionNotFound:
                        pass
                    except Exception:
                        logger.debug("collect_modules: could not process module: %s" % k)

        except Exception:
            logger.debug("collect_modules", exc_info=True)
        else:
            return res
1245625
public Map<String,Set<String>> getDependencies() {
        Map<String,Set<String>> new_deps = new HashMap<String,Set<String>>();
        if (explicitPackages == null) return new_deps;
        for (Name pkg : explicitPackages) {
            Set<Name> set = deps.get(pkg);
            if (set != null) {
                Set<String> new_set = new_deps.get(pkg.toString());
                if (new_set == null) {
                    new_set = new HashSet<String>();
                    // Modules beware....
                    new_deps.put(":"+pkg.toString(), new_set);
                }
                for (Name d : set) {
                    new_set.add(":"+d.toString());
                }
            }
        }
        return new_deps;
    }
757360
public static Set<Dependency> getAllDependencies(final Module module, final List<String> producedArtifacts) {
        final Set<Dependency> dependencies = new HashSet<Dependency>();

        for(final Dependency dependency: module.getDependencies()){
            if(!producedArtifacts.contains(dependency.getTarget().getGavc())){
                dependencies.add(dependency);
            }
        }

        for(final Module subModule: module.getSubmodules()){
            dependencies.addAll(getAllDependencies(subModule, producedArtifacts));
        }

        return dependencies;
    }
423183
def get_module(self, module_name):
        """"""
        try:
            return self.module[module_name]

        except KeyError:
            return sys.modules[module_name]
1086973
def find_objects(modules):
    
    return {
        subclass.__name__: subclass
        for subclass in chain(
            get_all_subclasses(Object),
            get_all_subclasses(ObjectSet),
        )
        if subclass.__module__ in modules
    }