##// END OF EJS Templates
please linter
Matthias Bussonnier -
Show More
@@ -1,25 +1,22 b''
1 1 """This is an example that shows how to create new prompts for IPython
2 2 """
3 3
4 4 from IPython.terminal.prompts import Prompts, Token
5 5 import os
6 6
7 7 class MyPrompt(Prompts):
8 8
9 9 def in_prompt_tokens(self):
10 return [
11 (Token, os.getcwd()),
12 (Token.Prompt, ">>>")
13 ]
10 return [(Token, os.getcwd()), (Token.Prompt, ">>>")]
14 11
15 12
16 13 def load_ipython_extension(shell):
17 14 new_prompts = MyPrompt(shell)
18 15 new_prompts.old_prompts = shell.prompts
19 16 shell.prompts = new_prompts
20 17
21 18 def unload_ipython_extension(shell):
22 19 if not hasattr(shell.prompts, 'old_prompts'):
23 20 print("cannot unload")
24 21 else:
25 22 shell.prompts = shell.prompts.old_prompts
General Comments 0
You need to be logged in to leave comments. Login now