a map of requirements to what requires it. ignored is an
        optional list of globbed patterns indicating packages,
        classes, etc that shouldn't be included in the provides map
558013
def get_requires(self, ignored=tuple()):
        

        if self._requires is None:
            self._collect_requires_provides()

        d = self._requires
        if ignored:
            d = dict((k, v) for k, v in d.items()
                     if not fnmatches(k, *ignored))
        return d
1103102
public void setExcludeList(List<String> ignoredRegexs) {
		if (ignoredRegexs == null || ignoredRegexs.isEmpty()) {
			excludeList = Collections.emptyList();
			return;
		}

		this.excludeList = ignoredRegexs;
	}
1058814
function(filePath) {
        var ignoredPaths;

        if (this.options.ignore) {
            ignoredPaths = new IgnoredPaths(this.options);
            return ignoredPaths.contains(filePath);
        }

        return false;
    }
619667
function getDirectRequires(p) {
      return p.dependencies.filter(function(d) {
        return DIRECT_REQUIRES_REG.test(d);
      }).map(function(d) {
        return "require('"+ getDependencyPath(d, p) +"');";
      }).join('\n');
    }
151416
def trace_requirements(requirements):
    
    requirements = tuple(pretty_req(r) for r in requirements)
    working_set = fresh_working_set()

    # breadth-first traversal:
    from collections import deque
    queue = deque(requirements)
    queued = {_package_req_to_pkg_resources_req(req.req) for req in queue}
    errors = []
    result = []
    while queue:
        req = queue.popleft()

        logger.debug('tracing: %s', req)
        try:
            dist = working_set.find_normalized(_package_req_to_pkg_resources_req(req.req))
        except pkg_resources.VersionConflict as conflict:
            dist = conflict.args[0]
            errors.append('Error: version conflict: {} ({}) <-> {}'.format(
                dist, timid_relpath(dist.location), req
            ))

        assert dist is not None, 'Should be unreachable in pip8+'
        result.append(dist_to_req(dist))

        # TODO: pip does no validation of extras. should we?
        extras = [extra for extra in req.extras if extra in dist.extras]
        for sub_req in sorted(dist.requires(extras=extras), key=lambda req: req.key):
            sub_req = InstallRequirement(sub_req, req)

            if req_cycle(sub_req):
                logger.warning('Circular dependency! %s', sub_req)
                continue
            elif sub_req.req in queued:
                logger.debug('already queued: %s', sub_req)
                continue
            else:
                logger.debug('adding sub-requirement %s', sub_req)
                queue.append(sub_req)
                queued.add(sub_req.req)

    if errors:
        raise InstallationError('\n'.join(errors))

    return result
288549
protected boolean checkExcludePackages(String classPackageName) {
		if (excludePackages != null && excludePackages.length > 0) {
			WildcardHelper wildcardHelper = new WildcardHelper();

			// we really don't care about the results, just the boolean
			Map<String, String> matchMap = new HashMap<String, String>();

			for (String packageExclude : excludePackages) {
				int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
				if (wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
					return false;
				}
			}
		}
		return true;
	}
