当前位置: 首页>>代码示例>>Python>>正文


Python AsciiTable.inner_heading_row_border方法代码示例

本文整理汇总了Python中terminaltables.AsciiTable.inner_heading_row_border方法的典型用法代码示例。如果您正苦于以下问题:Python AsciiTable.inner_heading_row_border方法的具体用法?Python AsciiTable.inner_heading_row_border怎么用?Python AsciiTable.inner_heading_row_border使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在terminaltables.AsciiTable的用法示例。


在下文中一共展示了AsciiTable.inner_heading_row_border方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: output_ascii_table_list

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def output_ascii_table_list(table_title=None,
                            table_data=None,
                            table_header=None,
                            inner_heading_row_border=False,
                            inner_row_border=False):
    """
    @type table_title: unicode
    @type table_data: list
    @type inner_heading_row_border: bool
    @type inner_row_border: bool
    @type table_header: list
    """
    console_rows, _ = get_console_dimensions()
    console_rows = int(console_rows)
    full_display_length = len(table_data) + 7
    items_per_page = console_rows - 7
    num_pages = 0
    if full_display_length > console_rows:
        try:
            num_pages = int(math.ceil(float(len(table_data)) / float(items_per_page)))
        except ZeroDivisionError:
            exit('Console too small to display.')
    if num_pages:
        running_count = 0
        for page in range(1, num_pages + 1):
            page_table_output = list()
            page_table_output.insert(0, table_header)
            upper = (console_rows + running_count) - 7
            if upper > len(table_data):
                upper = len(table_data)
            for x in range(running_count, upper):
                page_table_output.append(table_data[x])
                running_count += 1
            table = AsciiTable(page_table_output)
            table.inner_heading_row_border = inner_heading_row_border
            table.inner_row_border = inner_row_border
            table.title = table_title
            if page != 1:
                print('')
            print(table.table)
            if page < num_pages:
                input("Press Enter to continue...")
                os.system('clear')
    else:
        table_data.insert(0, table_header)
        table = AsciiTable(table_data)
        table.inner_heading_row_border = inner_heading_row_border
        table.inner_row_border = inner_row_border
        table.title = table_title
        print(table.table)
开发者ID:jonhadfield,项目名称:acli,代码行数:52,代码来源:__init__.py

示例2: home_office

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def home_office(ctx, year=CURRENT_YEAR):
    """
    Show home office expenses.

    """
    ss = open_spreadsheet('Home Office %s' % year)

    worksheet = ss.worksheet('Monthly fees')
    categories = defaultdict(Decimal)

    for row in worksheet.get_all_records():
        categories['hoa assessments'] += get_decimal(row['hoa assessments'])
        categories['homeowners insurance'] += get_decimal(row['homeowners insurance'])
        categories['mortgage'] += get_decimal(row['mortgage'])
        categories['utilities (gas & electric)'] += \
            get_decimal(row['electric']) + get_decimal(row['gas'])

    data = [(k.capitalize(), v) for k, v in categories.items()]

    data += [
        (f'Total for {year}', sum(categories.values())),
        (f'Office rent for {year}', sum(categories.values()) / 4),
        ('Repairs & maintenance', get_rm_total(ss)),
    ]
    table = AsciiTable(data, 'Home office')
    table.inner_heading_row_border = False
    print(table.table)
开发者ID:feihong,项目名称:gss-meta,代码行数:29,代码来源:tasks.py

示例3: show_license

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
 def show_license(self):
     licenses = self.metascan.get_license()
     details = []
     for lic in licenses.json().iteritems():
         details.append([str(lic[0]), str(lic[1])])
     table = AsciiTable(details, "Licenses")
     table.inner_heading_row_border = False
     print table.table
开发者ID:kovacsbalu,项目名称:viper-metascan,代码行数:10,代码来源:ms4.py

示例4: show_workflows

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
 def show_workflows(self):
     details = []
     workflows = self.metascan.get_workflows()
     for wf in workflows.json():
         details.append([wf["name"]])
     table = AsciiTable(details, "Workflows")
     table.inner_heading_row_border = False
     print table.table
开发者ID:kovacsbalu,项目名称:viper-metascan,代码行数:10,代码来源:ms4.py

示例5: print_matches

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def print_matches(matches):
    matches_arr = []
    for match in matches:
        #match_arr = [str(match[2]), str(match[3]), str(match[4]), str(match[5]), str(match[1])]
        match_arr = [str(match[2]), str(match[3]), str(match[4]), str(match[5])]
        matches_arr.append(match_arr)
    #print (matches_array)
    table = AsciiTable(matches_arr)
    table.inner_heading_row_border = False
    table.inner_row_border = True
    print (table.table)
开发者ID:madhav165,项目名称:cricscores-with-python,代码行数:13,代码来源:cricscores_old.py

示例6: output_tables

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
    def output_tables(self):
        global sectorsPassingCond
        global errorStocks

        stocksRankingTable = AsciiTable(sectorsPassingCond)
        stocksRankingTable.inner_heading_row_border = True
        logger.info('\n')
        logger.info('Potential candidates:')
        logger.info(stocksRankingTable.table)
        self.out_file.write('\n')
        self.out_file.write('Potential candidates:\n')
        self.out_file.write(stocksRankingTable.table)

        errorStocksTable = AsciiTable(errorStocks)
        errorStocksTable.inner_heading_row_border = True
        logger.info('\n')
        logger.info('Stocks with ERRORs:')
        logger.info(errorStocksTable.table)
        self.out_file.write('\n')
        self.out_file.write('Stocks with ERRORs:\n')
        self.out_file.write(errorStocksTable.table)
开发者ID:tamirgz,项目名称:SectorwiseDailyStockAnalyzer,代码行数:23,代码来源:stock_analyzer.py

示例7: checking_account

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def checking_account(ctx, year=CURRENT_YEAR):
    """
    Print business checking account metrics.

    """
    ss = open_spreadsheet('Business Checking Account Activity')
    worksheet = ss.worksheet(year)

    debit = credit = revenue = Decimal(0.0)
    categories = defaultdict(Decimal)

    rows = worksheet.get_all_records()
    for row in rows:
        category = row['Category']
        if category == 'Revenue':
            revenue += get_decimal(row['Credit'])
        else:
            categories[category] += get_decimal(row['Debit'])

        debit += get_decimal(row['Debit'])
        credit += get_decimal(row['Credit'])

    data = [
        ('Total debit', debit),
        ('Total credit', credit),
        ('Total revenue', revenue)
    ]
    table = AsciiTable(data, 'Summary')
    table.inner_heading_row_border = False
    print(table.table)


    data = sorted(categories.items(), key=lambda x: x[1], reverse=True)
    table = AsciiTable(data, 'Debits by category')
    table.inner_heading_row_border = False
    print(table.table)
开发者ID:feihong,项目名称:gss-meta,代码行数:38,代码来源:tasks.py

示例8: _get_print_info

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
    def _get_print_info(self):
        """
        Returns console-formatted table showing essential values to end user.
        """
        table_data = [
            [clrz('source', 'cyan'), clrz(self.original, 'white')],
            # [clrz('source', 'cyan'), click.style(self.original, fg='green', blink=True, bold=True)],
            [clrz('output', 'cyan'), clrz(self.output, 'white')],
            [clrz('preset', 'cyan'), clrz(self.preset_name, 'magenta')],
            [clrz('duration', 'cyan'), clrz(str(self.duration), 'red')],
            [clrz('framerate', 'cyan'), clrz(str(self.frame_rate), 'red')],
            [clrz('frames', 'cyan'), clrz(str(int(self.duration * self.frame_rate)), 'red')],
        ]

        table = AsciiTable(table_data, clrz(' FFSE - the FFS Encoder ', 'yellow'))
        table.inner_heading_row_border = False
        return table.table
