Collect configuration for modules that are being built.
		When this is called we should know what's being built (ie after
		dependency resolution).
439311
def config_collection_for_built(self, throw_error=True,silent=False):
		
		shutit_global.shutit_global_object.yield_to_draw()
		self.log('In config_collection_for_built',level=logging.DEBUG)
		cfg = self.cfg
		for module_id in self.module_ids():
			# Get the config even if installed or building (may be needed in other hooks, eg test).
			if (self.is_to_be_built_or_is_installed(self.shutit_map[module_id]) and
				not self.shutit_map[module_id].get_config(self)):
				self.fail(module_id + ' failed on get_config') # pragma: no cover
			# Collect the build.cfg if we are building here.
			# If this file exists, process it.
			if cfg[module_id]['shutit.core.module.build'] and not self.build['have_read_config_file']:
				# TODO: __module_file not accessible when within object - look to get this elsewhere and re-read in, then move this function into shutit object.
				cfg_file = os.path.dirname(self.shutit_file_map[module_id]) + '/configs/build.cnf'
				if os.path.isfile(cfg_file):
					self.build['have_read_config_file'] = True
					# use self.get_config, forcing the passed-in default
					config_parser = ConfigParser.ConfigParser()
					config_parser.read(cfg_file)
					for section in config_parser.sections():
						if section == module_id:
							for option in config_parser.options(section):
								override = False
								for mod, opt, val in self.build['config_overrides']:
									val = val # pylint
									# skip overrides
									if mod == module_id and opt == option:
										override = True
								if override:
									continue
								is_bool = isinstance(cfg[module_id][option], bool)
								if is_bool:
									value = config_parser.getboolean(section,option)
								else:
									value = config_parser.get(section,option)
								if option == 'shutit.core.module.allowed_images':
									value = json.loads(value)
								self.get_config(module_id, option, value, forceask=True)
		# Check the allowed_images against the base_image
		passed = True
		for module_id in self.module_ids():
			if (cfg[module_id]['shutit.core.module.build'] and
			   (cfg[module_id]['shutit.core.module.allowed_images'] and
			    self.target['docker_image'] not in cfg[module_id]['shutit.core.module.allowed_images'])):
				if not self.allowed_image(module_id):
					passed = False
					if not silent:
						shutit_global.shutit_global_object.shutit_print('\n\nWARNING!\n\nAllowed images for ' + module_id + ' are: ' + str(cfg[module_id]['shutit.core.module.allowed_images']) + ' but the configured image is: ' + self.target['docker_image'] + '\n\nIs your shutit_module_path set correctly?\n\nIf you want to ignore this, pass in the --ignoreimage flag to shutit.\n\n')
		if not passed:
			if not throw_error:
				return False
			if self.build['imageerrorok']:
				# useful for test scripts
				shutit_global.shutit_global_object.shutit_print('Exiting on allowed images error, with return status 0')
				shutit_global.shutit_global_object.handle_exit(exit_code=1)
			else:
				raise ShutItFailException('Allowed images checking failed') # pragma: no cover
		return True
912219
def build_dependencies(self):
        
        highest = self.dsm or self.root
        if self is highest:
            highest = LeafNode()
        for _import in self.parse_code():
            target = highest.get_target(_import['target'])
            if target:
                what = _import['target'].split('.')[-1]
                if what != target.name:
                    _import['what'] = what
                _import['target'] = target
            self.dependencies.append(Dependency(source=self, **_import))
449821
def get_build_artefacts(config):
    """"""

    def aux(ctx, service_name, service):
        compiler, environment = get_compiler(config, service)
        new_service, service_barts = compiler.getBuildArtefacts(environment, ctx, service)
        ctx = ctx + [service_name]
        for child_name, child in compiler.children(service):
            new_child, child_barts = aux(ctx, child_name, child)
            util.merge_into(service_barts, child_barts)
            new_service[child_name] = new_child
        return new_service, service_barts

    barts = {}
    new_config = {
        'environments': config['environments'],
    }
    for service_name, service in services(config):
        new_service, service_barts = aux([], service_name, service)
        new_config[service_name] = new_service
        util.merge_into(barts, service_barts)
    return new_config, barts
