本文整理汇总了Python中prompt_toolkit.print_formatted_text方法的典型用法代码示例。如果您正苦于以下问题:Python prompt_toolkit.print_formatted_text方法的具体用法?Python prompt_toolkit.print_formatted_text怎么用?Python prompt_toolkit.print_formatted_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prompt_toolkit
的用法示例。
在下文中一共展示了prompt_toolkit.print_formatted_text方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_suggested_additions
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def print_suggested_additions(self):
""" Prints a collection of suggested additions to the stdout. """
sys.stdout.flush()
sys.stderr.flush()
# Create a quick printing shortcut.
print_html = lambda data : print_formatted_text(HTML(data))
# Header.
print_html("")
print_html("<b><u>Automatic Suggestions</u></b>")
print_html("These suggestions are based on simple observed behavior;")
print_html("not all of these suggestions may be useful / desireable.")
print_html("")
self._print_suggested_requests()
print_html("")
#
# Backend helpers.
#
示例2: print_packets
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def print_packets(path: list, nodes: dict) -> None:
tokens = []
for e in path[:-1]:
node = nodes[e.dst]
p = node.render()
line = '{} = {}'.format(node.name.replace('-', '_'), repr(p))
tokens.extend(list(pygments.lex(line, lexer=Python3Lexer())))
# p = self.fuzz_node.render()
node = nodes[path[-1].dst]
p = node.render()
line = '{} = {}'.format(node.name.replace('-', '_'), repr(p))
print(pygments.highlight(line, Python3Lexer(), Terminal256Formatter(style='rrt')))
# tokens.extend(list(pygments.lex(line, lexer=Python3Lexer())))
# style = style_from_pygments_cls(get_style_by_name('colorful'))
# print_formatted_text(PygmentsTokens(tokens), style=style)
# --------------------------------------------------------------- #
示例3: print_formatted
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def print_formatted(*args, **kwargs):
prompt_toolkit.print_formatted_text(*args, **kwargs)
示例4: display_request
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def display_request(self) -> None:
"""Display a signature request.
Concrete subclasses should override this method.
The contents of the signature request will already be parsed
from QR code and available as ``self.request``.
Use ``print_formatted_text`` to display the signature in a way
that readable on consoles.
"""
pass
示例5: _show_signature
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def _show_signature(self) -> None:
name = self._signature_label()
print_formatted_text(HTML("<i>Signature Data:</i> "))
print(json.dumps(self.signature, indent=2))
displayer.display_qr_code(self._serialized_signature(), name=name)
示例6: printf
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def printf(self, mesg, addnl=True, color=None):
if not self.colorsenabled:
return self.outp.printf(mesg, addnl=addnl)
# print_formatted_text can't handle \r
mesg = mesg.replace('\r', '')
if color is not None:
mesg = FormattedText([(color, mesg)])
return print_formatted_text(mesg, end='\n' if addnl else '')
示例7: print_python
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def print_python(path: list) -> None:
tokens = []
block_code = path_to_python(path)
print(pygments.highlight(block_code, Python3Lexer(), Terminal256Formatter(style='rrt')))
# tokens.extend(list(pygments.lex(block_code, lexer=Python3Lexer())))
# print_formatted_text(PygmentsTokens(tokens))
# --------------------------------------------------------------- #
示例8: print_poc
# 需要导入模块: import prompt_toolkit [as 别名]
# 或者: from prompt_toolkit import print_formatted_text [as 别名]
def print_poc(target: Target, path: list,
receive_data_after_each_request, receive_data_after_fuzz) -> None:
tokens = []
exploit_code = get_exploit_code(target, path, receive_data_after_each_request, receive_data_after_fuzz)
print(pygments.highlight(exploit_code, Python3Lexer(), Terminal256Formatter(style='rrt')))
# tokens.extend(list(pygments.lex(exploit_code, lexer=Python3Lexer())))
# print_formatted_text(PygmentsTokens(tokens))
# --------------------------------------------------------------- #