Exemplo n.º 1
0
class TraceSheet(TableSheet):
    line_nr = IntColumn()
    trace_id = CharColumn()
    cpu_id = CharColumn()
    thread_id = CharColumn()
    timestamp = CharColumn()
    time_diff = IntColumn()
Exemplo n.º 2
0
class Table_Sheet(TableSheet):
    affects_url = CharColumn()
    severity = IntColumn()
    criticality = IntColumn()
    affects_detail = CharColumn()
    vt_name = CharColumn()
    last_seen = CharColumn()
    status = CharColumn()
Exemplo n.º 3
0
    def test_rounding_required(self):
        column = IntColumn(round_value=False)

        for value in ("1.3", 1.3, 0.99999999, "-23.6"):
            with self.assertRaises(RoundingRequired):
                column._to_excel(value)

            with self.assertRaises(RoundingRequired):
                column._from_excel(FakeCell(value))

        # Does not raise
        for value in (1, 1.0, -0.0, None):
            column._to_excel(value)
            column._from_excel(FakeCell(value))
class PrettyDemoSheet(TableSheet):
    def __init__(self):
        super().__init__(title_style="Bold & red, title",
                         description_style="Extra tiny, description")

    column1 = CharColumn()
    column2 = IntColumn()
Exemplo n.º 5
0
class ColumnDemoSheet(TableSheet):
    table_name = "ColumnDemo"

    char = CharColumn(header="CharColumn")
    text = TextColumn(header="TextColumn", freeze=True)
    boolean = BoolColumn(header="BoolColumn",
                         row_style="Row, integer",
                         conditional_formatting=bold_true)
    integer = IntColumn(header="IntColumn", group=True)
    float = FloatColumn(header="FloatColumn", group=True)
    datetime = DatetimeColumn(header="DatetimeColumn", group=True)
    date = DateColumn(header="DateColumn")
    time = TimeColumn(header="TimeColumn", group=True)
    formula = FormulaColumn(header="FormulaColumn",
                            formula="=SUM(ColumnDemo[IntColumn])")
Exemplo n.º 6
0
class OrgStructureWorksheet(TableSheet):
    name = CharColumn(header="Name")
    title = CharColumn(header="Title")
    unit = CharColumn(header="Unit")
    manager = CharColumn(header="Manager",
                         getter=lambda column, obj: obj.manager.name
                         if obj.manager else "")
    level = IntColumn(header="Level")

    hide_excess_columns = False

    row_styles = [
        RowStyle(row_type=1,
                 cell_style=ExtendedStyle(None,
                                          lambda x: x + " level 1",
                                          fill=SolidFill("bbbbbb"))),
        RowStyle(row_type=2,
                 cell_style=ExtendedStyle(None,
                                          lambda x: x + " level 2",
                                          fill=SolidFill("dddddd"))),
    ]

    def row_type(self, object, row_number):
        return object.level
Exemplo n.º 7
0
 def setUp(self):
     self.column = IntColumn()
Exemplo n.º 8
0
class DemoTableSheet(TableSheet):
    column1 = CharColumn()
    column2 = IntColumn()
Exemplo n.º 9
0
class DemoTableSheet(TableSheet):
    column1 = CharColumn(header="Header 1")
    column2 = IntColumn()  # The header of column2 will be set automatically to "column2"