##// END OF EJS Templates
DOC: fix typo in deprecation warning (#14521)...
DOC: fix typo in deprecation warning (#14521) I'm sorry about the ridiculous level of triviality here, but just reading the message it wasn't clear at first if I need to import from `IPython` or from `IPython.display` and naturally I went with the wrong one at first. (My line was `from IPython.core.display import display`, so it wasn't obvious at first if the 'display' in the deprecation message was for the function or the module.)

File last commit:

r28566:d379f51c
r28863:6c00ceac merge
Show More
cwd_prompt.py
22 lines | 584 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):
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