File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,7 @@ if args.showassign:
132132""" ,
133133 attr (0 ))
134134
135- # if args.script is not None:
136- # path = Path(args.script)
137- # if not path.exists():
138- # raise ValueError(f"script does not exist: {args.script}")
139- # exec(path.read_text())
140-
141-
142135# drop into IPython
143-
144-
145136class MyPrompt (Prompts ):
146137 def in_prompt_tokens (self , cli = None ):
147138 return [(Token .Prompt , args .prompt )]
@@ -169,16 +160,22 @@ c.InteractiveShell.prompts_class = MyPrompt
169160if args .showassign :
170161 c .InteractiveShell .ast_node_interactivity = 'last_expr_or_assign'
171162
163+ # set precision, same as %precision
164+ c .PlainTextFormatter .float_precision = "%.3f"
165+
166+ # set up a script to be executed by IPython when we get there
172167code = None
173168if args .script is not None :
174169 path = Path (args .script )
175170 if not path .exists ():
176171 raise ValueError (f"script does not exist: { args .script } " )
177172 code = path .open ('r' ).readlines ()
178173if code is None :
179- code = ["plt.ion()" ]
174+ code = [
175+ "plt.ion()" ,
176+ ]
177+
180178else :
181179 code .append ("plt.ion()" )
182-
183180c .InteractiveShellApp .exec_lines = code
184181IPython .start_ipython (config = c , user_ns = globals ())
You can’t perform that action at this time.
0 commit comments