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


Python AsciiTable.table_data[1][1]方法代码示例

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


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

示例1: PrintThing

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import table_data[1][1] [as 别名]
def PrintThing(ret_cmd):
	if not options.printer:
		print "++++++++++++++++++++++++++++++"
		print "Command ID : "+str(ret_cmd[0])
		print "Command    : "+str(ret_cmd[1])+'\n'
		print "Comment    : "+str(ret_cmd[2])
		print "Tags       : "+str(ret_cmd[5])
		print "Date Added : "+str(ret_cmd[3])
		print "Added By   : "+str(ret_cmd[4])
		print "References\n__________\n"+str(ret_cmd[6].replace(',', '\n'))
		print "++++++++++++++++++++++++++++++\n"
	elif options.printer is 'p':
		print "++++++++++++++++++++++++++++++"
		print str(ret_cmd[1])+'\n'
		print str(ret_cmd[2])
		print "++++++++++++++++++++++++++++++\n"
	elif options.printer is 'd':
		print str(ret_cmd[1])
		print str(ret_cmd[2])
		print str(ret_cmd[4])
		print 'EOC'
		print str(ret_cmd[5].replace(',', '\n'))
		print 'EOT'
		print str(ret_cmd[6].replace(',', '\n'))
		print 'EOR'
	elif options.printer is 'w':
		print "= "+str(ret_cmd[2])+" = "
		print " "+str(ret_cmd[1])
		print str(ret_cmd[5].replace(',', ', '))
		print str(ret_cmd[6].replace(',', '\n'))
	elif options.printer is 'P':
		table_data = [\
			["Added By " + str(ret_cmd[4]), "Cmd ID : " + str(ret_cmd[0])],
			["Command ", str(ret_cmd[1])],
			["Comment  ", str(ret_cmd[2])],
			["Tags  ", str(ret_cmd[5]).replace(',', '\n')],
			["Date added", str(ret_cmd[3])],
			["References", str(ret_cmd[6]).replace(',', '\n')]\
			]
		table = AsciiTable(table_data)
		max_width = table.column_max_width(1)
		wrapped_string = '\n'.join(wrap(str(ret_cmd[1]), max_width))+"\n"
		table.table_data[1][1] = wrapped_string
		print table.table
	else:
		err("Please seek help")
开发者ID:silverlak3,项目名称:rtfm,代码行数:48,代码来源:rtfm.py

示例2: printable_summary

# 需要导入模块: from terminaltables import AsciiTable [as 别名]
# 或者: from terminaltables.AsciiTable import table_data[1][1] [as 别名]

#.........这里部分代码省略.........
    number_of_tests_failed:  Number of tests failed.
    exit_code:               Build exit code: 0 or 1.

    Returns
    -------
    Formatted build summary string.
    """

    header = """
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +                                                                         +
    +        N E S T   T r a v i s   C I   B u i l d   S u m m a r y          +
    +                                                                         +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    \n\n"""

    build_summary = header

    if get_num_msgs(summary_vera) > 0 or \
       get_num_msgs(summary_cppcheck) > 0 or \
       get_num_msgs(summary_format) > 0 or \
       get_num_msgs(summary_pep8) > 0:

        build_summary += '  S T A T I C   C O D E   A N A L Y S I S\n'

        # Create formatted per-file-tables of VERA++, Cppcheck, clang-format
        # and PEP8 messages.
        build_summary += code_analysis_per_file_tables(summary_vera,
                                                       summary_cppcheck,
                                                       summary_format,
                                                       summary_pep8)

    if number_of_warnings > 0:
        build_summary += '\n  W A R N I N G S\n'
        build_summary += warnings_table(summary_warnings)

    if number_of_errors > 0:
        build_summary += '\n  E R R O R S\n'
        build_summary += errors_table(summary_errors)

    build_summary += '\n\n  B U I L D   R E P O R T\n'

    summary_table = [
        ['Changed Files :', ''],
        ['', 'No files have been changed.'],
        ['Static Code Analysis :', ''],
        ['VERA++',
         convert_summary_to_status_string(summary_vera, ignore_vera) +
         '\n' + '\nNumber of messages (MSGBLD0135): ' +
         str(get_num_msgs(summary_vera))],
        ['Cppcheck',
         convert_summary_to_status_string(summary_cppcheck, ignore_cppcheck) +
         '\n' + '\nNumber of messages (MSGBLD0155): ' +
         str(get_num_msgs(summary_cppcheck))],
        ['clang-format',
         convert_summary_to_status_string(summary_format, ignore_format) +
         '\n' + '\nNumber of messages (MSGBLD0175): ' +
         str(get_num_msgs(summary_format))],
        ['PEP8',
         convert_summary_to_status_string(summary_pep8, ignore_pep8) +
         '\n' + '\nNumber of messages (MSGBLD0195): ' +
         str(get_num_msgs(summary_pep8))],
        ['NEST Build :', ''],
        ['CMake configure',
         convert_bool_value_to_status_string(status_cmake_configure)],
        ['Make', convert_bool_value_to_status_string(status_make) + '\n' +
         '\nErrors  : ' + str(number_of_errors) +
         '\nWarnings: ' + str(number_of_warnings)],
        ['Make install',
         convert_bool_value_to_status_string(status_make_install)],
        ['Make installcheck',
         convert_bool_value_to_status_string(status_tests) + '\n' +
         '\nTotal number of tests : ' + str(number_of_tests_total) +
         '\nNumber of tests failed: ' + str(number_of_tests_failed)],
        ['Artifacts :', ''],
        ['Amazon S3 upload',
         convert_bool_value_to_yes_no_string(status_amazon_s3_upload)]
    ]
    table = AsciiTable(summary_table)
    table.inner_row_border = True
    max_width = table.column_max_width(1)

    # Bypass Travis issue:  ValueError: invalid width -29 (must be > 0)
    #                       (in the wrap() below max_width must be > 0)
    # The calculation of column_max_width is based on the returned terminal
    # width which sometimes seems to be zero resulting in a negative value.
    if max_width < 0:
        max_width = 70

    table.table_data[1][1] = '\n'.join(wrap(', '.join(list_of_changed_files),
                                            max_width))

    build_summary += table.table + '\n'

    if exit_code == 0:
        build_summary += '\nBUILD TERMINATED SUCCESSFULLY'
    else:
        build_summary += '\nBUILD FAILED'

    return build_summary
开发者ID:apeyser,项目名称:nest-simulator,代码行数:104,代码来源:parse_travis_log.py


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