How to use the atelier.rstgen.table function in atelier

To help you get started, we’ve selected a few atelier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lino-framework / lino / lino / utils / sql.py View on Github external
# find max
            e = d[max(d, key=lambda x: x.time)]
            p(e, **options)
            print("-------------------")
        else:
            if show_times:
                headers = 'total_time count table stmt_type time'.split()
                values = sorted(d.values(), key=lambda x: -x.total_time)
            else:
                headers = 'table stmt_type count'.split()
                values = sorted(d.values(), key=lambda x: x.table)
            rows = []
            for e in values:
                rows.append([getattr(e, h) for h in headers])
                rows.sort()
            print(rstgen.table(headers, rows))
    else:
        print("No sql queries found")
github lino-framework / lino / lino / lino_site.py View on Github external
#~ else:
                #~ cells.append('')
                cells.append(str(len(model._meta.fields)))
                #~ qs = model.objects.all()
                qs = model.objects.order_by('pk')
                n = qs.count()
                cells.append(str(n))
                #~ if n:
                #~ cells.append(obj2str(qs[0]))
                #~ cells.append(obj2str(qs[n-1]))
                #~ else:
                #~ cells.append('')
                #~ cells.append('')

                rows.append(cells)
        s += rstgen.table(headers, rows)
        return s
github lino-framework / lino / lino / utils / diag.py View on Github external
#~ cells.append('X')
                #~ else:
                #~ cells.append('')
                cells.append(str(len(model._meta.concrete_fields)))
                qs = model.objects.all()
                n = qs.count()
                cells.append(str(n))
                #~ if n:
                #~ cells.append(obj2str(qs[0]))
                #~ cells.append(obj2str(qs[n-1]))
                #~ else:
                #~ cells.append('')
                #~ cells.append('')

                rows.append(cells)
        s += rstgen.table(headers, rows)
        return s
github lino-framework / lino / lino / sphinxcontrib / actordoc.py View on Github external
headers.append("help text")

    def rowfmt(f):
        cells = [
            f.name,
            fieldtype(f),
            f.verbose_name,
            f.help_text
        ]
        #~ for lng in babel.AVAILABLE_LANGUAGES:
            #~ babel.set_language(lng)
            #~ cells.append(force_text(_(f.verbose_name)))
        #~ cells.append(f.help_text)
        return cells
    rows = [rowfmt(f) for f in fields if not hasattr(f, '_lino_babel_field')]
    return rstgen.table(headers, rows)
github lino-framework / lino / lino / utils / code.py View on Github external
def fmt(n):
        return "{}k".format(round(n/1000.0, 1))

    total_sums = [0] * len(fields)
    for package in packages:
        sums = [0] * len(fields)
        for name, filename in codefiles(package + '*'):
            sf = SourceFile(name, filename)
            for i, k in enumerate(fields):
                sums[i] += getattr(sf, k)
        rows.append([package] + [fmt(n) for n in sums])
        for i, k in enumerate(fields):
            total_sums[i] += sums[i]
    rows.append(['total'] + [fmt(n) for n in total_sums])
    return rstgen.table(headers, rows)
github lino-framework / lino / lino / utils / code.py View on Github external
def fmt(n):
        return "{}k".format(round(n/1000.0, 1))

    total_sums = [0] * len(fields)
    for package in packages:
        sums = [0] * len(fields)
        for name, filename in codefiles(package + '*'):
            sf = SourceFile(name, filename)
            for i, k in enumerate(fields):
                sums[i] += getattr(sf, k)
        rows.append([package] + [fmt(n) for n in sums])
        for i, k in enumerate(fields):
            total_sums[i] += sums[i]
    rows.append(['total'] + [fmt(n) for n in total_sums])
    return rstgen.table(headers, rows)