Print flat GO list.
548601
def prt_gos_flat(self, prt):
        """"""
        prtfmt = self.datobj.kws['fmtgo']
        _go2nt = self.sortobj.grprobj.go2nt
        go2nt = {go:_go2nt[go] for go in self.go2nt}
        prt.write("\n{N} GO IDs:\n".format(N=len(go2nt)))
        _sortby = self._get_sortgo()
        for ntgo in sorted(go2nt.values(), key=_sortby):
            prt.write(prtfmt.format(**ntgo._asdict()))
288717
def print_boards(hwpack='arduino', verbose=False):
    """"""
    if verbose:
        pp(boards(hwpack))
    else:
        print('\n'.join(board_names(hwpack)))
123942
def PrintGroup(name, codes):
  """"""

  # See unicode_groups.h for a description of the data structure.

  # Split codes into 16-bit ranges and 32-bit ranges.
  range16 = MakeRanges([c for c in codes if c < 65536])
  range32 = MakeRanges([c for c in codes if c >= 65536])

  # Pull singleton ranges out of range16.
  # code16 = [lo for lo, hi in range16 if lo == hi]
  # range16 = [[lo, hi] for lo, hi in range16 if lo != hi]

  global n16
  global n32
  n16 += len(range16)
  n32 += len(range32)

  ugroup = "{ \"%s\", +1" % (name,)
  # if len(code16) > 0:
  #   PrintCodes("uint16", name+"_code16", code16)
  #   ugroup += ", %s_code16, %d" % (name, len(code16))
  # else:
  #   ugroup += ", 0, 0"
  if len(range16) > 0:
    PrintRanges("URange16", name+"_range16", range16)
    ugroup += ", %s_range16, %d" % (name, len(range16))
  else:
    ugroup += ", 0, 0"
  if len(range32) > 0:
    PrintRanges("URange32", name+"_range32", range32)
    ugroup += ", %s_range32, %d" % (name, len(range32))
  else:
    ugroup += ", 0, 0"
  ugroup += " }"
  return ugroup
37939
def get_list(file,fmt):
    ''''''
    out=[]
    for i in fmt:
        if i == 'i':
            out.append(get_int(file));
        elif i == 'f' or i == 'd':
            out.append(get_float(file));
        elif i == 's':
            out.append(get_str(file));
        else:
            raise ValueError("Unexpected flag '{}'".format(i));
    return out;
959443
def print_line(l):
    
    print_lines = ['# STOCKHOLM', '#=GF', '#=GS', ' ']
    if len(l.split()) == 0:
        return True
    for start in print_lines:
        if l.startswith(start):
            return True
    return False
556659
def print_(rows, limit=15, sort='size', order='descending'):
    
    localrows = []
    for row in rows:
        localrows.append(list(row))
    # input validation
    sortby = ['type', '#', 'size']
    if sort not in sortby:
        raise ValueError("invalid sort, should be one of" + str(sortby))
    orders = ['ascending', 'descending']
    if order not in orders:
        raise ValueError("invalid order, should be one of" + str(orders))
    # sort rows
    if sortby.index(sort) == 0:
        if order == "ascending":
            localrows.sort(key=lambda x: _repr(x[0]))
        elif order == "descending":
            localrows.sort(key=lambda x: _repr(x[0]), reverse=True)
    else:
        if order == "ascending":
            localrows.sort(key=lambda x: x[sortby.index(sort)])
        elif order == "descending":
            localrows.sort(key=lambda x: x[sortby.index(sort)], reverse=True)
    # limit rows
    localrows = localrows[0:limit]
    for row in localrows:
        row[2] = stringutils.pp(row[2])
    # print rows
    localrows.insert(0,["types", "# objects", "total size"])
    _print_table(localrows)
