##// END OF EJS Templates
use `parent=self` throughout IPython...
MinRK -
Show More
@@ -72,10 +72,10 b' class MyApp(Application):'
72 72 ))
73 73
74 74 def init_foo(self):
75 self.foo = Foo(config=self.config)
75 self.foo = Foo(parent=self)
76 76
77 77 def init_bar(self):
78 self.bar = Bar(config=self.config)
78 self.bar = Bar(parent=self)
79 79
80 80
81 81 class TestApplication(TestCase):
@@ -341,7 +341,7 b' class IPythonConsoleApp(Configurable):'
341 341 stdin_port=self.stdin_port,
342 342 hb_port=self.hb_port,
343 343 connection_file=self.connection_file,
344 config=self.config,
344 parent=self,
345 345 )
346 346 self.kernel_manager.client_factory = self.kernel_client_class
347 347 self.kernel_manager.start_kernel(extra_arguments=self.kernel_argv)
@@ -371,7 +371,7 b' class IPythonConsoleApp(Configurable):'
371 371 stdin_port=self.stdin_port,
372 372 hb_port=self.hb_port,
373 373 connection_file=self.connection_file,
374 config=self.config,
374 parent=self,
375 375 )
376 376
377 377 self.kernel_client.start_channels()
@@ -114,8 +114,8 b' class AliasManager(Configurable):'
114 114 user_aliases = List(default_value=[], config=True)
115 115 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
116 116
117 def __init__(self, shell=None, config=None):
118 super(AliasManager, self).__init__(shell=shell, config=config)
117 def __init__(self, shell=None, **kwargs):
118 super(AliasManager, self).__init__(shell=shell, **kwargs)
119 119 self.alias_table = {}
120 120 self.exclude_aliases()
121 121 self.init_aliases()
@@ -246,7 +246,7 b' class Completer(Configurable):'
246 246 )
247 247
248 248
249 def __init__(self, namespace=None, global_namespace=None, config=None, **kwargs):
249 def __init__(self, namespace=None, global_namespace=None, **kwargs):
250 250 """Create a new completer for the command line.
251 251
252 252 Completer(namespace=ns,global_namespace=ns2) -> completer instance.
@@ -280,7 +280,7 b' class Completer(Configurable):'
280 280 else:
281 281 self.global_namespace = global_namespace
282 282
283 super(Completer, self).__init__(config=config, **kwargs)
283 super(Completer, self).__init__(**kwargs)
284 284
285 285 def complete(self, text, state):
286 286 """Return the next possible completion for 'text'.
@@ -50,8 +50,8 b' class DisplayHook(Configurable):'
50 50
51 51 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
52 52
53 def __init__(self, shell=None, cache_size=1000, config=None):
54 super(DisplayHook, self).__init__(shell=shell, config=config)
53 def __init__(self, shell=None, cache_size=1000, **kwargs):
54 super(DisplayHook, self).__init__(shell=shell, **kwargs)
55 55
56 56 cache_size_min = 3
57 57 if cache_size <= 0:
@@ -47,7 +47,7 b' class ExtensionManager(Configurable):'
47 47 that point, including defining new magic and aliases, adding new
48 48 components, etc.
49 49
50 You can also optionaly define an :func:`unload_ipython_extension(ipython)`
50 You can also optionally define an :func:`unload_ipython_extension(ipython)`
51 51 function, which will be called if the user unloads or reloads the extension.
52 52 The extension manager will only call :func:`load_ipython_extension` again
53 53 if the extension is reloaded.
@@ -61,8 +61,8 b' class ExtensionManager(Configurable):'
61 61
62 62 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
63 63
64 def __init__(self, shell=None, config=None):
65 super(ExtensionManager, self).__init__(shell=shell, config=config)
64 def __init__(self, shell=None, **kwargs):
65 super(ExtensionManager, self).__init__(shell=shell, **kwargs)
66 66 self.shell.on_trait_change(
67 67 self._on_ipython_dir_changed, 'ipython_dir'
68 68 )
@@ -92,7 +92,7 b' class DisplayFormatter(Configurable):'
92 92 ]
93 93 d = {}
94 94 for cls in formatter_classes:
95 f = cls(config=self.config)
95 f = cls(parent=self)
96 96 d[f.format_type] = f
97 97 return d
98 98
@@ -148,7 +148,7 b' class HistoryAccessor(Configurable):'
148 148 (self.__class__.__name__, new)
149 149 raise TraitError(msg)
150 150
151 def __init__(self, profile='default', hist_file=u'', config=None, **traits):
151 def __init__(self, profile='default', hist_file=u'', **traits):
152 152 """Create a new history accessor.
153 153
154 154 Parameters
@@ -162,7 +162,7 b' class HistoryAccessor(Configurable):'
162 162 Config object. hist_file can also be set through this.
163 163 """
164 164 # We need a pointer back to the shell for various tasks.
165 super(HistoryAccessor, self).__init__(config=config, **traits)
165 super(HistoryAccessor, self).__init__(**traits)
166 166 # defer setting hist_file from kwarg until after init,
167 167 # otherwise the default kwarg value would clobber any value
168 168 # set by config
@@ -419,13 +419,13 b' class InteractiveShell(SingletonConfigurable):'
419 419 # Tracks any GUI loop loaded for pylab
420 420 pylab_gui_select = None
421 421
422 def __init__(self, config=None, ipython_dir=None, profile_dir=None,
422 def __init__(self, ipython_dir=None, profile_dir=None,
423 423 user_module=None, user_ns=None,
424 424 custom_exceptions=((), None), **kwargs):
425 425
426 426 # This is where traits with a config_key argument are updated
427 427 # from the values on config.
428 super(InteractiveShell, self).__init__(config=config, **kwargs)
428 super(InteractiveShell, self).__init__(**kwargs)
429 429 self.configurables = [self]
430 430
431 431 # These are relatively independent and stateless
@@ -651,7 +651,7 b' class InteractiveShell(SingletonConfigurable):'
651 651 io.stderr = io.IOStream(sys.stderr)
652 652
653 653 def init_prompts(self):
654 self.prompt_manager = PromptManager(shell=self, config=self.config)
654 self.prompt_manager = PromptManager(shell=self, parent=self)
655 655 self.configurables.append(self.prompt_manager)
656 656 # Set system prompts, so that scripts can decide if they are running
657 657 # interactively.
@@ -660,24 +660,24 b' class InteractiveShell(SingletonConfigurable):'
660 660 sys.ps3 = 'Out: '
661 661
662 662 def init_display_formatter(self):
663 self.display_formatter = DisplayFormatter(config=self.config)
663 self.display_formatter = DisplayFormatter(parent=self)
664 664 self.configurables.append(self.display_formatter)
665 665
666 666 def init_display_pub(self):
667 self.display_pub = self.display_pub_class(config=self.config)
667 self.display_pub = self.display_pub_class(parent=self)
668 668 self.configurables.append(self.display_pub)
669 669
670 670 def init_data_pub(self):
671 671 if not self.data_pub_class:
672 672 self.data_pub = None
673 673 return
674 self.data_pub = self.data_pub_class(config=self.config)
674 self.data_pub = self.data_pub_class(parent=self)
675 675 self.configurables.append(self.data_pub)
676 676
677 677 def init_displayhook(self):
678 678 # Initialize displayhook, set in/out prompts and printing system
679 679 self.displayhook = self.displayhook_class(
680 config=self.config,
680 parent=self,
681 681 shell=self,
682 682 cache_size=self.cache_size,
683 683 )
@@ -688,7 +688,7 b' class InteractiveShell(SingletonConfigurable):'
688 688
689 689 def init_latextool(self):
690 690 """Configure LaTeXTool."""
691 cfg = LaTeXTool.instance(config=self.config)
691 cfg = LaTeXTool.instance(parent=self)
692 692 if cfg not in self.configurables:
693 693 self.configurables.append(cfg)
694 694
@@ -1511,7 +1511,7 b' class InteractiveShell(SingletonConfigurable):'
1511 1511
1512 1512 def init_history(self):
1513 1513 """Sets up the command history, and starts regular autosaves."""
1514 self.history_manager = HistoryManager(shell=self, config=self.config)
1514 self.history_manager = HistoryManager(shell=self, parent=self)
1515 1515 self.configurables.append(self.history_manager)
1516 1516
1517 1517 #-------------------------------------------------------------------------
@@ -1943,7 +1943,7 b' class InteractiveShell(SingletonConfigurable):'
1943 1943 global_namespace=self.user_global_ns,
1944 1944 alias_table=self.alias_manager.alias_table,
1945 1945 use_readline=self.has_readline,
1946 config=self.config,
1946 parent=self,
1947 1947 )
1948 1948 self.configurables.append(self.Completer)
1949 1949
@@ -2038,7 +2038,7 b' class InteractiveShell(SingletonConfigurable):'
2038 2038 def init_magics(self):
2039 2039 from IPython.core import magics as m
2040 2040 self.magics_manager = magic.MagicsManager(shell=self,
2041 config=self.config,
2041 parent=self,
2042 2042 user_magics=m.UserMagics(self))
2043 2043 self.configurables.append(self.magics_manager)
2044 2044
@@ -2299,7 +2299,7 b' class InteractiveShell(SingletonConfigurable):'
2299 2299 #-------------------------------------------------------------------------
2300 2300
2301 2301 def init_alias(self):
2302 self.alias_manager = AliasManager(shell=self, config=self.config)
2302 self.alias_manager = AliasManager(shell=self, parent=self)
2303 2303 self.configurables.append(self.alias_manager)
2304 2304 self.ns_table['alias'] = self.alias_manager.alias_table,
2305 2305
@@ -2308,7 +2308,7 b' class InteractiveShell(SingletonConfigurable):'
2308 2308 #-------------------------------------------------------------------------
2309 2309
2310 2310 def init_extension_manager(self):
2311 self.extension_manager = ExtensionManager(shell=self, config=self.config)
2311 self.extension_manager = ExtensionManager(shell=self, parent=self)
2312 2312 self.configurables.append(self.extension_manager)
2313 2313
2314 2314 #-------------------------------------------------------------------------
@@ -2316,7 +2316,7 b' class InteractiveShell(SingletonConfigurable):'
2316 2316 #-------------------------------------------------------------------------
2317 2317
2318 2318 def init_payload(self):
2319 self.payload_manager = PayloadManager(config=self.config)
2319 self.payload_manager = PayloadManager(parent=self)
2320 2320 self.configurables.append(self.payload_manager)
2321 2321
2322 2322 #-------------------------------------------------------------------------
@@ -2324,7 +2324,7 b' class InteractiveShell(SingletonConfigurable):'
2324 2324 #-------------------------------------------------------------------------
2325 2325
2326 2326 def init_prefilter(self):
2327 self.prefilter_manager = PrefilterManager(shell=self, config=self.config)
2327 self.prefilter_manager = PrefilterManager(shell=self, parent=self)
2328 2328 self.configurables.append(self.prefilter_manager)
2329 2329 # Ultimately this will be refactored in the new interpreter code, but
2330 2330 # for now, we should expose the main prefilter method (there's legacy
@@ -134,8 +134,8 b' class PrefilterManager(Configurable):'
134 134 multi_line_specials = CBool(True, config=True)
135 135 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
136 136
137 def __init__(self, shell=None, config=None):
138 super(PrefilterManager, self).__init__(shell=shell, config=config)
137 def __init__(self, shell=None, **kwargs):
138 super(PrefilterManager, self).__init__(shell=shell, **kwargs)
139 139 self.shell = shell
140 140 self.init_transformers()
141 141 self.init_handlers()
@@ -150,7 +150,7 b' class PrefilterManager(Configurable):'
150 150 self._transformers = []
151 151 for transformer_cls in _default_transformers:
152 152 transformer_cls(
153 shell=self.shell, prefilter_manager=self, config=self.config
153 shell=self.shell, prefilter_manager=self, parent=self
154 154 )
155 155
156 156 def sort_transformers(self):
@@ -186,7 +186,7 b' class PrefilterManager(Configurable):'
186 186 self._checkers = []
187 187 for checker in _default_checkers:
188 188 checker(
189 shell=self.shell, prefilter_manager=self, config=self.config
189 shell=self.shell, prefilter_manager=self, parent=self
190 190 )
191 191
192 192 def sort_checkers(self):
@@ -223,7 +223,7 b' class PrefilterManager(Configurable):'
223 223 self._esc_handlers = {}
224 224 for handler in _default_handlers:
225 225 handler(
226 shell=self.shell, prefilter_manager=self, config=self.config
226 shell=self.shell, prefilter_manager=self, parent=self
227 227 )
228 228
229 229 @property
@@ -368,9 +368,9 b' class PrefilterTransformer(Configurable):'
368 368 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
369 369 enabled = Bool(True, config=True)
370 370
371 def __init__(self, shell=None, prefilter_manager=None, config=None):
371 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
372 372 super(PrefilterTransformer, self).__init__(
373 shell=shell, prefilter_manager=prefilter_manager, config=config
373 shell=shell, prefilter_manager=prefilter_manager, **kwargs
374 374 )
375 375 self.prefilter_manager.register_transformer(self)
376 376
@@ -396,9 +396,9 b' class PrefilterChecker(Configurable):'
396 396 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
397 397 enabled = Bool(True, config=True)
398 398
399 def __init__(self, shell=None, prefilter_manager=None, config=None):
399 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
400 400 super(PrefilterChecker, self).__init__(
401 shell=shell, prefilter_manager=prefilter_manager, config=config
401 shell=shell, prefilter_manager=prefilter_manager, **kwargs
402 402 )
403 403 self.prefilter_manager.register_checker(self)
404 404
@@ -561,9 +561,9 b' class PrefilterHandler(Configurable):'
561 561 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
562 562 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager')
563 563
564 def __init__(self, shell=None, prefilter_manager=None, config=None):
564 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
565 565 super(PrefilterHandler, self).__init__(
566 shell=shell, prefilter_manager=prefilter_manager, config=config
566 shell=shell, prefilter_manager=prefilter_manager, **kwargs
567 567 )
568 568 self.prefilter_manager.register_handler(
569 569 self.handler_name,
@@ -318,8 +318,8 b' class PromptManager(Configurable):'
318 318 def _invisible_chars_default(self):
319 319 return {'in': 0, 'in2': 0, 'out': 0, 'rewrite':0}
320 320
321 def __init__(self, shell, config=None):
322 super(PromptManager, self).__init__(shell=shell, config=config)
321 def __init__(self, shell, **kwargs):
322 super(PromptManager, self).__init__(shell=shell, **kwargs)
323 323
324 324 # Prepare colour scheme table
325 325 self.color_scheme_table = coloransi.ColorSchemeTable([PColNoColors,
@@ -283,7 +283,7 b' def configure_inline_support(shell, backend, user_ns=None):'
283 283
284 284 user_ns = shell.user_ns if user_ns is None else user_ns
285 285
286 cfg = InlineBackend.instance(config=shell.config)
286 cfg = InlineBackend.instance(parent=shell)
287 287 cfg.shell = shell
288 288 if cfg not in shell.configurables:
289 289 shell.configurables.append(cfg)
@@ -84,7 +84,7 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):'
84 84
85 85 def open(self, kernel_id):
86 86 self.kernel_id = kernel_id.decode('ascii')
87 self.session = Session(config=self.config)
87 self.session = Session(parent=self)
88 88 self.save_on_message = self.on_message
89 89 self.on_message = self.on_first_message
90 90
@@ -522,13 +522,13 b' class NotebookApp(BaseIPythonApplication):'
522 522 # force Session default to be secure
523 523 default_secure(self.config)
524 524 self.kernel_manager = MappingKernelManager(
525 config=self.config, log=self.log, kernel_argv=self.kernel_argv,
525 parent=self, log=self.log, kernel_argv=self.kernel_argv,
526 526 connection_dir = self.profile_dir.security_dir,
527 527 )
528 528 kls = import_item(self.notebook_manager_class)
529 self.notebook_manager = kls(config=self.config, log=self.log)
529 self.notebook_manager = kls(parent=self, log=self.log)
530 530 self.notebook_manager.load_notebook_names()
531 self.cluster_manager = ClusterManager(config=self.config, log=self.log)
531 self.cluster_manager = ClusterManager(parent=self, log=self.log)
532 532 self.cluster_manager.update_profiles()
533 533
534 534 def init_logging(self):
@@ -59,7 +59,7 b' class KernelClient(LoggingConfigurable, ConnectionFileMixin):'
59 59 # The Session to use for communication with the kernel.
60 60 session = Instance(Session)
61 61 def _session_default(self):
62 return Session(config=self.config)
62 return Session(parent=self)
63 63
64 64 # The classes to use for the various channels
65 65 shell_channel_class = Type(ShellChannel)
@@ -134,7 +134,7 b' class InProcessKernel(Kernel):'
134 134
135 135 def _session_default(self):
136 136 from IPython.kernel.zmq.session import Session
137 return Session(config=self.config)
137 return Session(parent=self)
138 138
139 139 def _shell_class_default(self):
140 140 return InProcessInteractiveShell
@@ -48,7 +48,7 b' class IOLoopKernelManager(KernelManager):'
48 48 if self._restarter is None:
49 49 self._restarter = IOLoopKernelRestarter(
50 50 kernel_manager=self, loop=self.loop,
51 config=self.config, log=self.log
51 parent=self, log=self.log
52 52 )
53 53 self._restarter.start()
54 54
@@ -56,7 +56,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):'
56 56 # The Session to use for communication with the kernel.
57 57 session = Instance(Session)
58 58 def _session_default(self):
59 return Session(config=self.config)
59 return Session(parent=self)
60 60
61 61 # the class to create with our `client` method
62 62 client_class = DottedObjectName('IPython.kernel.blocking.BlockingKernelClient')
@@ -129,7 +129,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):'
129 129 kw.update(dict(
130 130 connection_file=self.connection_file,
131 131 session=self.session,
132 config=self.config,
132 parent=self,
133 133 ))
134 134
135 135 # add kwargs last, for manual overrides
@@ -110,7 +110,7 b' class MultiKernelManager(LoggingConfigurable):'
110 110 # including things like its transport and ip.
111 111 km = self.kernel_manager_factory(connection_file=os.path.join(
112 112 self.connection_dir, "kernel-%s.json" % kernel_id),
113 config=self.config, autorestart=True, log=self.log
113 parent=self, autorestart=True, log=self.log
114 114 )
115 115 km.start_kernel(**kwargs)
116 116 self._kernels[kernel_id] = km
@@ -141,7 +141,7 b' class Kernel(Configurable):'
141 141 super(Kernel, self).__init__(**kwargs)
142 142
143 143 # Initialize the InteractiveShell subclass
144 self.shell = self.shell_class.instance(config=self.config,
144 self.shell = self.shell_class.instance(parent=self,
145 145 profile_dir = self.profile_dir,
146 146 user_module = self.user_module,
147 147 user_ns = self.user_ns,
@@ -71,7 +71,7 b' kernel_aliases.update({'
71 71 'stdin' : 'IPKernelApp.stdin_port',
72 72 'control' : 'IPKernelApp.control_port',
73 73 'f' : 'IPKernelApp.connection_file',
74 'parent': 'IPKernelApp.parent',
74 'parent': 'IPKernelApp.parent_handle',
75 75 'transport': 'IPKernelApp.transport',
76 76 })
77 77 if sys.platform.startswith('win'):
@@ -172,7 +172,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
172 172 config=True, help="The importstring for the DisplayHook factory")
173 173
174 174 # polling
175 parent = Integer(0, config=True,
175 parent_handle = Integer(0, config=True,
176 176 help="""kill this process if its parent dies. On Windows, the argument
177 177 specifies the HANDLE of the parent process, otherwise it is simply boolean.
178 178 """)
@@ -188,9 +188,9 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
188 188
189 189 def init_poller(self):
190 190 if sys.platform == 'win32':
191 if self.interrupt or self.parent:
192 self.poller = ParentPollerWindows(self.interrupt, self.parent)
193 elif self.parent:
191 if self.interrupt or self.parent_handle:
192 self.poller = ParentPollerWindows(self.interrupt, self.parent_handle)
193 elif self.parent_handle:
194 194 self.poller = ParentPollerUnix()
195 195
196 196 def _bind_socket(self, s, port):
@@ -329,8 +329,8 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
329 329 # to see the connection info
330 330 for line in lines:
331 331 self.log.info(line)
332 # also raw print to the terminal if no parent (`ipython kernel`)
333 if not self.parent:
332 # also raw print to the terminal if no parent_handle (`ipython kernel`)
333 if not self.parent_handle:
334 334 for line in lines:
335 335 io.rprint(line)
336 336
@@ -341,7 +341,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
341 341 def init_session(self):
342 342 """create our session object"""
343 343 default_secure(self.config)
344 self.session = Session(config=self.config, username=u'kernel')
344 self.session = Session(parent=self, username=u'kernel')
345 345
346 346 def init_blackhole(self):
347 347 """redirects stdout/stderr to devnull if necessary"""
@@ -372,7 +372,7 b' class IPKernelApp(BaseIPythonApplication, InteractiveShellApp):'
372 372
373 373 kernel_factory = import_item(str(self.kernel_class))
374 374
375 kernel = kernel_factory(config=self.config, session=self.session,
375 kernel = kernel_factory(parent=self, session=self.session,
376 376 shell_streams=[shell_stream, control_stream],
377 377 iopub_socket=self.iopub_socket,
378 378 stdin_socket=self.stdin_socket,
@@ -338,7 +338,7 b' class IPClusterEngines(BaseParallelApplication):'
338 338 self.exit(1)
339 339
340 340 launcher = klass(
341 work_dir=u'.', config=self.config, log=self.log,
341 work_dir=u'.', parent=self, log=self.log,
342 342 profile_dir=self.profile_dir.location, cluster_id=self.cluster_id,
343 343 )
344 344 return launcher
@@ -360,7 +360,7 b' class IPEngineApp(BaseParallelApplication):'
360 360
361 361 def init_mpi(self):
362 362 global mpi
363 self.mpi = MPI(config=self.config)
363 self.mpi = MPI(parent=self)
364 364
365 365 mpi_import_statement = self.mpi.init_script
366 366 if mpi_import_statement:
@@ -76,7 +76,7 b' class IPLoggerApp(BaseParallelApplication):'
76 76
77 77 def init_watcher(self):
78 78 try:
79 self.watcher = LogWatcher(config=self.config, log=self.log)
79 self.watcher = LogWatcher(parent=self, log=self.log)
80 80 except:
81 81 self.log.error("Couldn't start the LogWatcher", exc_info=True)
82 82 self.exit(1)
@@ -385,7 +385,7 b' class LocalEngineSetLauncher(LocalEngineLauncher):'
385 385 for i in range(n):
386 386 if i > 0:
387 387 time.sleep(self.delay)
388 el = self.launcher_class(work_dir=self.work_dir, config=self.config, log=self.log,
388 el = self.launcher_class(work_dir=self.work_dir, parent=self, log=self.log,
389 389 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
390 390 )
391 391
@@ -767,7 +767,7 b' class SSHEngineSetLauncher(LocalEngineSetLauncher):'
767 767 for i in range(n):
768 768 if i > 0:
769 769 time.sleep(self.delay)
770 el = self.launcher_class(work_dir=self.work_dir, config=self.config, log=self.log,
770 el = self.launcher_class(work_dir=self.work_dir, parent=self, log=self.log,
771 771 profile_dir=self.profile_dir, cluster_id=self.cluster_id,
772 772 )
773 773 if i > 0:
@@ -922,9 +922,9 b' class WindowsHPCControllerLauncher(WindowsHPCLauncher, ClusterAppMixin):'
922 922 help="extra args to pass to ipcontroller")
923 923
924 924 def write_job_file(self, n):
925 job = IPControllerJob(config=self.config)
925 job = IPControllerJob(parent=self)
926 926
927 t = IPControllerTask(config=self.config)
927 t = IPControllerTask(parent=self)
928 928 # The tasks work directory is *not* the actual work directory of
929 929 # the controller. It is used as the base path for the stdout/stderr
930 930 # files that the scheduler redirects to.
@@ -954,10 +954,10 b' class WindowsHPCEngineSetLauncher(WindowsHPCLauncher, ClusterAppMixin):'
954 954 help="extra args to pas to ipengine")
955 955
956 956 def write_job_file(self, n):
957 job = IPEngineSetJob(config=self.config)
957 job = IPEngineSetJob(parent=self)
958 958
959 959 for i in range(n):
960 t = IPEngineTask(config=self.config)
960 t = IPEngineTask(parent=self)
961 961 # The tasks work directory is *not* the actual work directory of
962 962 # the engine. It is used as the base path for the stdout/stderr
963 963 # files that the scheduler redirects to.
@@ -300,7 +300,7 b' class HubFactory(RegistrationFactory):'
300 300 hrep = ctx.socket(zmq.ROUTER)
301 301 util.set_hwm(hrep, 0)
302 302 hrep.bind(self.engine_url('hb_pong'))
303 self.heartmonitor = HeartMonitor(loop=loop, config=self.config, log=self.log,
303 self.heartmonitor = HeartMonitor(loop=loop, parent=self, log=self.log,
304 304 pingstream=ZMQStream(hpub,loop),
305 305 pongstream=ZMQStream(hrep,loop)
306 306 )
@@ -324,7 +324,7 b' class HubFactory(RegistrationFactory):'
324 324 db_class = _db_shortcuts.get(self.db_class.lower(), self.db_class)
325 325 self.log.info('Hub using DB backend: %r', (db_class.split('.')[-1]))
326 326 self.db = import_item(str(db_class))(session=self.session.session,
327 config=self.config, log=self.log)
327 parent=self, log=self.log)
328 328 time.sleep(.25)
329 329
330 330 # resubmit stream
@@ -230,7 +230,7 b' class EngineFactory(RegistrationFactory):'
230 230 sys.displayhook = self.display_hook_factory(self.session, iopub_socket)
231 231 sys.displayhook.topic = cast_bytes('engine.%i.pyout' % self.id)
232 232
233 self.kernel = Kernel(config=self.config, int_id=self.id, ident=self.ident, session=self.session,
233 self.kernel = Kernel(parent=self, int_id=self.id, ident=self.ident, session=self.session,
234 234 control_stream=control_stream, shell_streams=shell_streams, iopub_socket=iopub_socket,
235 235 loop=loop, user_ns=self.user_ns, log=self.log)
236 236
@@ -251,7 +251,7 b' class EngineFactory(RegistrationFactory):'
251 251
252 252
253 253 # FIXME: This is a hack until IPKernelApp and IPEngineApp can be fully merged
254 app = IPKernelApp(config=self.config, shell=self.kernel.shell, kernel=self.kernel, log=self.log)
254 app = IPKernelApp(parent=self, shell=self.kernel.shell, kernel=self.kernel, log=self.log)
255 255 app.init_profile_dir()
256 256 app.init_code()
257 257
@@ -56,7 +56,7 b' class LauncherTest:'
56 56 kw = dict(
57 57 work_dir=self.profile_dir,
58 58 profile_dir=self.profile_dir,
59 config=self.config,
59 parent=self,
60 60 cluster_id='',
61 61 log=logging.getLogger(),
62 62 )
@@ -196,7 +196,7 b' class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):'
196 196 """
197 197 kernel_manager = self.kernel_manager_class(
198 198 connection_file=self._new_connection_file(),
199 config=self.config,
199 parent=self,
200 200 autorestart=True,
201 201 )
202 202 # start the kernel
@@ -37,7 +37,7 b' class QtKernelManager(KernelManager, QtKernelManagerMixin):'
37 37 if self._restarter is None:
38 38 self._restarter = QtKernelRestarter(
39 39 kernel_manager=self,
40 config=self.config,
40 parent=self,
41 41 log=self.log,
42 42 )
43 43 self._restarter.add_callback(self._handle_kernel_restarted)
@@ -112,7 +112,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
112 112 IPythonConsoleApp.initialize(self)
113 113 # relay sigint to kernel
114 114 signal.signal(signal.SIGINT, self.handle_sigint)
115 self.shell = ZMQTerminalInteractiveShell.instance(config=self.config,
115 self.shell = ZMQTerminalInteractiveShell.instance(parent=self,
116 116 display_banner=False, profile_dir=self.profile_dir,
117 117 ipython_dir=self.ipython_dir,
118 118 manager=self.kernel_manager,
@@ -337,7 +337,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
337 337 # shell.display_banner should always be False for the terminal
338 338 # based app, because we call shell.show_banner() by hand below
339 339 # so the banner shows *before* all extension loading stuff.
340 self.shell = TerminalInteractiveShell.instance(config=self.config,
340 self.shell = TerminalInteractiveShell.instance(parent=self,
341 341 display_banner=False, profile_dir=self.profile_dir,
342 342 ipython_dir=self.ipython_dir)
343 343 self.shell.configurables.append(self)
General Comments 0
You need to be logged in to leave comments. Login now