MCPcopy Create free account
hub / github.com/ipython/ipython / black_reformat_handler

Function black_reformat_handler

IPython/terminal/interactiveshell.py:93–98  ·  view source on GitHub ↗
(text_before_cursor)

Source from the content-addressed store, hash-verified

91_use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty)
92
93def black_reformat_handler(text_before_cursor):
94 import black
95 formatted_text = black.format_str(text_before_cursor, mode=black.FileMode())
96 if not text_before_cursor.endswith('\n') and formatted_text.endswith('\n'):
97 formatted_text = formatted_text[:-1]
98 return formatted_text
99
100
101class TerminalInteractiveShell(InteractiveShell):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected