Returns true if the pom has the given dependency
480923
public static boolean hasDependency(Model pom, String groupId, String artifactId) {
        if (pom != null) {
            List<org.apache.maven.model.Dependency> dependencies = pom.getDependencies();
            return hasDependency(dependencies, groupId, artifactId);
        }
        return false;
    }
1013973
private Object find(String name) {
		if (name == null)
			throw new NullPointerException("Dependency name cannot be null");
		if (_references == null)
			throw new NullPointerException("References shall be set");

		return _dependencies.get(name);
	}
650705
function () {
      var compoundComponents = doc.artifacts.compoundComponents;
      if (!compoundComponents) {
        return;
      }
      function checkMemberHasDependency (compound) {
        function findDep (dependencies, artifactId) {
          if (!dependencies || !artifactId) {
            return;
          }
          return dependencies.filter(function (dep) {
            return dep.artifactId === artifactId;
          });
        }

        function checkDependencyForMember (member) {
          // for model version 9 and higher no endpoint
          var foundedArray = findDep(compound.dependencies, member.artifactId);
          if (foundedArray && foundedArray.length === 0) {
            errors.push('RuleViolation identified: Member of "' + compound.artifactId + '" with memberId "' + member.memberId +
              '" and artifactId "' + member.artifactId + '" has no corresponding dependency');
          }
        }

        var members = compound.members;
        members.forEach(function (member) {
          checkDependencyForMember(member);
        });
      }

      compoundComponents.forEach(function (compoundComponent) {
        checkMemberHasDependency(compoundComponent);
      });
    }
734210
def CheckDependencies(verbose_output=True):
  
  print('Checking availability and versions of dependencies.')
  check_result = True

  for module_name, version_tuple in sorted(PYTHON_DEPENDENCIES.items()):
    if not _CheckPythonModule(
        module_name, version_tuple[0], version_tuple[1],
        is_required=version_tuple[3], maximum_version=version_tuple[2],
        verbose_output=verbose_output):
      check_result = False

  if not _CheckSQLite3(verbose_output=verbose_output):
    check_result = False

  if check_result and not verbose_output:
    print('[OK]')

  print('')
  return check_result
322176
def has_resolved_dependencies(self):
        """"""
        for dependency in self.dependencies:
            if dependency.state != Task.State.DONE:
                return False

        return True
405855
@Override
    public boolean accepts(Dependency d) {
        if (d.getOrigin().equals(d.getTarget()))
            return false;

        // filter same package dependency
        String pn = d.getTarget().getPackageName();
        if (filterSamePackage && d.getOrigin().getPackageName().equals(pn)) {
            return false;
        }

        // filter if the target package matches the given filter
        if (filterPattern != null && filterPattern.matcher(pn).matches()) {
            return false;
        }

        // filter if the target matches the given filtered package name or regex
        return filter != null ? filter.accepts(d) : true;
    }
1113597
public boolean dependsOn(DependencyNode dependency) {
        boolean dependsDirectly = dependenciesVia.contains(dependency);
        if (dependsDirectly)
            return true;
        for (DependencyNode reqDependency : dependency.dependantsVia) {
            if (dependsOn(reqDependency))
                return true;
        }
        return false;
    }
1081795
public boolean isModified()
  {
    for (int i = _dependencyList.size() - 1; i >= 0; i--) {
      Dependency dependency = _dependencyList.get(i);

      if (dependency.isModified()) {
        return true;
      }
    }

    return false;
  }
