Return list of namedtuples removing fields which are redundant or verbose.
763834
def get_goea_nts_prt(self, fldnames=None, **usr_kws):
        """"""
        kws = usr_kws.copy()
        if 'not_fldnames' not in kws:
            kws['not_fldnames'] = ['goterm', 'parents', 'children', 'id']
        if 'rpt_fmt' not in kws:
            kws['rpt_fmt'] = True
        return self.get_goea_nts_all(fldnames, **kws)
1350362
def clean(self):
        """"""
        doc = self._resource
        result = {k: v for k, v in doc.iteritems() if k not in
                  self.internal_fields}

        if '_id' in doc and 'id' not in result:
            result['id'] = doc['_id']

        return result
187821
def flatten_fieldsets(fieldsets):
    """"""
    field_names = []
    for _, opts in fieldsets or ():
        if 'fieldsets' in opts:
            field_names += flatten_fieldsets(opts.get('fieldsets'))
        else:
            for field in opts.get('fields', ()):
                if isinstance(field, (list, tuple)):
                    field_names.extend(field)
                else:
                    field_names.append(field)
    return field_names
315427
def _clean_schema_fields(self, fields):
        """"""
        fields_sorted = sorted(fields, key=lambda field: field["name"])
        # Ignore mode and description when comparing schemas.
        return [
            {"name": field["name"], "type": field["type"]}
            for field in fields_sorted
        ]
1374146
def _DataClean_(fieldVal):
    

    fieldValNew = fieldVal

    fieldValNew = fieldValNew.upper()

    fieldValNew = fieldValNew.strip()

    fieldValNew = re.sub("[\s\n\t]+", " ", fieldValNew)

    return fieldValNew
170483
def exclude(self, *fields):
        

        if len(fields) == 1 and isinstance(fields[0], list):
            exclude_fields = fields[0]
        else:
            exclude_fields = list(fields)

        exclude_fields = [self._defunc(it) for it in exclude_fields]
        exclude_fields = [field.name if not isinstance(field, six.string_types) else field
                          for field in exclude_fields]

        fields = [name for name in self._schema.names
                  if name not in exclude_fields]

        return self._project(fields)
369281
def compiled_named_imports(self):
        """"""
        res = []
        if self.postgres_types:
            res.append(
                ALCHEMY_TEMPLATES.named_import.safe_substitute(
                    module='sqlalchemy.dialects.postgresql',
                    labels=", ".join(self.postgres_types)))
        if self.mutable_dict_types:
            res.append(
                ALCHEMY_TEMPLATES.named_import.safe_substitute(
                    module='sqlalchemy.ext.mutable', labels='MutableDict'
                ))
        return "\n".join(res)
954175
def _get_fieldnames(item):
        """"""
        if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord
            return item.get_prtflds_all()
        if hasattr(item, "_fields"): # Is a namedtuple
            return item._fields
1184293
def as_namedtuple(self):
        
        d = self.as_dict()
        return namedtuple('ColorRegister', d.keys())(*d.values())
355100
def namedlist(objname, fieldnames):
    ''
    class NamedListTemplate(list):
        __name__ = objname
        _fields = fieldnames

        def __init__(self, L=None, **kwargs):
            if L is None:
                L = [None]*len(fieldnames)
            super().__init__(L)
            for k, v in kwargs.items():
                setattr(self, k, v)

        @classmethod
        def length(cls):
            return len(cls._fields)

    for i, attrname in enumerate(fieldnames):
        # create property getter/setter for each field
        setattr(NamedListTemplate, attrname, property(operator.itemgetter(i), itemsetter(i)))

    return NamedListTemplate
250164
def unstructure_attrs_astuple(self, obj):
        # type: (Any) -> Tuple
        """"""
        attrs = obj.__class__.__attrs_attrs__
        return tuple(self.unstructure(getattr(obj, a.name)) for a in attrs)
272041
def normalize_params(params):
    """"""
    # Collect a set of all fields
    fields = set()
    for p in params:
        fields.update(p)
    fields = sorted(fields)

    params2 = list(pluck(fields, params, MISSING))
    # Non-basic types (including MISSING) are unique to their id
    tokens = [
        tuple(x if isinstance(x, (int, float, str)) else id(x) for x in p)
        for p in params2
    ]

    return fields, tokens, params2
173800
def get_sections_flattened(section_nts):
        """"""
        nt_flds = list(section_nts[0][1][0]._fields)
        # Flatten section_nts 2-D list
        if 'section' in nt_flds:
            return [nt for _, nts in section_nts for nt in nts]
        # Flatten section_nts 2-D list, and add sections to each namedtuple
        nt_flds.append('section')
        nts_flat = []
        ntobj = cx.namedtuple("Nt", " ".join(nt_flds))
        for section_name, nts in section_nts:
            for nt_go in nts:
                vals = list(nt_go) + [section_name]
                nts_flat.append(ntobj._make(vals))
        return nts_flat
937940
def _namedtuplify(mapping):
    
    if isinstance(mapping, collections.Mapping):
        for key, value in list(mapping.items()):
            mapping[key] = _namedtuplify(value)
        try:
            mapping.pop('__name__')
        except KeyError:
            pass
        # return collections.namedtuple('settingsa', dict(**mapping))(**mapping)
        return _MutableNamedTuple(mapping)
    return _parse(mapping)
186399
def reduce_annotations(self, annotations, options):
        """"""
        getfnc_qual_ev = options.getfnc_qual_ev()
        return [nt for nt in annotations if getfnc_qual_ev(nt.Qualifier, nt.Evidence_Code)]
727056
def normal_fields(self):
        """"""
        return {f:v for f, v in self.fields.items() if not f.startswith('_')}
1246825
def infer_typing_namedtuple(node, context=None):
    """"""
    # This is essentially a namedtuple with different arguments
    # so we extract the args and infer a named tuple.
    try:
        func = next(node.func.infer())
    except InferenceError:
        raise UseInferenceDefault

    if func.qname() != "typing.NamedTuple":
        raise UseInferenceDefault

    if len(node.args) != 2:
        raise UseInferenceDefault

    if not isinstance(node.args[1], (nodes.List, nodes.Tuple)):
        raise UseInferenceDefault

    names = []
    for elt in node.args[1].elts:
        if not isinstance(elt, (nodes.List, nodes.Tuple)):
            raise UseInferenceDefault
        if len(elt.elts) != 2:
            raise UseInferenceDefault
        names.append(elt.elts[0].as_string())

    typename = node.args[0].as_string()
    if names:
        field_names = "({},)".format(",".join(names))
    else:
        field_names = "''"
    node = extract_node(
        "namedtuple({typename}, {fields})".format(typename=typename, fields=field_names)
    )
    return infer_named_tuple(node, context)