开发者ID:rogerhoward,项目名称:ffse,代码行数:19,代码来源:ffse.py

示例9: output_ascii_table

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def output_ascii_table(table_title=None,
                       table_data=None,
                       inner_heading_row_border=False,
                       inner_footing_row_border=False,
                       inner_row_border=False):
    """
    @type table_title: unicode
    @type table_data: list
    @type inner_heading_row_border: bool
    @type inner_footing_row_border: bool
    @type inner_row_border: bool
    """
    table = AsciiTable(table_data)
    table.inner_heading_row_border = inner_heading_row_border
    table.inner_row_border = inner_row_border
    table.inner_footing_row_border = inner_footing_row_border
    table.title = table_title
    print(table.table)
开发者ID:jonhadfield,项目名称:acli,代码行数:20,代码来源:__init__.py

示例10: create_table

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def create_table(res_map):
    table_data = [['function', 'path_params', 'methods', 'query_params / body']]
    max_width = 30
    _data = []
    for key, value in res_map.items():
        _function = key
        pp = re.findall(r"\{(\w+)\}", value['resource'])
        _path_params = ''
        if pp:
            _path_params = ",\n".join(pp)
        _methods = ",\n".join(value['methods'])
        _remarks = '\n'.join(wrap(value['remarks'], 30))
        _data.append([_function, _path_params, _methods, _remarks])

    table_data.extend(_data)
    table_instance = AsciiTable(table_data)
    table_instance.inner_heading_row_border = True
    table_instance.inner_row_border = True
    return table_instance
开发者ID:thisisandreeeee,项目名称:py-wrapi,代码行数:21,代码来源:printers.py

示例11: info

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
    def info(self, options):
        """
        Display service status information.

        Usage: info
        """

        from terminaltables import AsciiTable
        rows = []

        for key, value in self.project.info().iteritems():
            rows.append([key + ':', value])

        table = AsciiTable(rows)
        table.outer_border = False
        table.inner_column_border = False
        table.inner_heading_row_border = False
        table.title = 'Dork status information'
        print table.table
开发者ID:sepal,项目名称:compose,代码行数:21,代码来源:injections.py

示例12: rateSectors

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
    def rateSectors(self, args):
        idx = 0
        for sector in self.sectors_list:
            logger.info("Rating sector %s..." % (sector, ))
            rating = 0
            # self.stock.plotlyData(i_destDictKey=sector)

            if self.stock.m_data['SPY']['analysis']['d']['trendType'] == self.stock.m_data[sector]['analysis']['d']['trendType'] and \
               self.stock.m_data['SPY']['analysis']['d']['trendType'] > 0 and \
               self.stock.m_data[sector]['analysis']['d']['trendType'] > 0:
                rating = rating + RATE_1_SCORE

            if not DAILY_ONLY_BASED:
                if self.stock.m_data[sector]['analysis']['d']['trendType'] == 2:  # up
                    if self.stock.m_data[sector]['analysis']['w']['moveType'] == 2:  # up
                        rating = rating + RATE_2_SCORE * 0.5
                    if self.stock.m_data['SPY']['analysis']['w']['moveType'] == 2:  # up
                        rating = rating + RATE_2_SCORE * 0.125
                    if self.stock.m_data[sector]['analysis']['m']['moveType'] == 2:  # up
                        rating = rating + RATE_2_SCORE * 0.25
                    if self.stock.m_data['SPY']['analysis']['m']['moveType'] == 2:  # up
                        rating = rating + RATE_2_SCORE * 0.125
                elif self.stock.m_data[sector]['analysis']['d']['trendType'] == 1:  # down
                    if self.stock.m_data[sector]['analysis']['w']['moveType'] == 1:  # down
                        rating = rating + RATE_2_SCORE * 0.5
                    if self.stock.m_data['SPY']['analysis']['w']['moveType'] == 1:  # down
                        rating = rating + RATE_2_SCORE * 0.125
                    if self.stock.m_data[sector]['analysis']['m']['moveType'] == 1:  # down
                        rating = rating + RATE_2_SCORE * 0.25
                    if self.stock.m_data['SPY']['analysis']['m']['moveType'] == 1:  # down
                        rating = rating + RATE_2_SCORE * 0.125

            if self.stock.m_data[sector]['analysis']['d']['rs'] >= RS_THS:
                rating = rating + RATE_3_SCORE

            if DAILY_ONLY_BASED:
                if (self.stock.m_data[sector]['analysis']['d']['trendType'] == 2) and \
                   (self.stock.m_data[sector]['analysis']['d']['moveType'] == 2):  # up
                    rating = rating + RATE_4_SCORE * 0.7
                elif (self.stock.m_data[sector]['analysis']['d']['trendType'] == 1) and \
                     (self.stock.m_data[sector]['analysis']['d']['moveType'] == 1):  # up
                    rating = rating + RATE_4_SCORE * 0.7
            else:
                if (self.stock.m_data[sector]['analysis']['d']['trendType'] == 2) and \
                   (self.stock.m_data[sector]['analysis']['d']['moveType'] == 2) and \
                   (self.stock.m_data[sector]['analysis']['w']['moveType'] == 2):  # up
                    rating = rating + RATE_4_SCORE * 0.7
                elif (self.stock.m_data[sector]['analysis']['d']['trendType'] == 1) and \
                     (self.stock.m_data[sector]['analysis']['d']['moveType'] == 1) and \
                     (self.stock.m_data[sector]['analysis']['w']['moveType'] == 1):  # up
                    rating = rating + RATE_4_SCORE * 0.7

                if (self.stock.m_data[sector]['analysis']['d']['moveType'] == 2) and \
                   (self.stock.m_data[sector]['analysis']['w']['moveType'] == 2):  # up
                    rating = rating + RATE_4_SCORE * 0.3
                elif (self.stock.m_data[sector]['analysis']['d']['moveType'] == 1) and \
                     (self.stock.m_data[sector]['analysis']['w']['moveType'] == 1):  # up
                    rating = rating + RATE_4_SCORE * 0.3

            self.sectors_rating.append(rating)
            idx += 1
        # adjust the rating threshold and pick sectors for analysis
        idx = 0
        np_array = np.asarray(self.sectors_rating)
        ANALYSIS_THS = sum(self.sectors_rating) / len(np_array[np_array > 0])
        logger.info("Adjusted ANALYSIS_THS: %d", ANALYSIS_THS)
        for sector in self.sectors_list:
            logger.info("rating[%s]: %d", sector, self.sectors_rating[idx])
            rating = self.sectors_rating[idx]
            if rating >= ANALYSIS_THS or args['_all']:
                self.sectors_to_analyze.append(idx)
                table_data.append([sector, str(rating) + '/' + str(RATE_1_SCORE+RATE_2_SCORE+RATE_3_SCORE+RATE_4_SCORE)])
            idx += 1

        rankingTable = AsciiTable(table_data)
        rankingTable.inner_heading_row_border = True
        logger.info("%s", rankingTable.table)
        self.out_file.write(rankingTable.table)
        self.out_file.write('\n')
        logger.info('\n')

        logger.debug("Sectors to be analyzed: %s", self.sectors_to_analyze)
        logger.debug("Sectors ranking: %s", self.sectors_rating)
        self.out_file.write("Sectors to be analyzed and it rank:\n")
        for sector in self.sectors_to_analyze:
            self.out_file.write("%s:%f\n" % (self.sectors_list[sector], self.sectors_rating[sector]))
开发者ID:tamirgz,项目名称:SectorwiseDailyStockAnalyzer,代码行数:88,代码来源:stock_analyzer.py

