Checks that a basis set family exists and if not, raises a helpful exception
491544
def _cli_check_family(family, data_dir):
    ''''''

    if family is None:
        return None

    family = family.lower()
    if not family in api.get_families(data_dir):
        errstr = "Basis set family '" + family + "' does not exist.\n"
        errstr += "For a complete list of families, use the 'bse list-families' command"
        raise RuntimeError(errstr)

    return family
646547
def _check_list_props(self, inst: "InstanceNode") -> None:
        """"""
        if self.keys:
            self._check_keys(inst)
        for u in self.unique:
            self._check_unique(u, inst)
1304385
def _sanity_check_query_root_block(ir_blocks):
    """"""
    if not isinstance(ir_blocks[0], QueryRoot):
        raise AssertionError(u'The first block was not QueryRoot: {}'.format(ir_blocks))
    for block in ir_blocks[1:]:
        if isinstance(block, QueryRoot):
            raise AssertionError(u'Found QueryRoot after the first block: {}'.format(ir_blocks))
99446
function checkIfUniversalAndReturnUniversal(setA) {
	return set.isEqual(setA, set.UNIVERSAL) ? set.UNIVERSAL : setA;
}
1083583
def system(self):
        """"""
        if self._base == 2:
            return "NIST"
        elif self._base == 10:
            return "SI"
        else:
            # I don't expect to ever encounter this logic branch, but
            # hey, it's better to have extra test coverage than
            # insufficient test coverage.
            raise ValueError("Instances mathematical base is an unsupported value: %s" % (
                str(self._base)))
552087
private boolean isEssential(final Cycle candidate, final Collection<Cycle> relevant) {

        // construct an alternative basis with all equal weight relevant cycles
        final List<Cycle> alternate = new ArrayList<Cycle>(relevant.size() + basis.size());

        final int weight = candidate.length();
        for (final Cycle cycle : basis.members()) {
            if (cycle.length() < weight) alternate.add(cycle);
        }
        for (final Cycle cycle : relevant) {
            if (!cycle.equals(candidate)) alternate.add(cycle);
        }

        // if the alternate basis is smaller, the candidate is essential
        return BitMatrix.from(alternate).eliminate() < basis.size();
    }
989000
public static <T> void checkAreDescendentsOf(Set<T> inputSet, T root, Deps<T> deps) {
        // Check that all modules in the input set are descendents of the output module.
        HashSet<T> visited = new HashSet<T>();
        dfs(root, visited, deps);
        if (!visited.containsAll(inputSet)) {
            throw new IllegalStateException("Input set contains modules which are not descendents of the output module: " + inputSet);
        }
    }
15534
def _TemplateExists(unused_value, context, args):
    """"""
    try:
        name = args[0]
    except IndexError:
        raise EvaluationError('The "template" predicate requires an argument.')
    return context.HasTemplate(name)
1073558
def is_subset(reference_set  # type: Set
              ):
    
    def is_subset_of(x):
        missing = x - reference_set
        if len(missing) == 0:
            return True
        else:
            # raise Failure('is_subset: len(x - reference_set) == 0 does not hold for x=' + str(x)
            #                   + ' and reference_set=' + str(reference_set) + '. x contains unsupported '
            #                      'elements ' + str(missing))
            raise NotSubset(wrong_value=x, reference_set=reference_set, unsupported=missing)

    is_subset_of.__name__ = 'is_subset_of_{}'.format(reference_set)
    return is_subset_of
40976
private void verifyMutuallyExclusive(Collection<Host> A, Collection<Host> B) {
		
		Set<Host> left = new HashSet<Host>(A);
		Set<Host> right = new HashSet<Host>(B);
		
		boolean modified = left.removeAll(right);
		if (modified) {
			throw new RuntimeException("Host up and down sets are not mutually exclusive!");
		}
	}