838701
function(patterns) {
        var results = [],
            processed = {},
            options = this.options,
            fileCache = this._fileCache,
            ignoredPaths = new IgnoredPaths(options),
            globOptions,
            stats,
            startTime,
            prevConfig; // the previous configuration used

        startTime = Date.now();

        globOptions = {
            nodir: true
        };

        var cwd = options.cwd || process.cwd;
        patterns = this.resolveFileGlobPatterns(patterns.map(function(pattern) {
            if (pattern.indexOf("/") > 0) {
                return path.join(cwd, pattern);
            }
            return pattern;
        }));


        /**
         * Executes the linter on a file defined by the `filename`. Skips
         * unsupported file extensions and any files that are already linted.
         * @param {string} filename The resolved filename of the file to be linted
         * @param {boolean} warnIgnored always warn when a file is ignored
         * @returns {void}
         */
        function executeOnFile(filename, warnIgnored) {
            var hashOfConfig;

            if (options.ignore !== false) {

                if (ignoredPaths.contains(filename, "custom")) {
                    if (warnIgnored) {
                        results.push(createIgnoreResult(filename));
                    }
                    return;
                }

                if (ignoredPaths.contains(filename, "default")) {
                    return;
                }

            }

            filename = path.resolve(filename);
            if (processed[filename]) {
                return;
            }

            if (options.cache) {
                // get the descriptor for this file
                // with the metadata and the flag that determines if
                // the file has changed
                var descriptor = fileCache.getFileDescriptor(filename);
                var meta = descriptor.meta || {};

                var changed = descriptor.changed;
                if (!changed) {
                    debug("Skipping file since hasn't changed: " + filename);

                    // Adding the filename to the processed hashmap
                    // so the reporting is not affected (showing a warning about .bemlintignore being used
                    // when it is not really used)

                    processed[filename] = true;

                    // Add the the cached results (always will be 0 error and 0 warnings)
                    // cause we don't save to cache files that failed
                    // to guarantee that next execution will process those files as well
                    results.push(descriptor.meta.results);

                    // move to the next file
                    return;
                }
            }

            debug("Processing " + filename);

            processed[filename] = true;

            var res = processFile(filename, options);

            if (options.cache) {
                // if a file contains errors or warnings we don't want to
                // store the file in the cache so we can guarantee that
                // next execution will also operate on this file
                if ( res.errorCount > 0 || res.warningCount > 0 ) {
                    debug("File has problems, skipping it: " + filename);
                    // remove the entry from the cache
                    fileCache.removeEntry( filename );
                } else {
                    // since the file passed we store the result here
                    // TODO: check this as we might not need to store the
                    // successful runs as it will always should be 0 error 0 warnings
                    descriptor.meta.results = res;
                }
            }

            results.push(res);
        }

        patterns.forEach(function(pattern) {

            var file = path.resolve(pattern);

            if (shell.test("-f", file)) {
                executeOnFile(fs.realpathSync(pattern), !shell.test("-d", file));
            } else {
                glob.sync(pattern, globOptions).forEach(function(globMatch) {
                    executeOnFile(globMatch, false);
                });
            }

        });

        stats = calculateStatsPerRun(results);

        if (options.cache) {
            // persist the cache to disk
            fileCache.reconcile();
        }

        debug("Linting complete in: " + (Date.now() - startTime) + "ms");

        return {
            results: results,
            errorCount: stats.errorCount,
            warningCount: stats.warningCount
        };
    }
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;
    }
