Return the print fields in the go2nt namedtuple.
187701
def __init_prt_flds(self):
        """"""
        prt_flds = ['NS', 'level', 'depth']
        if self.relationships:
            prt_flds.append('reldepth')
        prt_flds.extend(['GO', 'alt', 'GO_name'])
        if 'dcnt' in self.kw_elems:
            prt_flds.append('dcnt')
        if 'D1' in self.kw_elems:
            prt_flds.append('D1')
        if 'tcnt' in self.kw_elems:
            prt_flds.append('tcnt')
            prt_flds.append('tfreq')
            prt_flds.append('tinfo')
        if self.relationships:
            prt_flds.append('childcnt')
            prt_flds.append('REL')
            prt_flds.append('REL_short')
            prt_flds.append('rel')
        prt_flds.append('id')
        return prt_flds
271652
def nn_symbols():
    ""
    value = ctypes.c_int()
    name_value_pairs = []
    i = 0
    while True:
        name = _nn_symbol(i, ctypes.byref(value))
        if name is None:
            break
        i += 1
        name_value_pairs.append((name.decode('ascii'), value.value))
    return name_value_pairs
554978
def _fmt_fields(fld_vals, fld2fmt):
    """"""
    vals = []
    for fld, val in fld_vals:
        if fld in fld2fmt:
            val = fld2fmt[fld].format(val)
        vals.append(val)
    return vals
689213
def print_help_fields():
    
    # Mock entries, so they fulfill the expectations towards a field definition
    def custom_manifold():
        "named rTorrent custom attribute, e.g. 'custom_completion_target'"
        return ("custom_KEY", custom_manifold)
    def kind_manifold():
        "file types that contribute at least N% to the item's total size"
        return ("kind_N", kind_manifold)

    print('')
    print("Fields are:")
    print("\n".join(["  %-21s %s" % (name, field.__doc__)
        for name, field in sorted(engine.FieldDefinition.FIELDS.items() + [
            custom_manifold(), kind_manifold(),
        ])
    ]))

    print('')
    print("Format specifiers are:")
    print("\n".join(["  %-21s %s" % (name, doc)
        for name, doc in sorted(formatting.OutputMapping.formatter_help())
    ]))
    print('')
    print("Append format specifiers using a '.' to field names in '-o' lists,\n"
          "e.g. 'size.sz' or 'completed.raw.delta'.")
526065
def conf(self):
        '''
        '''
        conf = namedtuple('conf', field_names=self._conf.keys())
        return conf(**self._conf)
285509
def print_named_configs(ingredient):
    

    def print_named_configs():
        """Print the available named configs and exit."""
        named_configs = OrderedDict(ingredient.gather_named_configs())
        print(_format_named_configs(named_configs, 2))

    return print_named_configs
28475
def _chk_flds_fmt(nt_fields, prtfmt):
    """"""
    fmtflds = get_fmtflds(prtfmt)
    missing_data = set(fmtflds).difference(set(nt_fields))
    # All data needed for print is present, return.
    if not missing_data:
        return
    #raise Exception('MISSING DATA({M}).'.format(M=" ".join(missing_data)))
    msg = ['CANNOT PRINT USING: "{PF}"'.format(PF=prtfmt.rstrip())]
    for fld in fmtflds:
        errmrk = "" if fld in nt_fields else "ERROR-->"
        msg.append("  {ERR:8} {FLD}".format(ERR=errmrk, FLD=fld))
    raise Exception('\n'.join(msg))
486669
def get_fields(self):
        """"""

        def visitor(field, children):
            assert field != conf.lib.clang_getNullCursor()

            # Create reference to TU so it isn't GC'd before Cursor.
            field._tu = self._tu
            fields.append(field)
            return 1 # continue
        fields = []
        conf.lib.clang_Type_visitFields(self,
                            callbacks['fields_visit'](visitor), fields)
        return iter(fields)
993855
def _rdtxt_gos(self, ret, go_file):
        """"""
        if not os.path.exists(go_file):
            raise RuntimeError("CAN NOT READ: {FILE}\n".format(FILE=go_file))
        goids = set()
        go2color = {}
        with open(go_file) as ifstrm:
            for line in ifstrm:
                goids_found = self.re_goids.findall(line)
                if goids_found:
                    goids.update(goids_found)
                    colors = self.re_color.findall(line)
                    if colors:
                        if len(goids_found) == len(colors):
                            for goid, color in zip(goids_found, colors):
                                go2color[goid] = color
                        else:
                            print("IGNORING: {L}".format(L=line),)
        self._update_ret(ret, goids, go2color)
