Add/remove features and resolve dependencies between them
180252
def _finalize_features(self):
        """"""

        # First, flag all the enabled items (and thus their dependencies)
        for name, feature in self.features.items():
            enabled = self.feature_is_included(name)
            if enabled or (enabled is None and feature.include_by_default()):
                feature.include_in(self)
                self._set_feature(name, 1)

        # Then disable the rest, so that off-by-default features don't
        # get flagged as errors when they're required by an enabled feature
        for name, feature in self.features.items():
            if not self.feature_is_included(name):
                feature.exclude_from(self)
                self._set_feature(name, 0)
192922
def update(cls, content, dependency, version, spec="==", hashes=()):
        
        new_line = "{name}{spec}{version}".format(name=dependency.full_name, spec=spec, version=version)
        appendix = ''
        # leave environment markers intact
        if ";" in dependency.line:
            # condense multiline, split out the env marker, strip comments and --hashes
            new_line += ";" + dependency.line.splitlines()[0].split(";", 1)[1] \
                .split("#")[0].split("--hash")[0].rstrip()
        # add the comment
        if "#" in dependency.line:
            # split the line into parts: requirement and comment
            parts = dependency.line.split("#")
            requirement, comment = parts[0], "#".join(parts[1:])
            # find all whitespaces between the requirement and the comment
            whitespaces = (hex(ord('\t')), hex(ord(' ')))
            trailing_whitespace = ''
            for c in requirement[::-1]:
                if hex(ord(c)) in whitespaces:
                    trailing_whitespace += c
                else:
                    break
            appendix += trailing_whitespace + "#" + comment
        # if this is a hashed requirement, add a multiline break before the comment
        if dependency.hashes and not new_line.endswith("\\"):
            new_line += " \\"
        # if this is a hashed requirement, add the hashes
        if hashes:
            for n, new_hash in enumerate(hashes):
                new_line += "\n    --hash={method}:{hash}".format(
                    method=new_hash['method'],
                    hash=new_hash['hash']
                )
                # append a new multiline break if this is not the last line
                if len(hashes) > n + 1:
                    new_line += " \\"
        new_line += appendix

        regex = cls.SUB_REGEX.format(re.escape(dependency.line))

        return re.sub(regex, new_line, content, flags=re.MULTILINE)
796780
void resolveFeatures(ResolutionMode mode) {
        boolean allowMultipleVersions = mode == ResolutionMode.IGNORE_CONFLICTS ? true : false;
        FeatureResolver resolver = new FeatureResolverImpl();
        Result result = resolver.resolveFeatures(resolverRepository, featureNamesToResolve, Collections.<String> emptySet(), allowMultipleVersions);
        for (String name : result.getResolvedFeatures()) {
            ProvisioningFeatureDefinition feature = resolverRepository.getFeature(name);
            resolvedFeatures.put(feature.getSymbolicName(), feature);
        }

        for (String missingFeature : result.getMissing()) {
            Collection<ApplicableToProduct> featureOtherProducts = resolverRepository.getNonApplicableResourcesForName(missingFeature);
            if (featureOtherProducts.isEmpty()) {
                featuresMissing.add(missingFeature);
            } else {
                requirementsFoundForOtherProducts.add(missingFeature);
                for (ApplicableToProduct feature : featureOtherProducts) {
                    resourcesWrongProduct.add(feature);
                }
            }
        }
    }
194782
def add_dependency(name, version_requirement=nil, repository=nil)
      validate_name(name)
      validate_version_range(version_requirement) if version_requirement

      if dup = @data['dependencies'].find { |d| d.full_module_name == name && d.version_requirement != version_requirement }
        raise ArgumentError, _("Dependency conflict for %{module_name}: Dependency %{name} was given conflicting version requirements %{version_requirement} and %{dup_version}. Verify that there are no duplicates in the metadata.json.") % { module_name: full_module_name, name: name, version_requirement: version_requirement, dup_version: dup.version_requirement }
      end

      dep = Dependency.new(name, version_requirement, repository)
      @data['dependencies'].add(dep)

      dep
    end
227638
def _dependencies(seen, engines)
      key = [@options[:filename], @options[:importer]]
      return if seen.include?(key)
      seen << key
      engines << self
      to_tree.grep(Tree::ImportNode) do |n|
        next if n.css_import?
        n.imported_file._dependencies(seen, engines)
      end
    end
856439
public void resolve(String feature, File esaFile, String toExtension) throws InstallException {
        getResolveDirector().resolve(feature, esaFile, toExtension);
    }
