##// END OF EJS Templates
utils: coloransi: Escape Unicode U0001 and U0002 non-printable characters....
utils: coloransi: Escape Unicode U0001 and U0002 non-printable characters. Fixes #13637. These Unicode characters, would cause problems when processed by LaTeX to generate the info or PDF documentation targets. * IPython/utils/coloransi.py (InputTermColors): Escape the backslashes in \001 and \002 so that they are shown as literals '\001' and '\002' strings in the Sphinx-generated documentation rather than as non-printable Unicode characters.

File last commit:

r22430:95ed0855
r27688:f20e3b80
Show More
cwd_prompt.py
26 lines | 616 B | text/x-python | PythonLexer
"""This is an example that shows how to create new prompts for IPython
"""
from IPython.terminal.prompts import Prompts, Token
import os
class MyPrompt(Prompts):
def in_prompt_tokens(self, cli=None):
return [(Token, os.getcwd()),
(Token.Prompt, '>>>')]
def load_ipython_extension(shell):
new_prompts = MyPrompt(shell)
new_prompts.old_prompts = shell.prompts
shell.prompts = new_prompts
def unload_ipython_extension(shell):
if not hasattr(shell.prompts, 'old_prompts'):
print("cannot unload")
else:
shell.prompts = shell.prompts.old_prompts