示例13: AsciiTable

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
#!/usr/bin/env python
import re
import config
import click
import subprocess
from pathlib import Path


from terminaltables import AsciiTable
table_data = [
    ['row1 column1', 'row1 column2'],
    ['row2 column1', 'row2 column2']
]
table = AsciiTable(table_data, 'title')
table.inner_heading_row_border = False
print(table.table)
开发者ID:rogerhoward,项目名称:ffse,代码行数:18,代码来源:table.py

示例14: test_attributes

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import inner_heading_row_border [as 别名]
def test_attributes():
    """Test table attributes."""
    table_data = [
        ['Name', 'Color', 'Type'],
        ['Avocado', 'green', 'nut'],
        ['Tomato', 'red', 'fruit'],
        ['Lettuce', 'green', 'vegetable'],
        ['Watermelon', 'green']
    ]
    table = AsciiTable(table_data)

    table.justify_columns[0] = 'right'
    expected = dedent("""\
        +------------+-------+-----------+
        |       Name | Color | Type      |
        +------------+-------+-----------+
        |    Avocado | green | nut       |
        |     Tomato | red   | fruit     |
        |    Lettuce | green | vegetable |
        | Watermelon | green |           |
        +------------+-------+-----------+""")
    assert expected == table.table

    table.justify_columns[2] = 'center'
    expected = dedent("""\
        +------------+-------+-----------+
        |       Name | Color |    Type   |
        +------------+-------+-----------+
        |    Avocado | green |    nut    |
        |     Tomato | red   |   fruit   |
        |    Lettuce | green | vegetable |
        | Watermelon | green |           |
        +------------+-------+-----------+""")
    assert expected == table.table

    table.inner_heading_row_border = False
    expected = dedent("""\
        +------------+-------+-----------+
        |       Name | Color |    Type   |
        |    Avocado | green |    nut    |
        |     Tomato | red   |   fruit   |
        |    Lettuce | green | vegetable |
        | Watermelon | green |           |
        +------------+-------+-----------+""")
    assert expected == table.table

    table.title = 'Foods'
    table.inner_column_border = False
    expected = dedent("""\
        +Foods-------------------------+
        |       Name  Color     Type   |
        |    Avocado  green     nut    |
        |     Tomato  red      fruit   |
        |    Lettuce  green  vegetable |
        | Watermelon  green            |
        +------------------------------+""")
    assert expected == table.table

    table.outer_border = False
    expected = (
        '       Name  Color     Type   \n'
        '    Avocado  green     nut    \n'
        '     Tomato  red      fruit   \n'
        '    Lettuce  green  vegetable \n'
        ' Watermelon  green            '
    )
    assert expected == table.table

    table.outer_border = True
    table.inner_row_border = True
    expected = dedent("""\
        +Foods-------------------------+
        |       Name  Color     Type   |
        +------------------------------+
        |    Avocado  green     nut    |
        +------------------------------+
        |     Tomato  red      fruit   |
        +------------------------------+
        |    Lettuce  green  vegetable |
        +------------------------------+
        | Watermelon  green            |
        +------------------------------+""")
    assert expected == table.table

    table.title = False
    table.inner_column_border = True
    table.inner_heading_row_border = False  # Ignored due to inner_row_border.
    table.inner_row_border = True
    expected = dedent("""\
        +------------+-------+-----------+
        |       Name | Color |    Type   |
        +------------+-------+-----------+
        |    Avocado | green |    nut    |
        +------------+-------+-----------+
        |     Tomato | red   |   fruit   |
        +------------+-------+-----------+
        |    Lettuce | green | vegetable |
        +------------+-------+-----------+
        | Watermelon | green |           |
        +------------+-------+-----------+""")
#.........这里部分代码省略.........
开发者ID:aleivag,项目名称:terminaltables,代码行数:103,代码来源:test_table.py


注:本文中的terminaltables.AsciiTable.inner_heading_row_border方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。