875143
@Override
    protected boolean evaluateDependencies(final Dependency dependency, final Dependency nextDependency, final Set<Dependency> dependenciesToRemove) {
        if (hashesMatch(dependency, nextDependency)) {
            if (!containedInWar(dependency.getFilePath())
                    && !containedInWar(nextDependency.getFilePath())) {
                if (firstPathIsShortest(dependency.getFilePath(), nextDependency.getFilePath())) {
                    mergeDependencies(dependency, nextDependency, dependenciesToRemove);
                } else {
                    mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                    return true; //since we merged into the next dependency - skip forward to the next in mainIterator
                }
            }
        } else if (isShadedJar(dependency, nextDependency)) {
            if (dependency.getFileName().toLowerCase().endsWith("pom.xml")) {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                nextDependency.removeRelatedDependencies(dependency);
                return true;
            } else {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
                dependency.removeRelatedDependencies(nextDependency);
            }
        } else if (cpeIdentifiersMatch(dependency, nextDependency)
                && hasSameBasePath(dependency, nextDependency)
                && vulnerabilitiesMatch(dependency, nextDependency)
                && fileNameMatch(dependency, nextDependency)) {
            if (isCore(dependency, nextDependency)) {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true; //since we merged into the next dependency - skip forward to the next in mainIterator
            }
        } else if (ecoSystemIs(AbstractNpmAnalyzer.NPM_DEPENDENCY_ECOSYSTEM, dependency, nextDependency)
                && namesAreEqual(dependency, nextDependency)
                && npmVersionsMatch(dependency.getVersion(), nextDependency.getVersion())) {

            if (!dependency.isVirtual()) {
                DependencyMergingAnalyzer.mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                DependencyMergingAnalyzer.mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true;
            }
        }
        return false;
    }
805672
private boolean isDependent(String style) {
		if (!style.trim().startsWith("<")) {
			return false;
		}
		Pattern p = Pattern.compile("rel\\s*=\\s*\"\\s*independent-parent\\s*\"");
		Matcher m = p.matcher(style);
		return m.find();
	}
905511
function checkDependencies(req, res) {
                    var modelName = req.params.modelName,
                        id = req.params.documentId,
                        models = _.pluck(registry.models, 'model');

                    dependencies.check(models, modelName, id, function (err, depPair) {
                        if (err) throw err;
                        if (_.isEmpty(depPair)) return res.json(200, []);
                        var deps = depPair[1];
                        var lines = dependencies.depsToLines(deps);
                        return res.json(200, lines);
                    });
                }
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))
369092
public function hasDependencies()
    {
        foreach ($this->dependencies as $key) {
            if (isset($this->config[$key]) && $this->config[$key]) {
                return true;
            }
        }

        return false;
    }
345420
function hasPlugin(deps, pluginName, version) {
    return !!deps.find(function(dep) {
        return dep.getName() === pluginName && (!version || dep.getVersion() === version);
    });
}
196461
public void addDependency(org.apache.maven.model.Dependency projectDependency) {
        log.debug( "Adding dependency: {}", projectDependency );
        
        DefaultArtifact artifact = null;
        
        if ( Const.TEST.equals( projectDependency.getType() ) || Const.TEST_JAR.equals( projectDependency.getType() ) ) {
            
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion(), artifactType );
        } else {
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion() );
        }
        
        Dependency dependency = new Dependency( artifact , projectDependency.getScope());
        dependency.setOptional( projectDependency.isOptional() );
        
        List<Exclusion> exclusions = new ArrayList<Exclusion>();
        for ( org.apache.maven.model.Exclusion projectExclusion : projectDependency.getExclusions() ) {
            exclusions.add( new Exclusion(projectExclusion.getGroupId(), projectExclusion.getArtifactId(), "*", "*") );            
        }
        log.debug( "Exclusion: {}", exclusions );
        dependency = dependency.setExclusions( exclusions );
        
        dependencies.add( dependency );
    }
1298253
public boolean isPresolved() {
        // Check if the tool has added unsolved dependencies to this instance that need further resolution.
        boolean unsolvedDependenciesExist = getDirectDeps().stream().anyMatch(d -> !getTransientDeps(d).isEmpty());
        return !unsolvedDependenciesExist;
    }
1176447
def can_be_updated(cls, dist, latest_version):
        """"""
        scheme = get_scheme('default')
        name = dist.project_name
        dependants = cls.get_dependants(name)
        for dependant in dependants:
            requires = dependant.requires()
            for requirement in cls.get_requirement(name, requires):
                req = parse_requirement(requirement)
                # Ignore error if version in requirement spec can't be parsed
                try:
                    matcher = scheme.matcher(req.requirement)
                except UnsupportedVersionError:
                    continue
                if not matcher.match(str(latest_version)):
                    return False

        return True