545554
private void checkIncludePatterns() {
        Map newroots = new HashMap();
        // put in the newroots map the include patterns without
        // wildcard tokens
        for (int i = 0; i < includes.length; i++) {
            if (FileUtil.isAbsolutePath(includes[i])) {
                //skip abs. paths not under basedir, if set:
                if (basedir != null
                    && !SelectorUtils.matchPatternStart(includes[i],
                    basedir.getAbsolutePath(), isCaseSensitive())) {
                    continue;
                }
            } else if (basedir == null) {
                //skip non-abs. paths if basedir == null:
                continue;
            }
            newroots.put(SelectorUtils.rtrimWildcardTokens(
                includes[i]), includes[i]);
        }
        if (newroots.containsKey("") && basedir != null) {
            // we are going to scan everything anyway
            scandir(basedir, "", true);
        } else {
            // only scan directories that can include matched files or
            // directories
            Iterator it = newroots.entrySet().iterator();

            File canonBase = null;
            if (basedir != null) {
                try {
                    canonBase = basedir.getCanonicalFile();
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            }
            while (it.hasNext()) {
                Map.Entry entry = (Map.Entry) it.next();
                String currentelement = (String) entry.getKey();

                if (basedir == null && !FileUtil.isAbsolutePath(currentelement)) {
                    continue;
                }
                String originalpattern = (String) entry.getValue();
                File myfile = new File(basedir, currentelement);

                if (myfile.exists()) {
                    // may be on a case insensitive file system.  We want
                    // the results to show what's really on the disk, so
                    // we need to double check.
                    try {
                        String path = (basedir == null)
                            ? myfile.getCanonicalPath()
                            : FileUtil.removeLeadingPath(canonBase,
                            myfile.getCanonicalFile());
                        if (!path.equals(currentelement)) {
                            myfile = findFile(basedir, currentelement, true);
                            if (myfile != null && basedir != null) {
                                currentelement = FileUtil.removeLeadingPath(
                                    basedir, myfile);
                            }
                        }
                    } catch (IOException ex) {
                        throw new RuntimeException(ex);
                    }
                }
                if ((myfile == null || !myfile.exists()) && !isCaseSensitive()) {
                    File f = findFile(basedir, currentelement, false);
                    if (f != null && f.exists()) {
                        // adapt currentelement to the case we've
                        // actually found
                        currentelement = (basedir == null)
                            ? f.getAbsolutePath()
                            : FileUtil.removeLeadingPath(basedir, f);
                        myfile = f;
                    }
                }
                if (myfile != null && myfile.exists()) {
                    if (!followSymlinks
                        && isSymlink(basedir, currentelement)) {
                        continue;
                    }
                    if (myfile.isDirectory()) {
                        if (isIncluded(currentelement)
                            && currentelement.length() > 0) {
                            accountForIncludedDir(currentelement, myfile, true);
                        }  else {
                            if (currentelement.length() > 0) {
                                if (currentelement.charAt(currentelement
                                                          .length() - 1)
                                    != File.separatorChar) {
                                    currentelement =
                                        currentelement + File.separatorChar;
                                }
                            }
                            scandir(myfile, currentelement, true);
                        }
                    } else {
                        boolean included = isCaseSensitive()
                            ? originalpattern.equals(currentelement)
                            : originalpattern.equalsIgnoreCase(currentelement);
                        if (included) {
                            accountForIncludedFile(currentelement, myfile);
                        }
                    }
                }
            }
        }
    }
1182937
public static boolean artifactIsNotExcluded(Collection<Exclusion> exclusions, Artifact artifact) {
        return Optional.ofNullable(exclusions).orElse(Collections.emptyList())
                .stream().noneMatch(selectedExclusion ->
                        null != artifact && selectedExclusion.getGroupId().equals(artifact.getGroupId()) &&
                                (selectedExclusion.getArtifactId().equals(artifact.getArtifactId()) || (selectedExclusion.getArtifactId().equals(ARTIFACT_STAR)))
                );
    }
747982
def check_requirements(self, reqs):
        # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]
        
        missing = set()
        conflicting = set()
        if reqs:
            ws = WorkingSet(self._lib_dirs)
            for req in reqs:
                try:
                    if ws.find(Requirement.parse(req)) is None:
                        missing.add(req)
                except VersionConflict as e:
                    conflicting.add((str(e.args[0].as_requirement()),
                                     str(e.args[1])))
        return conflicting, missing
1361596
def resolve(
    requirements: typing.List[str],
    index_urls: list = None,
    python_version: int = 3,
    exclude_packages: set = None,
    transitive: bool = True,
    subgraph_check_api: str = None,
) -> dict:
    """"""
    assert python_version in (2, 3), "Unknown Python version"

    if subgraph_check_api and not transitive:
        _LOGGER.error("The check against subgraph API cannot be done if no transitive dependencies are resolved")
        sys.exit(2)

    python_bin = "python3" if python_version == 3 else "python2"
    run_command("virtualenv -p python3 venv")
    python_bin = "venv/bin/" + python_bin

    run_command("{} -m pip install pipdeptree".format(python_bin))
    environment_details = _get_environment_details(python_bin)

    result = {"tree": [], "errors": [], "unparsed": [], "unresolved": [], "environment": environment_details}

    all_solvers = []
    for index_url in index_urls:
        source = Source(index_url)
        all_solvers.append(PythonSolver(fetcher_kwargs={"source": source}))

    for solver in all_solvers:
        solver_result = _do_resolve_index(
            python_bin=python_bin,
            solver=solver,
            all_solvers=all_solvers,
            requirements=requirements,
            exclude_packages=exclude_packages,
            transitive=transitive,
            subgraph_check_api=subgraph_check_api,
        )

        result["tree"].extend(solver_result["tree"])
        result["errors"].extend(solver_result["errors"])
        result["unparsed"].extend(solver_result["unparsed"])
        result["unresolved"].extend(solver_result["unresolved"])

    return result
420228
def requires(self, extras=()):
        """"""
        dm = self._dep_map
        deps = []
        deps.extend(dm.get(None, ()))
        for ext in extras:
            try:
                deps.extend(dm[safe_extra(ext)])
            except KeyError:
                raise UnknownExtra(
                    "%s has no such extra feature %r" % (self, ext)
                )
        return deps
938052
def trace_dependencies(req, requirement_set, dependencies, _visited=None):
    
    _visited = _visited or set()
    if req in _visited:
        return
    _visited.add(req)
    for reqName in req.requirements():
        try:
            name = pkg_resources.Requirement.parse(reqName).project_name
        except ValueError, e:
            logger.error('Invalid requirement: %r (%s) in requirement %s' % (
                reqName, e, req))
            continue
        subreq = requirement_set.get_requirement(name)
        dependencies.append((req, subreq))
        trace_dependencies(subreq, requirement_set, dependencies, _visited)
803926
@SuppressWarnings("unchecked")
  private Set<String> extractIgnorePatterns(Map<String, Object> configuration) {
    List<String> patterns = asList("glob:.*",// hidden files
        "glob:*~", "glob:#*#", "glob:.#*", // emacs
        "glob:*~", "glob:[._]*.s[a-w][a-z]", "glob:[._]s[a-w][a-z]", "glob:*.un~" // vim
    );
    Set<String> s = new HashSet<>((List<String>) configuration.getOrDefault("ignore-patterns",patterns));
    s.addAll(patterns);
    return unmodifiableSet(s);
  }
140031
function getValidVulnerabilities(productRange, details, pkg, depPaths) {
        var results = [];
        if(details != undefined) {
                for(var i = 0; i < details.length; i++) {
                        var detail = details[i];
                        detail.depPaths = depPaths;

                  		// Do we white-list this match?
                        var id = detail.id;
                        if (whitelist && whitelist[id]) {
                            var whitelistEntry = whitelist[id];
                            if (whitelistEntry.dependencyPaths) {
                              for (var whitelistIdx = 0; whitelistIdx < whitelistEntry.dependencyPaths.length; whitelistIdx++) {
                                var wDep = whitelistEntry.dependencyPaths[whitelistIdx];
                                var regex = new RegExp(wDep);
                                detail.depPaths = detail.depPaths.filter(function(dDep) {
                                  if (regex.test(dDep)){
                                    detail.whitelistedPaths = detail.whitelistedPaths || [];
                                    detail.whitelistedPaths.push(dDep);
                                    return false;
                                  }

                                  return true;
                                });
                              }

                              detail["package"] = pkg;
                              whitelistedVulnerabilities.push(detail);
                              if (detail.depPaths.length == 0) {
                                console.log('SKIPPING BECAUSE ALL PATHS MATCHED')
                              }
                            } else {
                              detail["package"] = pkg;
                              whitelistedVulnerabilities.push(detail);
                            }
                        }
                        else {
                          results.push(detail);
                        }
                }
        }
        return results;
}
1088258
function getIncludes(ext, exclude) {
    var globs = [];

    modules.forEach(function (module) {

      if (!settings.release) {

        // Not in release mode:
        // Ensure the main module file is included first

        globs.push(module.folder + '/' + module.folder + ext);
        globs.push(module.folder + '/**/*' + ext);
      } else {

        // In release mode:
        // Include the minified version.

        globs.push(module.folder + '/' + module.folder + '.min' + ext);
      }

    });

    var res = gulp.src(globs, {
      read: false,
      cwd: path.resolve(settings.folders.dest)
    });

    if (exclude) {
      res = res.pipe(gfilter('!**/*' + exclude));
//      res = res.pipe(utils.dumpFilePaths());
    }

    return res;
  }