195262
def add_dependency(self,my_dep):
        
        if self.dependency_layer is None:
            self.dependency_layer = Cdependencies()
            self.root.append(self.dependency_layer.get_node())
        self.dependency_layer.add_dependency(my_dep)
415275
def _add_dependency(container, obj):
    '''
    
    '''
    if os.path.basename(obj.__file__).split('.')[0] == '__init__':
        container.append(os.path.dirname(obj.__file__))
    else:
        container.append(obj.__file__.replace('.pyc', '.py'))
870139
public static ArrayList<String> fixRequiredByFeature(String fixApar, Map<String, ProvisioningFeatureDefinition> installedFeatures) {
        ArrayList<String> dependencies = new ArrayList<String>();
        for (ProvisioningFeatureDefinition fd : installedFeatures.values()) {
            String requireFixes = fd.getHeader("IBM-Require-Fix");
            if (requireFixes != null && requireFixes.length() > 0) {
                String[] apars = requireFixes.split(";");
                for (String apar : apars) {
                    if (apar.trim().equals(fixApar.trim())) {
                        dependencies.add(apar);
                    }
                }
            }
        }
        if (dependencies.isEmpty())
            return null;
        return dependencies;
    }
648763
function(module) {
			if (!module) {
				return;
			}

			var file = fileByModules(module);
			Array.prototype.push.apply(seen, file.modules);
			file.requires.forEach(function(module) {
				// Ignore resoled modules and dependencies in own file
				if((_.indexOf(resolved, module) < 0) &&
				   (_.indexOf(file.modules, module) < 0)) {
					// Catch circular dependencies
					if(_.indexOf(seen, module) < 0) {
						resolve(module);
					}
					else {
						grunt.fail.fatal('Circular dependency detected:\n\t' +
						                 file.modules.join(', ') + ' depend on ' +
						                 module, 1);
					}
				}
			});
			Array.prototype.push.apply(resolved, file.modules);
		}
207012
def apply_dependencies(self):
        
        self.hosts.apply_dependencies()
        self.services.apply_dependencies(self.hosts)
393300
def consolidate_dependencies(needs_ipython, child_program,
                             requirement_files, manual_dependencies):
    """"""
    # We get the logger here because it's not defined at module level
    logger = logging.getLogger('fades')

    if needs_ipython:
        logger.debug("Adding ipython dependency because --ipython was detected")
        ipython_dep = parsing.parse_manual(['ipython'])
    else:
        ipython_dep = {}

    if child_program:
        srcfile_deps = parsing.parse_srcfile(child_program)
        logger.debug("Dependencies from source file: %s", srcfile_deps)
        docstring_deps = parsing.parse_docstring(child_program)
        logger.debug("Dependencies from docstrings: %s", docstring_deps)
    else:
        srcfile_deps = {}
        docstring_deps = {}

    all_dependencies = [ipython_dep, srcfile_deps, docstring_deps]

    if requirement_files is not None:
        for rf_path in requirement_files:
            rf_deps = parsing.parse_reqfile(rf_path)
            logger.debug('Dependencies from requirements file %r: %s', rf_path, rf_deps)
            all_dependencies.append(rf_deps)

    manual_deps = parsing.parse_manual(manual_dependencies)
    logger.debug("Dependencies from parameters: %s", manual_deps)
    all_dependencies.append(manual_deps)

    # Merge dependencies
    indicated_deps = {}
    for dep in all_dependencies:
        for repo, info in dep.items():
            indicated_deps.setdefault(repo, set()).update(info)

    return indicated_deps
319838
def _solve_features(self, model_name, dependency_cache=None):
        
        features = self[model_name].features
        return list(self.extractor.solve(features, cache=dependency_cache))
588620
public ModuleDeps resolveWith(Features features, boolean coerceUndefinedToFalse) {
		for (ModuleDepInfo info : values()) {
			info.resolveWith(features, coerceUndefinedToFalse);
		}
		return this;
	}
140222
function addFixes() {
        var match = fnPackage.name.match(/^build(\w+)Fix$/);
        if (match) {
          addSugarFix(match[1], fnPackage);
          fnPackage.dependencies.push(fnCallName);
          fnPackage.postAssigns = findVarAssignments(fnPackage.node.body.body, true);
        }
      }
737575
def resolve_dependencies(main, version)
      dependencies = @identifier.identify(main.source.fetch(version))
      artifact = @graph.artifact main.name, version

      dependencies.each do |dependency|
        dependency.constraints.each do |constraint|
          artifact.depends dependency.name, constraint
        end

        resolve_dependency dependency
      end

      nil
    end
1061656
def update_features(self, poly):
        """"""

        for feature in self.features:
            feature.wavelength = poly(feature.xpos)