Check code with Radon.

        :return list: List of errors.
321560
def run(path, code=None, params=None, ignore=None, select=None, **meta):
        
        complexity = params.get('complexity', 10)
        no_assert = params.get('no_assert', False)
        show_closures = params.get('show_closures', False)

        visitor = ComplexityVisitor.from_code(code, no_assert=no_assert)
        blocks = visitor.blocks
        if show_closures:
            blocks = add_inner_blocks(blocks)

        return [
            {'lnum': block.lineno, 'col': block.col_offset, 'type': 'R', 'number': 'R709',
             'text': 'R701: %s is too complex %d' % (block.name, block.complexity)}
            for block in visitor.blocks if block.complexity > complexity
        ]
703656
def check_ramp_for_errors(ramp_data):
    """"""
    error_list = []
    keyframe_list = ramps.KeyFrameList(ramp_data['keyframes'])
    sorted_key_list = keyframe_list.sorted_key_list()
    channel_list = [ramps.Channel(ch_name, ramp_data['channels'][ch_name],
                                  keyframe_list)
                    for ch_name in ramp_data['channels']]
    sorted_absolute_times = [keyframe_list.get_absolute_time(sk) for sk
                             in sorted_key_list]
    ramp_properties = ramp_data['properties']
    jump_resolution = ramp_properties['jump_resolution']
    for key_name, abs_time in zip(sorted_key_list, sorted_absolute_times):
        # check if all times are +ve
        if abs_time < 0.0:
            error_fmt = "keyframe \'{0}\' has negative absolute time {1}"
            error_str = error_fmt.format(key_name, abs_time)
            error_list.append(error_str)

        # check if all times are a multiple of minimum resolution
        steps_float = abs_time / jump_resolution
        steps_residue = steps_float - round(steps_float)
        if steps_residue > 0.0001:
            error_fmt = ("keyframe \'{0}\' has absolute time {1} which is not"
                         " a multiple of jump_resolution {2}")
            error_str = error_fmt.format(key_name, abs_time, jump_resolution)
            error_list.append(error_str)

    # find missing channels
    ch_ids = digital_channel_ids()
    ch_ids += dev2_analog_ids()
    # ignore p31, since we used that for Dev1 timing
    for ch_id in ch_ids:
        n_found = 0
        for ch in channel_list:
            if ch.dct['id'] == ch_id:
                n_found += 1
        if n_found != 1:
            error_fmt = '{0} copies of {1} found. There should only be 1'
            error_str = error_fmt.format(n_found, ch_id)
            error_list.append(error_str)

    # check for timing overlap in keyframelist
    error_keyname = keyframe_list.do_keyframes_overlap()
    if error_keyname is not None:
        error_fmt = '{0} overlaps with the next keyframe'
        error_str = error_fmt.format(error_keyname)
        error_list.append(error_str)


    return error_list
1277473
def find_prototypes(code):
    

    prots = []
    lines = code.split('\n')
    for line in lines:
        m = re.match("\s*" + re_func_prot, line)
        if m is not None:
            rtype, name, args = m.groups()[:3]
            if args == 'void' or args.strip() == '':
                args = []
            else:
                args = [tuple(arg.strip().split(' '))
                        for arg in args.split(',')]
            prots.append((name, args, rtype))

    return prots
528263
def spec_check(self, auth_list, fun, args, form):
        '''
        
        '''
        if not auth_list:
            return False
        if form != 'cloud':
            comps = fun.split('.')
            if len(comps) != 2:
                # Hint at a syntax error when command is passed improperly,
                # rather than returning an authentication error of some kind.
                # See Issue #21969 for more information.
                return {'error': {'name': 'SaltInvocationError',
                                  'message': 'A command invocation error occurred: Check syntax.'}}
            mod_name = comps[0]
            fun_name = comps[1]
        else:
            fun_name = mod_name = fun
        for ind in auth_list:
            if isinstance(ind, six.string_types):
                if ind[0] == '@':
                    if ind[1:] == mod_name or ind[1:] == form or ind == '@{0}s'.format(form):
                        return True
            elif isinstance(ind, dict):
                if len(ind) != 1:
                    continue
                valid = next(six.iterkeys(ind))
                if valid[0] == '@':
                    if valid[1:] == mod_name:
                        if self.__fun_check(ind[valid], fun_name, args.get('arg'), args.get('kwarg')):
                            return True
                    if valid[1:] == form or valid == '@{0}s'.format(form):
                        if self.__fun_check(ind[valid], fun, args.get('arg'), args.get('kwarg')):
                            return True
        return False
1208636
def errors(self):
        
        ret_errs = list()
        errors = self.get('error').get('errors', None) or list()
        assert isinstance(errors, list)
        for err in errors:
            when = parse_datetime(err.get('when', None))
            msg = err.get('message', '')
            e = ErrorEvent(when, msg)
            ret_errs.append(e)
        return ret_errs
444623
public List<Throwable> getErrors() {
        final List<Throwable> retval = new ArrayList<Throwable>();
        for (final TestInfo testInfo : contractTestMap.listTestInfo()) {
            retval.addAll( testInfo.getErrors() );
        }
        return retval;
    }
605673
def fetch_arc_errors(self):
        '''
        
        '''
        error_list = []
        hnode = self.validate_first_element()
        if hnode:
            error_list.append({'hook_error': hnode})
        rnode = self.validate_last_element()
        if rnode:
            error_list.append({'reso_error': rnode})
        try:
            self.validate_generations()
        except ArcGenerationError as ag:
            error_list.append({'generation_error': str(ag)})
        milecheck = self.validate_milestones()
        if milecheck:
            error_list.append({'mseq_error': milecheck})
        return error_list