125134
def collect(self):
        """"""
        start = time()
        self._collect_copy_specs()
        self._collect_cmd_output()
        self._collect_strings()
        fields = (self.name(), time() - start)
        self._log_debug("collected plugin '%s' in %s" % fields)
768593
def get_configs(self):
        
        self.bots.check_models_ready()
        for config in self.configs.values():
            yield config
1298931
function modGetModulesExports( modules, buildinModules ) {
        var args = [];
        each(
            modules,
            function ( moduleId ) {
                args.push(
                    buildinModules[ moduleId ]
                    || modGetModuleExports( moduleId )
                );
            }
        );

        return args;
    }
954066
def collect_plugins(self, modules=None):
        
        if modules is None:
            modules = self.get_loaded_modules()
        else:
            modules = util.return_list(modules)

        plugins = []
        for module in modules:
            module_plugins = [(item[1], item[0])
                              for item
                              in inspect.getmembers(module)
                              if item[1] and item[0] != '__builtins__']
            module_plugins, names = zip(*module_plugins)

            module_plugins = self._filter_modules(module_plugins, names)
            plugins.extend(module_plugins)
        return plugins
760917
def collect(cls):
        
        constants = {}

        for method_path in WebpackConstants.get_constant_processors():
            method = import_string(method_path)

            if not callable(method):
                raise ImproperlyConfigured('Constant processor "%s" is not callable' % method_path)

            result = method(constants)

            if isinstance(result, dict):
                constants.update(result)

        return constants
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
466239
def check_dependencies(dependencies, module):
    
    if type(dependencies) == str:
        dependencies = [dependencies]
    elif type(dependencies) != list:
        raise TypeError('dependencies argument must be of type list or string')

    for dependency in dependencies:
        if dependency not in settings.INSTALLED_APPS:
            raise DependencyError('%s depends on %s, which should be in settings.INSTALLED_APPS' % (module, dependency))
867189
def collect_modules(self):
        
        coverage_dir = os.path.join(self.root, 'cover')
        for name in fnmatch.filter(os.listdir(coverage_dir), "*.html"):
                if name == 'index.html':
                    continue
                with open(os.path.join(coverage_dir, name)) as cover_file:
                    src_file, line_ranges = self.determine_coverage(cover_file)
                if not src_file:
                    continue
                src_file = os.path.abspath(os.path.join(self.root, src_file))
                if os.path.isfile(src_file):
                    yield (src_file, line_ranges)
                else:
                    raise SourceNotFound(
                        "Source file %(file)s not found at %(area)s" %
                        {'file': os.path.basename(src_file),
                         'area': os.path.dirname(src_file)})
450937
def get_collectors_from_module(mod):
    
    for attrname in dir(mod):
        attr = getattr(mod, attrname)
        # Only attempt to load classes that are infact classes
        # are Collectors but are not the base Collector class
        if ((inspect.isclass(attr) and
             issubclass(attr, Collector) and
             attr != Collector)):
            if attrname.startswith('parent_'):
                continue
            # Get class name
            fqcn = '.'.join([mod.__name__, attrname])
            try:
                # Load Collector class
                cls = load_dynamic_class(fqcn, Collector)
                # Add Collector class
                yield cls.__name__, cls
            except Exception:
                # Log error
                logger.error(
                    "Failed to load Collector: %s. %s",
                    fqcn, traceback.format_exc())
                continue
1255745
def auto_load_app_modules(self, modules):
        """"""
        for app in apps.get_app_configs():
            for module in modules:
                try:
                    import_module('{}.{}'.format(app.module.__package__, module))
                except ImportError:
                    pass
739387
def _find_configs(self):
        
        if self.config_files is not None:
            return self.config_files

        # Walk the whole project tree and look for "config.rb" files
        result = []
        for path, _, files in os.walk(self.app.root_path):
            if "config.rb" in files:
                result.append(os.path.join(path, "config.rb"))
        return result
