How to use the beautifultable.BeautifulTable.ALIGN_LEFT function in beautifultable

To help you get started, we’ve selected a few beautifultable 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 abulka / pynsource / src / layout / coordinate_mapper.py View on Github external
"%2.2f" % (self.graph.layoutMaxY - self.graph.layoutMinY),
            ]
        )

        t.append_row(
            [
                "factorX factorY",
                locale.format_string("%d", self.factorX, grouping=True),
                locale.format_string("%d", self.factorY, grouping=True),
            ]
        )

        # t.append_row([subtable1, "", "", ""])

        if doprint:
            t.column_alignments[0] = BeautifulTable.ALIGN_LEFT
            t.row_separator_char = ""
            print(t)
        else:
            return t

        if dump_nodes:
            for node in self.graph.nodes:
                print(node)
github adolfosilva / libgen.py / libgen / mirrors.py View on Github external
'publisher', 'lang', 'isbn'
        ]

        unsorted_headers, rows = Mirror.get_headers_values(publications)
        # sort the headers by preferred order
        sorted_headers = []
        for header in preferred_order:
            if header in unsorted_headers:
                sorted_headers.append(header)
                unsorted_headers.remove(header)
        # alphabetize the rest
        sorted_headers += sorted(unsorted_headers)

        term_c, term_r = os.get_terminal_size(0)
        table = BeautifulTable(
            default_alignment=BeautifulTable.ALIGN_LEFT,
            max_width=term_c - 1
        )
        table.column_headers = sorted_headers
        table.left_border_char = ''
        table.right_border_char = ''
        table.top_border_char = '━'
        table.bottom_border_char = ' '
        table.header_separator_char = '━'
        table.row_separator_char = '─'
        table.intersection_char = '┼'
        table.column_separator_char = '│'

        # build a table using order of sorted_headers and blank out missing data
        for row in rows:
            expanded_row = []
            for key in sorted_headers:
github abulka / pynsource / src / parsing / dump_pmodel.py View on Github external
# subtable = BeautifulTable()
    # subtable.column_headers = ["name", "rank", "gender"]
    # subtable.append_row(["Jacob", 1, "boy"])
    # subtable.append_row(["Isabella", 1, "girl"])
    # parent_table = BeautifulTable()
    # parent_table.column_headers = ["Heading 1", "Heading 2"]
    # parent_table.append_row(["Sample text", "Another sample text"])
    # parent_table.append_row([subtable, "More sample text"])
    # return parent_table

    repair_old_pmodels(pmodel)

    t.column_headers = ["class name", "inherits from", "attributes", "methods()", "module methods()", "is module", "class dependencies"]
    t.column_alignments["attributes"] = BeautifulTable.ALIGN_LEFT
    t.column_alignments["methods()"] = BeautifulTable.ALIGN_LEFT
    t.column_alignments["module methods()"] = BeautifulTable.ALIGN_LEFT

    have_display_module_methods_once = False

    for classname, classentry in sorted(
        list(pmodel.classlist.items()), key=lambda kv: calc_classname(kv[1])
    ):
        # Work out sub-tables first

        if classentry.classdependencytuples:
            t2 = BeautifulTable()
            for _from,_to in classentry.classdependencytuples:
                t2.append_row([_from,_to])
        else:
            t2 = ""
github abulka / pynsource / src / view / display_model.py View on Github external
if msg:
            print(msg)  # Extra explanatory info to give context re when the dump is being made

        t = BeautifulTable(max_width=260)
        t.column_headers = ["node", "coords", "widths", "shape"]
        for node in self.graph.nodes:
            name = node_name(node)
            t.append_row(
                [
                    name,
                    (node.left, node.top),
                    (node.width, node.height),
                    f"{node.shape} {self.obj_id(node.shape)} {self.get_shape_pos(node.shape)}",
                ]
            )
        t.column_alignments["node"] = BeautifulTable.ALIGN_LEFT
        t.row_separator_char = ""
        print(t)

        e = BeautifulTable(max_width=340)
        e.column_headers = ["edge", "from", "symbol", "to", "shape"]
        e.column_alignments["shape"] = BeautifulTable.ALIGN_LEFT
        e.column_alignments["from"] = BeautifulTable.ALIGN_LEFT
        e.column_alignments["to"] = BeautifulTable.ALIGN_LEFT
        for edge in self.graph.edges:
            source = node_name(edge["source"])
            target = node_name(edge["target"])
            edgetype = edgetype_colourise(edge["uml_edge_type"])
            symbol = self.edgetype_symbol(edge["uml_edge_type"])
            if edgetype == "composition":
                source, target = target, source  # around the wrong way? - fix
            shape = edge.get("shape", None)
github abulka / pynsource / src / app / cmds / diagnostics.py View on Github external
[
                "bounds",
                self.context.displaymodel.graph.GetBounds()[0],
                self.context.displaymodel.graph.GetBounds()[1],
            ]
        )
        t.append_row(["node-node overlaps", self.context.overlap_remover.CountOverlaps(), ""])
        t.append_row(
            [
                "line-line intersections, crossings",
                len(self.context.displaymodel.graph.CountLineOverLineIntersections()),
                self.context.displaymodel.graph.CountLineOverNodeCrossings()["ALL"] / 2,
            ]
        )

        t.column_alignments[0] = BeautifulTable.ALIGN_LEFT
        t.row_separator_char = ""
        print(t)
github asharov / git-hammer / githammer / summary / table.py View on Github external
def _make_table(columns):
    table = BeautifulTable()
    table.set_style(BeautifulTable.STYLE_COMPACT)
    table.column_headers = columns
    for column in columns:
        if column == 'Author':
            table.column_alignments[column] = BeautifulTable.ALIGN_LEFT
        else:
            table.column_alignments[column] = BeautifulTable.ALIGN_RIGHT
    return table