##// END OF EJS Templates
FIX: bare functions in callback registry on bogus unregister...
FIX: bare functions in callback registry on bogus unregister 7de483b5fdaa99fa289b418ce0efc5102287ba64 added checking for the case where the callback was wrapped by backcall, however if there are un-wrapped functions registered and a non-registered function is attempted to be unregistered then this fails by raise an uncaught AttributeError.

File last commit:

r22430:95ed0855
r24005:7775e29e
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