198884
def _getModules(self):
        
        modules = {}
        modulesPath = os.path.join("application", "module")
        moduleList = os.listdir(modulesPath)

        for moduleName in moduleList:
            modulePath = os.path.join(modulesPath, moduleName, "module.py")
            if not os.path.isfile(modulePath):
                continue

            # importing module
            moduleSpec = importlib.util.spec_from_file_location(
                moduleName,
                modulePath
            )
            module = importlib.util.module_from_spec(moduleSpec)
            moduleSpec.loader.exec_module(module)

            # initializing module
            moduleInstance = module.Module(self)
            modules[moduleName] = moduleInstance

        return modules
511271
public static boolean checkConfiguredInModules() {

        Boolean result = m_moduleCheckCache.get();
        if (result == null) {
            result = Boolean.valueOf(getConfiguredTemplateMapping() != null);
            m_moduleCheckCache.set(result);
        }
        return result.booleanValue();
    }
1152239
private static List<ModuleRef> findModuleRefs(final LinkedHashSet<Object> layers, final ScanSpec scanSpec,
            final LogNode log) {
        if (layers.isEmpty()) {
            return Collections.emptyList();
        }

        // Traverse the layer DAG to find the layer resolution order
        final Deque<Object> /* Deque<ModuleLayer> */ layerOrder = new ArrayDeque<>();
        final Set<Object> /* Set<ModuleLayer */ parentLayers = new HashSet<>();
        for (final Object layer : layers) {
            findLayerOrder(layer, /* layerVisited = */ new HashSet<>(), parentLayers, layerOrder);
        }
        if (scanSpec.addedModuleLayers != null) {
            for (final Object layer : scanSpec.addedModuleLayers) {
                findLayerOrder(layer, /* layerVisited = */ new HashSet<>(), parentLayers, layerOrder);
            }
        }

        // Remove parent layers from layer order if scanSpec.ignoreParentModuleLayers is true
        List<Object> /* List<ModuleLayer> */ layerOrderFinal;
        if (scanSpec.ignoreParentModuleLayers) {
            layerOrderFinal = new ArrayList<>();
            for (final Object layer : layerOrder) {
                if (!parentLayers.contains(layer)) {
                    layerOrderFinal.add(layer);
                }
            }
        } else {
            layerOrderFinal = new ArrayList<>(layerOrder);
        }

        // Find modules in the ordered layers
        final Set<Object> /* Set<ModuleReference> */ addedModules = new HashSet<>();
        final LinkedHashSet<ModuleRef> moduleRefOrder = new LinkedHashSet<>();
        for (final Object /* ModuleLayer */ layer : layerOrderFinal) {
            final Object /* Configuration */ configuration = ReflectionUtils.invokeMethod(layer, "configuration",
                    /* throwException = */ true);
            if (configuration != null) {
                // Get ModuleReferences from layer configuration
                @SuppressWarnings("unchecked")
                final Set<Object> /* Set<ResolvedModule> */ modules = (Set<Object>) ReflectionUtils
                        .invokeMethod(configuration, "modules", /* throwException = */ true);
                if (modules != null) {
                    final List<ModuleRef> modulesInLayer = new ArrayList<>();
                    for (final Object /* ResolvedModule */ module : modules) {
                        final Object /* ModuleReference */ moduleReference = ReflectionUtils.invokeMethod(module,
                                "reference", /* throwException = */ true);
                        if (moduleReference != null && addedModules.add(moduleReference)) {
                            try {
                                modulesInLayer.add(new ModuleRef(moduleReference, layer));
                            } catch (final IllegalArgumentException e) {
                                if (log != null) {
                                    log.log("Exception while creating ModuleRef for module " + moduleReference, e);
                                }
                            }
                        }
                    }
                    // Sort modules in layer by name
                    CollectionUtils.sortIfNotEmpty(modulesInLayer);
                    moduleRefOrder.addAll(modulesInLayer);
                }
            }
        }
        return new ArrayList<>(moduleRefOrder);
    }