##// END OF EJS Templates
include docstring in detail_level=1 if no source is found...
include docstring in detail_level=1 if no source is found We currently display source for ?? and docstring for ?, which means less info is displayed if no source is found (e.g. compiled functions). This displays docstring for ?? as a fallback when no Source is found. This is a regression in 5.x

File last commit:

r22430:95ed0855
r23021:ebedbe27
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