Checks the caveat against all registered caveat conditions.
        :return: error message string if any or None
558361
def check_first_party_caveat(self, ctx, cav):
        ''' 
        '''
        try:
            cond, arg = parse_caveat(cav)
        except ValueError as ex:
            # If we can't parse it, perhaps it's in some other format,
            # return a not-recognised error.
            return 'cannot parse caveat "{}": {}'.format(cav, ex.args[0])
        checker = self._checkers.get(cond)
        if checker is None:
            return 'caveat "{}" not satisfied: caveat not recognized'.format(
                cav)
        err = checker.check(ctx, cond, arg)
        if err is not None:
            return 'caveat "{}" not satisfied: {}'.format(cav, err)
326762
def _new_caveat_id(self, base):
        '''
        '''
        id = bytearray()
        if len(base) > 0:
            id.extend(base)
        else:
            # Add a version byte to the caveat id. Technically
            # this is unnecessary as the caveat-decoding logic
            # that looks at versions should never see this id,
            # but if the caveat payload isn't provided with the
            # payload, having this version gives a strong indication
            # that the payload has been omitted so we can produce
            # a better error for the user.
            id.append(VERSION_3)

        # Iterate through integers looking for one that isn't already used,
        # starting from n so that if everyone is using this same algorithm,
        # we'll only perform one iteration.
        i = len(self._caveat_data)
        caveats = self._macaroon.caveats
        while True:
            # We append a varint to the end of the id and assume that
            # any client that's created the id that we're using as a base
            # is using similar conventions - in the worst case they might
            # end up with a duplicate third party caveat id and thus create
            # a macaroon that cannot be discharged.
            temp = id[:]
            encode_uvarint(i, temp)
            found = False
            for cav in caveats:
                if (cav.verification_key_id is not None
                        and cav.caveat_id == temp):
                    found = True
                    break
            if not found:
                return bytes(temp)
            i += 1
908200
def check_required(self):
        
        die = False
        for key, value in self.spec.items():
            if not getattr(self, key.upper()) and value['required']:
                print(f"{key} is a required setting. "
                      "Set via command-line params, env or file. "
                      "For examples, try '--generate' or '--help'.")
                die = True
        if die:
            sys.exit(1)
662313
def _string_check(self, value, allow_list=False):
        '''
        
        '''
        if self._optcre is self.OPTCRE or value:
            is_list = isinstance(value, list)
            if is_list and not allow_list:
                raise TypeError('option value cannot be a list unless allow_list is True')
            elif not is_list:
                value = [value]
            if not all(isinstance(x, six.string_types) for x in value):
                raise TypeError('option values must be strings')
729117
def _conditional_error(self, req, response):
        
        if not req or req.sent_headers:
            return

        try:
            req.simple_response(response)
        except errors.FatalSSLAlert:
            pass
        except errors.NoSSLError:
            self._handle_no_ssl(req)
641907
def isvalid(self):
        

        gcontents = [gf.rstrip('\n') for gf in self.repo.bake('ls-files')()]
        fcontents = os.listdir(self.repopath)
        return all([sf in gcontents for sf in std_files]) and all([sf in fcontents for sf in std_files])
1370437
def _caveat_v1_to_dict(c):
    ''' 
    '''
    serialized = {}
    if len(c.caveat_id) > 0:
        serialized['cid'] = c.caveat_id
    if c.verification_key_id:
        serialized['vid'] = utils.raw_urlsafe_b64encode(
            c.verification_key_id).decode('utf-8')
    if c.location:
        serialized['cl'] = c.location
    return serialized
335595
def check_prohibited_output(chars, bad_tables):
    
    violator = check_against_tables(chars, bad_tables)
    if violator is not None:
        raise ValueError("Input contains invalid unicode codepoint: "
                         "U+{:04x}".format(ord(violator)))
656564
def check_for_failed_condition(conds)
      failed = (conds || []).find { |c, v| !check_condition?(c, v) }
      if failed
        failed[0] = failed[0][0..-2].to_sym if failed[0][-1] == '!'
      end
      failed
    end
1248400
def _try_validate(cnf, schema, **options):
    
    valid = True
    if schema:
        (valid, msg) = validate(cnf, schema, **options)
        if msg:
            LOGGER.warning(msg)

    if valid:
        return cnf

    return None
569592
def CheckValue(self, proposed_value):
    
    if not isinstance(proposed_value, self._acceptable_types):
      message = ('%.1024r has type %s, but expected one of: %s' %
                 (proposed_value, type(proposed_value), self._acceptable_types))
      raise TypeError(message)
    return proposed_value
1076989
def _validate_arguments(self):
        
        if self._has_terms():
            [term._validate_arguments() for term in self._terms]
        return self
1307545
def check_for_errors(self):
        
        if not self.exceptions:
            if not self.is_closed:
                return
            why = AMQPConnectionError('connection was closed')
            self.exceptions.append(why)
        self.set_state(self.CLOSED)
        self.close()
        raise self.exceptions[0]
820633
def _check_defaults(self, x_only=True):
		
		if self.x is None:
			self.err(self._check_defaults,
					 "X field is not set: please specify a parameter")
			return
		if x_only is True:
			return
		if self.y is None:
			self.err(self._check_defaults,
					 "Y field is not set: please specify a parameter")
			return
190562
def _validate_options(cls, options):
        
        for opt1, opt2 in \
                itertools.permutations(cls.BASE_ERROR_SELECTION_OPTIONS, 2):
            if getattr(options, opt1) and getattr(options, opt2):
                log.error('Cannot pass both {} and {}. They are '
                          'mutually exclusive.'.format(opt1, opt2))
                return False

        if options.convention and options.convention not in conventions:
            log.error("Illegal convention '{}'. Possible conventions: {}"
                      .format(options.convention,
                              ', '.join(conventions.keys())))
            return False
        return True
1374183
def _check_required(self, value):
        '''
        
        '''
        if value is None and self._required:
            err_msg = self._errors['required'].format(self.__class__.__name__, self.name)
            if self.container_model:
                err_msg += self._errors['required_extra'].format(self.container_model.__name__)
            raise ValueError(err_msg)
719336
def verify(self, **kwargs):
        
        _spec = self.c_param
        try:
            _allowed = self.c_allowed_values
        except KeyError:
            _allowed = {}

        for (attribute, (typ, required, _, _, na)) in _spec.items():
            if attribute == "*":
                continue

            try:
                val = self._dict[attribute]
            except KeyError:
                if required:
                    raise MissingRequiredAttribute("%s" % attribute)
                continue
            else:
                if typ == bool:
                    pass
                elif not val:
                    if required:
                        raise MissingRequiredAttribute("%s" % attribute)
                    continue

            try:
                _allowed_val = _allowed[attribute]
            except KeyError:
                pass
            else:
                if not self._type_check(typ, _allowed_val, val, na):
                    raise NotAllowedValue(val)

        return True