785048
def print_collection(self, c, h, n):
        """"""
        if c in h:
            return "[]..."
        h.append(c)
        s = []
        for item in c:
            s.append("\n")
            s.append(self.indent(n))
            s.append(self.process(item, h, n - 2))
            s.append(",")
        h.pop()
        return "".join(s)
303928
def _output_to_list(cmdoutput):
    '''
    
    '''
    return [item for line in cmdoutput.splitlines() if _safe_output(line) for item in line.split()]
1003635
def prt_outfiles_flat(self, goea_results, outfiles):
        """"""
        kws = {'indent':self.args.indent, 'itemid2name':self.itemid2name}
        for outfile in outfiles:
            if outfile.endswith(".xlsx"):
                self.objgoea.wr_xlsx(outfile, goea_results, **kws)
            #elif outfile.endswith(".txt"):  # TBD
            #    pass
            else:
                self.objgoea.wr_tsv(outfile, goea_results, **kws)
795535
def gen_output_fmt(self, fmt_list):
        """"""

        rexp_list = []
        for fmt in fmt_list:
            rexp_list.extend(self.gen_output_fmt_1(fmt))

        return rexp_list
1004224
def pretty_print(ast, indent_str='  '):
    

    return ''.join(chunk.text for chunk in pretty_printer(indent_str)(ast))
1075934
def _print_napps(cls, napp_list):
        """"""
        mgr = NAppsManager()
        enabled = mgr.get_enabled()
        installed = mgr.get_installed()
        napps = []
        for napp, desc in sorted(napp_list):
            status = 'i' if napp in installed else '-'
            status += 'e' if napp in enabled else '-'
            status = '[{}]'.format(status)
            name = '{}/{}'.format(*napp)
            napps.append((status, name, desc))
        cls.print_napps(napps)
1089374
def display_list(prefix, l, color):
    
    for itm in l: print colored(prefix + itm['path'], color)
15964
def do_list(self, arglist: List[str]) -> None:
        """"""
        if arglist:
            first = arglist[0]
            try:
                first = int(first)
            except ValueError:
                first = 1
        else:
            first = 1
        last = first + 10

        for x in range(first, last):
            self.poutput(str(x))
662875
def print_options(self):
        
        summary = []
        for opt_name, opt in self.options.items():
            if opt.hidden:
                continue
            summary.append(opt.summary())
        print("\n".join(summary))
882561
def _goargs(self, ret, go_args):
        """"""
        goids = set()
        go2color = {}
        # Match on "GO ID" or "GO ID and color"
        re_gocolor = re.compile(r'(GO:\d{7})((?:#[0-9a-fA-F]{6})?)')
        for go_arg in go_args:
            mtch = re_gocolor.match(go_arg)
            if mtch:
                goid, color = mtch.groups()
                goids.add(goid)
                if color:
                    go2color[goid] = color
            else:
                print("WARNING: UNRECOGNIZED ARG({})".format(go_arg))
        self._update_ret(ret, goids, go2color)
369266
def pretty_print(d, ind='', verbosity=0):
    
    assert isinstance(d, dict)
    for k, v in sorted(d.items()):
        str_base = '{} - [{}] {}'.format(ind, type(v).__name__, k)

        if isinstance(v, dict):
            print(str_base.replace('-', '+', 1))
            pretty_print(v, ind=ind+'  ', verbosity=verbosity)
            continue
        elif isinstance(v, np.ndarray):
            node = '{}, {}, {}'.format(str_base, v.dtype, v.shape)
            if verbosity >= 2:
                node += '\n{}'.format(v)
        elif isinstance(v, Sequence):
            if v and isinstance(v, (list, tuple)):
                itemtype = ' of ' + type(v[0]).__name__
                pos = str_base.find(']')
                str_base = str_base[:pos] + itemtype + str_base[pos:]
            node = '{}, {}'.format(str_base, v)
            if verbosity < 1 and len(node) > 80:
                node = node[:77] + '...'
        else:
            node = '{}, {}'.format(str_base, v)
        print(node)