1329525
def __init_go2nt_w_usr(self, gos_all, usr_go2nt, prt_flds_all):
        """"""
        assert usr_go2nt, "go2nt HAS NO ELEMENTS"
        from goatools.nt_utils import get_unique_fields
        go2nts = [usr_go2nt, self.gosubdag.go2nt, self._get_go2nthdridx(gos_all)]
        usr_nt_flds = next(iter(usr_go2nt.values()))._fields # Get any single value from a dict
        flds = get_unique_fields([usr_nt_flds, prt_flds_all])
        go2nt = get_dict_w_id2nts(gos_all, go2nts, flds)
        return self._init_go2nt_aug(go2nt)
762044
public static String printToUnicodeString(final UnknownFieldSet fields) {
    try {
      final StringBuilder text = new StringBuilder();
      UNICODE_PRINTER.printUnknownFields(fields, new TextGenerator(text));
      return text.toString();
    } catch (IOException e) {
      throw new IllegalStateException(e);
    }
  }
297211
def get_ns2nts(results, fldnames=None, **kws):
        """"""
        ns2nts = cx.defaultdict(list)
        nts = MgrNtGOEAs(results).get_goea_nts_all(fldnames, **kws)
        for ntgoea in nts:
            ns2nts[ntgoea.NS].append(ntgoea)
        return ns2nts
777902
def prt_goids(self, prt):
        """"""
        fmt = self.gosubdag.prt_attr['fmta']
        nts = sorted(self.gosubdag.go2nt.values(), key=lambda nt: [nt.NS, nt.depth, nt.alt])
        _get_color = self.pydotnodego.go2color.get
        for ntgo in nts:
            gostr = fmt.format(**ntgo._asdict())
            col = _get_color(ntgo.GO, "")
            prt.write("{COLOR:7} {GO}\n".format(COLOR=col, GO=gostr))
97155
def fields(self):
        '''
        
        '''
        return (
            self.locus, self.offset_start, self.offset_end, self.alignment_key)
772578
def get_nts_strpval(self, fmt="{:8.2e}"):
        """"""
        objntmgr = MgrNts(self.goea_results)
        dcts = objntmgr.init_dicts()
        # pylint: disable=line-too-long
        pval_flds = set(k for k in self._get_fieldnames(next(iter(self.goea_results))) if k[:2] == 'p_')
        for fld_float in pval_flds:
            fld_str = "s_" + fld_float[2:]
            objntmgr.add_f2str(dcts, fld_float, fld_str, fmt)
        return objntmgr.mknts(dcts)
230929
def printArray(self, node, printState: PrintState):
        
        if (
            self.nameMapper[node["name"]] not in printState.definedVars
            and self.nameMapper[node["name"]] not in printState.globalVars
        ):
            printState.definedVars += [self.nameMapper[node["name"]]]
            assert int(node["count"]) > 0
            printState.definedVars += [node["name"]]

            varType = ""
            if node["type"].upper() == "INTEGER":
                varType = "int"
            elif node["type"].upper() in ("DOUBLE", "REAL"):
                varType = "float"
            elif node["type"].upper() == "CHARACTER":
                varType = "str"
            elif node["isDevTypeVar"]:
                varType = node["type"].lower() + "()"

            assert varType != ""

            self.pyStrings.append(f"{node['name']} = Array({varType}, [")
            for i in range(0, int(node["count"])):
                loBound = node["low" + str(i + 1)]
                upBound = node["up" + str(i + 1)]
                dimensions = f"({loBound}, {upBound})"
                if i < int(node["count"]) - 1:
                    self.pyStrings.append(f"{dimensions}, ")
                else:
                    self.pyStrings.append(f"{dimensions}")
            self.pyStrings.append("])")

            if node["isDevTypeVar"]:
                self.pyStrings.append(printState.sep)
                # This may require updating later when we have to deal with the
                # multi-dimensional derived type arrays
                upBound = node["up1"]
                self.pyStrings.append(
                    f"for z in range(1, {upBound}+1):" + printState.sep
                )
                self.pyStrings.append(
                    f"    obj = {node['type']}()" + printState.sep
                )
                self.pyStrings.append(
                    f"    {node['name']}.set_(z, obj)" + printState.sep
                )
640317
def prt_nts(self, desc2nts, prt=sys.stdout, prtfmt=None):
        """"""
        # deprecated
        # Set print format string
        if prtfmt is None:
            prtfmt = "{{hdr1usr01:2}} {FMT}\n".format(FMT=self.grprobj.gosubdag.prt_attr['fmt'])
        # 1-D: data to print is a flat list of namedtuples
        if 'flat' in desc2nts:
            prt_txt(prt, desc2nts['flat'], prtfmt=prtfmt)
        # 2-D: data to print is a list of [(section, nts), ...
        else:
            WrSectionsTxt.prt_sections(prt, desc2nts['sections'], prtfmt)