Perform integrity checks on the modes in this document.

        Returns:
            None
974365
def validate(self):
        ''' 

        '''
        for r in self.roots:
            refs = r.references()
            check_integrity(refs)
1146038
def validated(self, *args, **kwargs):
        
        always_return_document = kwargs.pop('always_return_document', False)
        self.validate(*args, **kwargs)
        if self._errors and not always_return_document:
            return None
        else:
            return self.document
881392
def finalize_integrity(self):
        # type: (Descriptor) -> None
        
        with self._meta_lock:
            if self._finalized:
                return
        # check final file integrity
        check = False
        msg = None
        if self.hmac is not None:
            mac = self._ase.encryption_metadata.encryption_authentication.\
                message_authentication_code
            digest = blobxfer.util.base64_encode_as_string(self.hmac.digest())
            if digest == mac:
                check = True
            msg = '{}: {}, {} {} <L..R> {}'.format(
                self._ase.encryption_metadata.encryption_authentication.
                algorithm,
                'OK' if check else 'MISMATCH',
                self._ase.path,
                digest,
                mac,
            )
        elif self.md5 is not None:
            digest = blobxfer.util.base64_encode_as_string(self.md5.digest())
            if digest == self._ase.md5:
                check = True
            msg = 'MD5: {}, {} {} <L..R> {}'.format(
                'OK' if check else 'MISMATCH',
                self._ase.path,
                digest,
                self._ase.md5,
            )
        else:
            check = True
            msg = 'MD5: SKIPPED, {} None <L..R> {}'.format(
                self._ase.path,
                self._ase.md5
            )
        # cleanup if download failed
        if not check:
            self._integrity_failed = True
            logger.error(msg)
        else:
            logger.info(msg)
11890
def check(object, mode = @mode)
      checked = {}
      result = true
      errors = CheckFailed.new
      each do |message|
        begin
          message.check(object, checked)
        rescue CheckError => e
          case mode
          when :error
            errors << e
          when :warning
            warn e.to_s
            result = false
          when :none
            result = false
          end
        end
      end
      raise errors unless errors.empty?
      result
    end
1330233
def _validate(self):
        
        # disable methods matching before validation
        self._disable_patching = True
        # validation by Invariant.validate
        self._validate_base(self)
        # enable methods matching after validation
        self._disable_patching = False
1155485
def validate_integrity(self):
        
        self._validate_columns(self._columns)
        self._validate_index(self._index)
        self._validate_data()
631893
def lchmod(self, mode):
        
        if self._closed:
            self._raise_closed()
        self._accessor.lchmod(self, mode)
557372
def all(cls, otp=False, ccid=False, u2f=False):
        """"""
        modes = set([
            cls.OTP,
            cls.CCID,
            cls.OTP_CCID,
            cls.U2F,
            cls.OTP_U2F,
            cls.U2F_CCID,
            cls.OTP_U2F_CCID
        ])

        if otp:
            modes.difference_update(set([
                cls.CCID,
                cls.U2F,
                cls.U2F_CCID
            ]))

        if ccid:
            modes.difference_update(set([
                cls.OTP,
                cls.U2F,
                cls.OTP_U2F
            ]))

        if u2f:
            modes.difference_update(set([
                cls.OTP,
                cls.CCID,
                cls.OTP_CCID
            ]))

        return modes
74452
def ensure_permissions(mode_flags=stat.S_IWUSR):
    

    def decorator(f):
        def modify(filename, *args, **kwargs):
            m = chmod_perms(filename) if exists(filename) else mode_flags
            if not m & mode_flags:
                os.chmod(filename, m | mode_flags)
            try:
                return f(filename, *args, **kwargs)
            finally:
                # restore original permissions
                if not m & mode_flags:
                    os.chmod(filename, m)
        return modify

    return decorator
484442
def check_config_mode(self, check_string=")#", pattern="#"):
        """"""
        return super(CiscoNxosSSH, self).check_config_mode(
            check_string=check_string, pattern=pattern
        )
196003
def _raise_on_mode(self, mode):
        
        valid_modes = [
            'random_sample',
            'random_sample_per_pix',
            'samples',
            'median',
            'mean',
            'best',
            'percentile']

        if mode not in valid_modes:
            raise ValueError(
                '"{}" is not a valid `mode`. Valid modes are:\n'
                '  {}'.format(mode, valid_modes)
            )
509033
def _check_loop(self, obj, check_mod_str):
        ''''''
        check_module = self._check_modules[check_mod_str]
        checks = self._config['checks'][check_mod_str]
        result = True
        summary = OrderedDict()
        for check in checks:
            ok = self._do_check(obj, check_module, check)
            summary[ok.title] = ok.status
            result &= ok.status

        return result, summary
50235
def validate(self):
        
        # it is important to have the validator applied in a fixed order
        valids = [getattr(self, valid)
                  for valid in sorted(dir(self.__class__))
                  if valid.startswith('is_valid_')]
        for is_valid in valids:
            if not is_valid():
                docstring = '\n'.join(
                    line.strip() for line in is_valid.__doc__.splitlines())
                doc = docstring.format(**vars(self))
                raise ValueError(doc)
425834
def _verify_options(options):
    '''
    
    '''

    # sanity check all vals used for bitwise operations later
    bitwise_args = [('level', options['level']),
                    ('facility', options['facility'])
                    ]
    bitwise_args.extend([('option', x) for x in options['options']])

    for opt_name, opt in bitwise_args:
        if not hasattr(syslog, opt):
            log.error('syslog has no attribute %s', opt)
            return False
        if not isinstance(getattr(syslog, opt), int):
            log.error('%s is not a valid syslog %s', opt, opt_name)
            return False

    # Sanity check tag
    if 'tag' in options:
        if not isinstance(options['tag'], six.string_types):
            log.error('tag must be a string')
            return False
        if len(options['tag']) > 32:
            log.error('tag size is limited to 32 characters')
            return False

    return True
818857
def clear_mode(self, mode, value=None):
        
        try:
            if mode in self.user_modes:
                del self.mode_users[mode][value]
            else:
                del self.modes[mode]
        except KeyError:
            pass
342950
def _check(self):
        
        if conf.contribs['LLDP'].strict_mode() and self._length != 2:
            raise LLDPInvalidLengthField('length must be 2 - got '
                                         '{}'.format(self._length))
395573
def _validate(self):
        
        if self.strictness == 'off':
            return self.report
        handle_inconsistencies(self.page, self.strictness, self.strategy, self.report)
        return self.report