794200
def _make_error(index, code, errmsg, operation):
    
    return {
        _UINDEX: index,
        _UCODE: code,
        _UERRMSG: errmsg,
        _UOP: operation
    }
326655
def __analizar_errores(self, ret):
        ""
        if 'arrayErrores' in ret:
            errores = ret['arrayErrores'] or []
            self.Errores = [err['error'] for err in errores]
            self.ErrCode = ' '.join(self.Errores)
            self.ErrMsg = '\n'.join(self.Errores)
702730
def _get_checked_errors(cls, options):
        """"""
        checked_codes = cls._get_exclusive_error_codes(options)
        if checked_codes is None:
            checked_codes = cls.DEFAULT_CONVENTION

        cls._set_add_options(checked_codes, options)

        return checked_codes
532367
def errors(self, value):
        
        if value not in self.values:
            return [Error(self._error_message, code=ERROR_CODE_UNKNOWN)]
        return []
333809
def _find_error(vals):
    

    err_vals = []
    for en in vals:
        c = en[2]
        conc = [float(i)/sum(c) for i in c]

        err = abs(en[0]-en[1])

        err_vals.append([conc,err])

    return err_vals
784014
def security_errors(self):
        """"""
        errors = ErrorDict()
        for f in ["honeypot", "timestamp", "security_hash"]:
            if f in self.errors:
                errors[f] = self.errors[f]
        return errors
734042
def get_context_target_errors(self):
    
    if self._context_target_errors:  return self._context_target_errors
    if len(self._query_errors) < 3: return {}
    nts = ['A','C','G','T']
    poss = ['A','C','G','T','-']
    r = {}
    for i in nts:
      if i not in r:  r[i] = {}
      for j in nts:
        if j not in r[i]: r[i][j] = {}
        for k in poss:
          if k not in r[i][j]: 
            r[i][j][k] = {}
            r[i][j][k]['types'] = {}
            r[i][j][k]['total'] = 0
          for l in poss:
            if l not in r[i][j][k]['types']: r[i][j][k]['types'][l] = 0
    # now r is initialized
    for i in range(1,len(self._target_errors)-1):

      tobs = self._target_errors[i].get_observable()
      tunobs = self._target_errors[i].get_unobservable()
      otype = tobs.get_type()
      op = tobs.get_error_probability()
      before = tunobs.get_before_type()
      bp = tunobs.get_before_probability()
      after = tunobs.get_after_type()
      ap = tunobs.get_after_probability()
      if otype[2][0][0] == 'N': continue
      if otype[2][1][0] == 'N': continue
      if before:
        if before[2][0][0] == 'N': continue
        if before[2][1][0] == 'N': continue
      if after:
        if after[2][0][0] == 'N': continue
        if after[2][1][0] == 'N': continue

      tbefore = self._target_errors[i-1].get_base()
      t = self._target_errors[i].get_base()
      tafter = self._target_errors[i+1].get_base()

      if tbefore == 'N' or tafter == 'N' or t == 'N': continue
      r[tbefore][t]['-']['total'] += 0.5
      r[t][tafter]['-']['total'] += 0.5
      r[tbefore][tafter][t]['total'] += 1

      # We know we made an observation
      if otype[0] == 'mismatch':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tafter][t]['types'][qb] += op
      elif otype[0] == 'match':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tafter][t]['types'][qb] += float(1)
      elif otype[0] == 'deletion':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tafter][t]['types']['-'] += op
        r[tbefore][tafter][t]['types'][qb] += (1-op)
      # make sure our insertion can't be bigger than 1
      hp_insert_before = 0
      hp_insert_after = 0
      if otype[0] == 'insertion':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tb]['-']['types'][qb] += op/2
        r[tb][tafter]['-']['types'][qb] += op/2
        #homopolymer ... so we do have the correct base
        r[tbefore][tafter][t]['types'][qb] += 1

      # now take care of total insertions
      total_bp = 0
      total_ap = 0
      if before:
        qb = before[2][1][0]
        r[tbefore][t]['-']['types'][qb] += bp
      if after:
        qb = after[2][1][0]
        r[t][tafter]['-']['types'][qb] += ap
      #r[tbefore][t]['-']['types'][qb] += total_bp+(1-total_bp)*hp_insert_before
      #r[t][tafter]['-']['types'][qb] += total_ap+(1-total_ap)*hp_insert_after

      ##type = self._target_errors[i].get_type()
      #p = self._target_errors[i].get_error_probability()
      #if p > 0:
      #  if type[0] not in r[tbefore][t][tafter]['types']:
      #    r[tbefore][t][tafter]['types'][type[0]] = 0
      #  r[tbefore][t][tafter]['types'][type[0]] += p
      #r[tbefore][t][tafter]['total']+=1
    for b in r:
      for a in r:
        val = sum([r[b][a]['-']['types'][q] for q in nts])
        r[b][a]['-']['types']['-'] = r[b][a]['-']['total'] - val
    return r
401017
def get_error_codes(cls) -> Iterable[str]:
        """"""
        for group in cls.groups:
            for error in group.errors:
                yield error.code
1323460
def check_error(self, response, status, err_cd):
        " "

        if 'status' not in response:
            return False

        if response['status'] != status:
            return False

        if 'msgs' not in response:
            return False

        if not isinstance(response['msgs'], list):
            return False

        for msg in response['msgs']:

            if 'LVL' in msg and msg['LVL'] != 'ERROR':
                continue

            if 'ERR_CD' in msg and msg['ERR_CD'] == err_cd:
                return True

        return False
1120974
def get_error(self, errstr):
        '''
        
        '''
        for line in errstr.split('\n'):
            if line.startswith('ssh:'):
                return line
            if line.startswith('Pseudo-terminal'):
                continue
            if 'to the list of known hosts.' in line:
                continue
            return line
        return errstr