Dictionary with errors of an *of-rule mapped to the index of the
            definition it occurred in. Returns :obj:`None` if not applicable.
168314
def definitions_errors(self):
        
        if not self.is_logic_error:
            return None

        result = defaultdict(list)
        for error in self.child_errors:
            i = error.schema_path[len(self.schema_path)]
            result[i].append(error)
        return result
1161355
def get_form_errors(form):
    
    return {
        'non_field': form.non_field_errors(),
        'field_specific': OrderedDict(
            (field, form.errors[field.name])
            for field in form
            if field.name in form.errors
        )
    }
109630
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'indexed') and self.indexed is not None:
            _dict['indexed'] = self.indexed
        if hasattr(self,
                   'maximum_allowed') and self.maximum_allowed is not None:
            _dict['maximum_allowed'] = self.maximum_allowed
        return _dict
212091
def one_of(inners, arg):
    """"""
    for inner in inners:
        with suppress(com.IbisTypeError, ValueError):
            return inner(arg)

    rules_formatted = ', '.join(map(repr, inners))
    raise com.IbisTypeError(
        'Arg passes neither of the following rules: {}'.format(rules_formatted)
    )
526118
def get_context_query_errors(self):
    
    if self._context_query_errors:  return self._context_query_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._query_errors)-1):

      tobs = self._query_errors[i].get_observable()
      tunobs = self._query_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._query_errors[i-1].get_base()
      t = self._query_errors[i].get_base()
      tafter = self._query_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'][tb] += op
      elif otype[0] == 'match':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tafter][t]['types'][tb] += float(1)
      elif otype[0] == 'insertion':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tafter][t]['types']['-'] += op
        r[tbefore][tafter][t]['types'][tb] += (1-op)
      # make sure our deletion can't be bigger than 1
      hp_deletion_before = 0
      hp_deletion_after = 0
      if otype[0] == 'deletion':
        tb = otype[2][0][0]
        qb = otype[2][1][0]
        r[tbefore][tb]['-']['types'][tb] += op/2
        r[tb][tafter]['-']['types'][tb] += op/2
        #homopolymer ... so we do have the correct base
        r[tbefore][tafter][t]['types'][tb] += 1

      # now take care of total deletions
      if before:
        tb = before[2][0][0]
        r[tbefore][t]['-']['types'][tb] += bp
      if after:
        tb = after[2][0][0]
        r[t][tafter]['-']['types'][tb] += ap

      ##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
842602
def copyError(self, to):
        
        if to is None: to__o = None
        else: to__o = to._o
        ret = libxml2mod.xmlCopyError(self._o, to__o)
        return ret
624942
def errors_as_dict(self):
        """"""
        errors = []

        for e in self.errors:

            errors.append({
                'file': e.term.file_name,
                'row': e.term.row if e.term else '<unknown>',
                'col': e.term.col if e.term else '<unknown>',
                'term': e.term.join if e.term else '<unknown>',
                'error': str(e)
            })

        return errors
750603
def asDict(self):
        """"""
        return {
            'isError': self.isError,
            'message': self.message,
            'values': self.values,
            'value': self.value,
        }
623853
def errors(self):
        
        try:
            return self.__dict__['errors']
        except KeyError:
            pass

        suberrors = dict()
        for err in self.response_doc.findall('error'):
            field = err.attrib['field']
            symbol = err.attrib['symbol']
            message = err.text
            sub_err = self.Suberror(field, symbol, message)

            # If the field exists, we need to turn the suberror
            # into a list of suberrors
            if field in suberrors:
                if type(suberrors[field]) != list:
                    suberrors[field] = [suberrors[field]]
                suberrors[field].append(sub_err)
            else:
                suberrors[field] = sub_err

        self.__dict__['errors'] = suberrors
        return suberrors
1088937
def parse_rule(rule):
    
    m = _rule_re.match(rule)
    if m is None or m.end() < len(rule):
        raise ValueError('Error while parsing rule {0}'.format(rule))
    data = m.groupdict()
    converter = data['converter'] or 'default'
    return converter, data['args'] or None, data['variable']
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
1057584
function modelIndexErrors(errors, context) {
        if (context && context.modelIndexErrors) {
            return context.modelIndexErrors(errors);
        }
        if (Array.isArray(errors)) {
            var rtn = {};
            _.each(errors, function(data) {
                for (var name in data) {
                    if (data.hasOwnProperty(name)) {
                        rtn[name] = data[name];
                    }
                }
            });
            return rtn;
        } else {
            return errors;
        }
    }
992865
def threw(self, error_type=None):
        
        if not error_type:
            return True if len(self.exceptions) > 0 else False
        else:
            return uch.obj_in_list(self.exceptions, error_type)
550973
def _get_index(self):
        
        glyph = self.glyph
        if glyph is not None:
            parent = glyph
        else:
            parent = self.font
        if parent is None:
            return None
        return parent.guidelines.index(self)
1098866
def safe_dict(obj_or_func, **kwargs):
    
    if callable(obj_or_func):
        res = obj_or_func(**kwargs)
    else:
        res = obj_or_func
    if hasattr(res, '__dict__'):
        return res.__dict__

    attributes = [i for i in dir(res) if not i.startswith('_')]
    out = {}
    for a in attributes:
        val = getattr(res, a)
        if val and not callable(val):
            out[a] = val

    return out
290331
def to_odict(self, exclude=None):
        
        if exclude is None:
            exclude = tuple()
        colnames = [c.name for c in self.__table__.columns
                    if c.name not in exclude]
        return OrderedDict(((col, getattr(self, col)) for col in colnames))
541106
def _rule_block(self):
        

        name = self._get_token(self.RE_NAME)
        self._expect_token('{')

        # consume additional options if available
        options = []
        while self._lookahead_token() != '}':
            options.append(self._rule_option())

        self._expect_token('}')
        return [name, options]