Python prompt_toolkit.print_formatted_text() Examples
The following are 8
code examples of prompt_toolkit.print_formatted_text().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
prompt_toolkit
, or try the search function
.
Example #1
Source File: device.py From Facedancer with BSD 3-Clause "New" or "Revised" License | 6 votes |
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. #
Example #2
Source File: printers.py From fuzzowski with GNU General Public License v2.0 | 6 votes |
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) # --------------------------------------------------------------- #
Example #3
Source File: utils.py From aries-cloudagent-python with Apache License 2.0 | 5 votes |
def print_formatted(*args, **kwargs): prompt_toolkit.print_formatted_text(*args, **kwargs)
Example #4
Source File: base.py From hermit with Apache License 2.0 | 5 votes |
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
Example #5
Source File: base.py From hermit with Apache License 2.0 | 5 votes |
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)
Example #6
Source File: cli.py From synapse with Apache License 2.0 | 5 votes |
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 '')
Example #7
Source File: printers.py From fuzzowski with GNU General Public License v2.0 | 5 votes |
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)) # --------------------------------------------------------------- #
Example #8
Source File: printers.py From fuzzowski with GNU General Public License v2.0 | 5 votes |
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)) # --------------------------------------------------------------- #