@@ -108,6 +108,14 @@ def exit_raise(self, parameter_s=''):
108108 self .shell .ask_exit ()
109109
110110
111+ class _Sentinel :
112+ def __init__ (self , repr ):
113+ assert isinstance (repr , str )
114+ self .repr = repr
115+
116+ def __repr__ (self ):
117+ return repr
118+
111119
112120class InteractiveShellEmbed (TerminalInteractiveShell ):
113121
@@ -148,9 +156,9 @@ def embedded_active(self, value):
148156 self ._call_location_id )
149157
150158 def __init__ (self , ** kw ):
151- if kw . get ( 'user_global_ns' , None ) is not None :
152- raise DeprecationWarning (
153- "Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0." )
159+ assert (
160+ "user_global_ns" not in kw
161+ ), "Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0."
154162
155163 clid = kw .pop ('_init_location_id' , None )
156164 if not clid :
@@ -176,8 +184,16 @@ def init_magics(self):
176184 super (InteractiveShellEmbed , self ).init_magics ()
177185 self .register_magics (EmbeddedMagics )
178186
179- def __call__ (self , header = '' , local_ns = None , module = None , dummy = None ,
180- stack_depth = 1 , global_ns = None , compile_flags = None , ** kw ):
187+ def __call__ (
188+ self ,
189+ header = "" ,
190+ local_ns = None ,
191+ module = None ,
192+ dummy = None ,
193+ stack_depth = 1 ,
194+ compile_flags = None ,
195+ ** kw
196+ ):
181197 """Activate the interactive interpreter.
182198
183199 __call__(self,header='',local_ns=None,module=None,dummy=None) -> Start
@@ -227,8 +243,9 @@ def __call__(self, header='', local_ns=None, module=None, dummy=None,
227243
228244 # Call the embedding code with a stack depth of 1 so it can skip over
229245 # our call and get the original caller's namespaces.
230- self .mainloop (local_ns , module , stack_depth = stack_depth ,
231- global_ns = global_ns , compile_flags = compile_flags )
246+ self .mainloop (
247+ local_ns , module , stack_depth = stack_depth , compile_flags = compile_flags
248+ )
232249
233250 self .banner2 = self .old_banner2
234251
@@ -238,14 +255,19 @@ def __call__(self, header='', local_ns=None, module=None, dummy=None,
238255 if self .should_raise :
239256 raise KillEmbedded ('Embedded IPython raising error, as user requested.' )
240257
241-
242- def mainloop (self , local_ns = None , module = None , stack_depth = 0 ,
243- display_banner = None , global_ns = None , compile_flags = None ):
258+ def mainloop (
259+ self ,
260+ local_ns = None ,
261+ module = None ,
262+ stack_depth = 0 ,
263+ compile_flags = None ,
264+ ):
244265 """Embeds IPython into a running python program.
245266
246267 Parameters
247268 ----------
248269
270+
249271 local_ns, module
250272 Working local namespace (a dict) and module (a module or similar
251273 object). If given as None, they are automatically taken from the scope
@@ -266,12 +288,6 @@ def mainloop(self, local_ns=None, module=None, stack_depth=0,
266288
267289 """
268290
269- if (global_ns is not None ) and (module is None ):
270- raise DeprecationWarning ("'global_ns' keyword argument is deprecated, and has been removed in IPython 5.0 use `module` keyword argument instead." )
271-
272- if (display_banner is not None ):
273- warnings .warn ("The display_banner parameter is deprecated since IPython 4.0" , DeprecationWarning )
274-
275291 # Get locals and globals from caller
276292 if ((local_ns is None or module is None or compile_flags is None )
277293 and self .default_user_namespaces ):
0 commit comments