65494
def set_absent(name, family='ipv4', **kwargs):
    '''
    
    '''

    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    set_check = __salt__['ipset.check_set'](name, family)
    if not set_check:
        ret['result'] = True
        ret['comment'] = ('ipset set {0} for {1} is already absent'
                          .format(name, family))
        return ret
    if __opts__['test']:
        ret['comment'] = 'ipset set {0} for {1} would be removed'.format(
            name,
            family)
        return ret
    flush_set = __salt__['ipset.flush'](name, family)
    if flush_set:
        command = __salt__['ipset.delete_set'](name, family)
        if command is True:
            ret['changes'] = {'locale': name}
            ret['result'] = True
            ret['comment'] = ('ipset set {0} deleted successfully for family {1}'
                              .format(name, family))
        else:
            ret['result'] = False
            ret['comment'] = ('Failed to delete set {0} for {2}: {1}'
                              .format(name, command.strip(), family))
    else:
        ret['result'] = False
        ret['comment'] = 'Failed to flush set {0} for {2}: {1}'.format(
            name,
            flush_set.strip(),
            family
        )
    return ret
566816
def is_derived_from(self, identity: QualName, base: QualName) -> bool:
        """"""
        try:
            bases = self.identity_adjs[identity].bases
        except KeyError:
            return False
        if base in bases:
            return True
        for ib in bases:
            if self.is_derived_from(ib, base):
                return True
        return False
1031864
def sets_are_rooted_compat(one_set, other):
    
    if one_set.issubset(other) or other.issubset(one_set):
        return True
    return not intersection_not_empty(one_set, other)
807019
def is_set(self):
        
        if self.__event.is_set():
            if self.exception is not None:
                # todo better way to raise errors on behalf of other Threads?
                raise self.exception  # pylint: disable=raising-bad-type
            return True
        return False
1069377
private void validateRelationship(String baseTableName,
			String relatedTableName, String relationName) {

		// Verify the base and related tables exist
		if (!geoPackage.isTable(baseTableName)) {
			throw new GeoPackageException(
					"Base Relationship table does not exist: " + baseTableName
							+ ", Relation: " + relationName);
		}
		if (!geoPackage.isTable(relatedTableName)) {
			throw new GeoPackageException(
					"Related Relationship table does not exist: "
							+ relatedTableName + ", Relation: " + relationName);
		}

		// Verify spec defined relation types
		RelationType relationType = RelationType.fromName(relationName);
		if (relationType != null) {
			validateRelationship(baseTableName, relatedTableName, relationType);
		}

	}
122607
def verify(self, parents=set()):
        
        assert(isinstance(self.s_center, set))

        bal = self.balance
        assert abs(bal) < 2, \
            "Error: Rotation should have happened, but didn't! \n{}".format(
                self.print_structure(tostring=True)
            )
        self.refresh_balance()
        assert bal == self.balance, \
            "Error: self.balance not set correctly! \n{}".format(
                self.print_structure(tostring=True)
            )

        assert self.s_center, \
            "Error: s_center is empty! \n{}".format(
                self.print_structure(tostring=True)
            )
        for iv in self.s_center:
            assert hasattr(iv, 'begin')
            assert hasattr(iv, 'end')
            assert iv.begin < iv.end
            assert iv.overlaps(self.x_center)
            for parent in sorted(parents):
                assert not iv.contains_point(parent), \
                    "Error: Overlaps ancestor ({})! \n{}\n\n{}".format(
                        parent, iv, self.print_structure(tostring=True)
                    )
        if self[0]:
            assert self[0].x_center < self.x_center, \
                "Error: Out-of-order left child! {}".format(self.x_center)
            self[0].verify(parents.union([self.x_center]))
        if self[1]:
            assert self[1].x_center > self.x_center, \
                "Error: Out-of-order right child! {}".format(self.x_center)
            self[1].verify(parents.union([self.x_center]))
4001
protected static void checkSameExecutionContext(DataSet<?> set1, DataSet<?> set2) {
		if (set1.context != set2.context) {
			throw new IllegalArgumentException("The two inputs have different execution contexts.");
		}
	}