Show More
@@ -72,7 +72,7 b" subcommand 'cmd', do: `{app} cmd -h`." | |||||
72 | #----------------------------------------------------------------------------- |
|
72 | #----------------------------------------------------------------------------- | |
73 |
|
73 | |||
74 | @decorator |
|
74 | @decorator | |
75 | def catch_config(method, app, *args, **kwargs): |
|
75 | def catch_config_error(method, app, *args, **kwargs): | |
76 | """Method decorator for catching invalid config (Trait/ArgumentErrors) during init. |
|
76 | """Method decorator for catching invalid config (Trait/ArgumentErrors) during init. | |
77 |
|
77 | |||
78 | On a TraitError (generally caused by bad config), this will print the trait's |
|
78 | On a TraitError (generally caused by bad config), this will print the trait's | |
@@ -195,7 +195,7 b' class Application(SingletonConfigurable):' | |||||
195 | self._log_handler.setFormatter(self._log_formatter) |
|
195 | self._log_handler.setFormatter(self._log_formatter) | |
196 | self.log.addHandler(self._log_handler) |
|
196 | self.log.addHandler(self._log_handler) | |
197 |
|
197 | |||
198 | @catch_config |
|
198 | @catch_config_error | |
199 | def initialize(self, argv=None): |
|
199 | def initialize(self, argv=None): | |
200 | """Do the basic steps to configure me. |
|
200 | """Do the basic steps to configure me. | |
201 |
|
201 | |||
@@ -340,7 +340,7 b' class Application(SingletonConfigurable):' | |||||
340 | # events. |
|
340 | # events. | |
341 | self.config = newconfig |
|
341 | self.config = newconfig | |
342 |
|
342 | |||
343 | @catch_config |
|
343 | @catch_config_error | |
344 | def initialize_subcommand(self, subc, argv=None): |
|
344 | def initialize_subcommand(self, subc, argv=None): | |
345 | """Initialize a subcommand with argv.""" |
|
345 | """Initialize a subcommand with argv.""" | |
346 | subapp,help = self.subcommands.get(subc) |
|
346 | subapp,help = self.subcommands.get(subc) | |
@@ -400,7 +400,7 b' class Application(SingletonConfigurable):' | |||||
400 | flags[key] = (newflag, help) |
|
400 | flags[key] = (newflag, help) | |
401 | return flags, aliases |
|
401 | return flags, aliases | |
402 |
|
402 | |||
403 | @catch_config |
|
403 | @catch_config_error | |
404 | def parse_command_line(self, argv=None): |
|
404 | def parse_command_line(self, argv=None): | |
405 | """Parse the command line arguments.""" |
|
405 | """Parse the command line arguments.""" | |
406 | argv = sys.argv[1:] if argv is None else argv |
|
406 | argv = sys.argv[1:] if argv is None else argv | |
@@ -432,7 +432,7 b' class Application(SingletonConfigurable):' | |||||
432 | # store unparsed args in extra_args |
|
432 | # store unparsed args in extra_args | |
433 | self.extra_args = loader.extra_args |
|
433 | self.extra_args = loader.extra_args | |
434 |
|
434 | |||
435 | @catch_config |
|
435 | @catch_config_error | |
436 | def load_config_file(self, filename, path=None): |
|
436 | def load_config_file(self, filename, path=None): | |
437 | """Load a .py based config file by filename and path.""" |
|
437 | """Load a .py based config file by filename and path.""" | |
438 | loader = PyFileConfigLoader(filename, path=path) |
|
438 | loader = PyFileConfigLoader(filename, path=path) |
@@ -34,7 +34,7 b' import os' | |||||
34 | import shutil |
|
34 | import shutil | |
35 | import sys |
|
35 | import sys | |
36 |
|
36 | |||
37 | from IPython.config.application import Application, catch_config |
|
37 | from IPython.config.application import Application, catch_config_error | |
38 | from IPython.config.configurable import Configurable |
|
38 | from IPython.config.configurable import Configurable | |
39 | from IPython.config.loader import Config, ConfigFileNotFound |
|
39 | from IPython.config.loader import Config, ConfigFileNotFound | |
40 | from IPython.core import release, crashhandler |
|
40 | from IPython.core import release, crashhandler | |
@@ -304,7 +304,7 b' class BaseIPythonApplication(Application):' | |||||
304 | with open(fname, 'w') as f: |
|
304 | with open(fname, 'w') as f: | |
305 | f.write(s) |
|
305 | f.write(s) | |
306 |
|
306 | |||
307 | @catch_config |
|
307 | @catch_config_error | |
308 | def initialize(self, argv=None): |
|
308 | def initialize(self, argv=None): | |
309 | # don't hook up crash handler before parsing command-line |
|
309 | # don't hook up crash handler before parsing command-line | |
310 | self.parse_command_line(argv) |
|
310 | self.parse_command_line(argv) |
@@ -43,7 +43,7 b' from .handlers import (LoginHandler,' | |||||
43 | ) |
|
43 | ) | |
44 | from .notebookmanager import NotebookManager |
|
44 | from .notebookmanager import NotebookManager | |
45 |
|
45 | |||
46 | from IPython.config.application import catch_config |
|
46 | from IPython.config.application import catch_config_error | |
47 | from IPython.core.application import BaseIPythonApplication |
|
47 | from IPython.core.application import BaseIPythonApplication | |
48 | from IPython.core.profiledir import ProfileDir |
|
48 | from IPython.core.profiledir import ProfileDir | |
49 | from IPython.zmq.session import Session, default_secure |
|
49 | from IPython.zmq.session import Session, default_secure | |
@@ -261,7 +261,7 b' class NotebookApp(BaseIPythonApplication):' | |||||
261 | # and all of its ancenstors until propagate is set to False. |
|
261 | # and all of its ancenstors until propagate is set to False. | |
262 | self.log.propagate = False |
|
262 | self.log.propagate = False | |
263 |
|
263 | |||
264 | @catch_config |
|
264 | @catch_config_error | |
265 | def initialize(self, argv=None): |
|
265 | def initialize(self, argv=None): | |
266 | super(NotebookApp, self).initialize(argv) |
|
266 | super(NotebookApp, self).initialize(argv) | |
267 | self.init_configurables() |
|
267 | self.init_configurables() |
@@ -29,7 +29,7 b' import uuid' | |||||
29 | from IPython.external.qt import QtGui |
|
29 | from IPython.external.qt import QtGui | |
30 |
|
30 | |||
31 | # Local imports |
|
31 | # Local imports | |
32 | from IPython.config.application import boolean_flag, catch_config |
|
32 | from IPython.config.application import boolean_flag, catch_config_error | |
33 | from IPython.core.application import BaseIPythonApplication |
|
33 | from IPython.core.application import BaseIPythonApplication | |
34 | from IPython.core.profiledir import ProfileDir |
|
34 | from IPython.core.profiledir import ProfileDir | |
35 | from IPython.lib.kernel import tunnel_to_kernel, find_connection_file |
|
35 | from IPython.lib.kernel import tunnel_to_kernel, find_connection_file | |
@@ -516,7 +516,7 b' class IPythonQtConsoleApp(BaseIPythonApplication):' | |||||
516 | else: |
|
516 | else: | |
517 | raise IOError("Stylesheet %r not found."%self.stylesheet) |
|
517 | raise IOError("Stylesheet %r not found."%self.stylesheet) | |
518 |
|
518 | |||
519 | @catch_config |
|
519 | @catch_config_error | |
520 | def initialize(self, argv=None): |
|
520 | def initialize(self, argv=None): | |
521 | super(IPythonQtConsoleApp, self).initialize(argv) |
|
521 | super(IPythonQtConsoleApp, self).initialize(argv) | |
522 | self.init_connection_file() |
|
522 | self.init_connection_file() |
@@ -32,7 +32,7 b' import sys' | |||||
32 | from IPython.config.loader import ( |
|
32 | from IPython.config.loader import ( | |
33 | Config, PyFileConfigLoader, ConfigFileNotFound |
|
33 | Config, PyFileConfigLoader, ConfigFileNotFound | |
34 | ) |
|
34 | ) | |
35 | from IPython.config.application import boolean_flag, catch_config |
|
35 | from IPython.config.application import boolean_flag, catch_config_error | |
36 | from IPython.core import release |
|
36 | from IPython.core import release | |
37 | from IPython.core import usage |
|
37 | from IPython.core import usage | |
38 | from IPython.core.completer import Completer |
|
38 | from IPython.core.completer import Completer | |
@@ -286,7 +286,7 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||||
286 |
|
286 | |||
287 | return super(TerminalIPythonApp, self).parse_command_line(argv) |
|
287 | return super(TerminalIPythonApp, self).parse_command_line(argv) | |
288 |
|
288 | |||
289 | @catch_config |
|
289 | @catch_config_error | |
290 | def initialize(self, argv=None): |
|
290 | def initialize(self, argv=None): | |
291 | """Do actions after construct, but before starting the app.""" |
|
291 | """Do actions after construct, but before starting the app.""" | |
292 | super(TerminalIPythonApp, self).initialize(argv) |
|
292 | super(TerminalIPythonApp, self).initialize(argv) |
@@ -29,7 +29,7 b' import sys' | |||||
29 |
|
29 | |||
30 | from subprocess import Popen, PIPE |
|
30 | from subprocess import Popen, PIPE | |
31 |
|
31 | |||
32 | from IPython.config.application import catch_config |
|
32 | from IPython.config.application import catch_config_error | |
33 | from IPython.core import release |
|
33 | from IPython.core import release | |
34 | from IPython.core.crashhandler import CrashHandler |
|
34 | from IPython.core.crashhandler import CrashHandler | |
35 | from IPython.core.application import ( |
|
35 | from IPython.core.application import ( | |
@@ -145,7 +145,7 b' class BaseParallelApplication(BaseIPythonApplication):' | |||||
145 | aliases = Dict(base_aliases) |
|
145 | aliases = Dict(base_aliases) | |
146 | flags = Dict(base_flags) |
|
146 | flags = Dict(base_flags) | |
147 |
|
147 | |||
148 | @catch_config |
|
148 | @catch_config_error | |
149 | def initialize(self, argv=None): |
|
149 | def initialize(self, argv=None): | |
150 | """initialize the app""" |
|
150 | """initialize the app""" | |
151 | super(BaseParallelApplication, self).initialize(argv) |
|
151 | super(BaseParallelApplication, self).initialize(argv) |
@@ -31,7 +31,7 b' from subprocess import check_call, CalledProcessError, PIPE' | |||||
31 | import zmq |
|
31 | import zmq | |
32 | from zmq.eventloop import ioloop |
|
32 | from zmq.eventloop import ioloop | |
33 |
|
33 | |||
34 | from IPython.config.application import Application, boolean_flag, catch_config |
|
34 | from IPython.config.application import Application, boolean_flag, catch_config_error | |
35 | from IPython.config.loader import Config |
|
35 | from IPython.config.loader import Config | |
36 | from IPython.core.application import BaseIPythonApplication |
|
36 | from IPython.core.application import BaseIPythonApplication | |
37 | from IPython.core.profiledir import ProfileDir |
|
37 | from IPython.core.profiledir import ProfileDir | |
@@ -269,7 +269,7 b' class IPClusterEngines(BaseParallelApplication):' | |||||
269 | flags = Dict(engine_flags) |
|
269 | flags = Dict(engine_flags) | |
270 | _stopping = False |
|
270 | _stopping = False | |
271 |
|
271 | |||
272 | @catch_config |
|
272 | @catch_config_error | |
273 | def initialize(self, argv=None): |
|
273 | def initialize(self, argv=None): | |
274 | super(IPClusterEngines, self).initialize(argv) |
|
274 | super(IPClusterEngines, self).initialize(argv) | |
275 | self.init_signal() |
|
275 | self.init_signal() |
@@ -41,7 +41,7 b' from IPython.parallel.apps.baseapp import (' | |||||
41 | BaseParallelApplication, |
|
41 | BaseParallelApplication, | |
42 | base_aliases, |
|
42 | base_aliases, | |
43 | base_flags, |
|
43 | base_flags, | |
44 | catch_config, |
|
44 | catch_config_error, | |
45 | ) |
|
45 | ) | |
46 | from IPython.utils.importstring import import_item |
|
46 | from IPython.utils.importstring import import_item | |
47 | from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict, TraitError |
|
47 | from IPython.utils.traitlets import Instance, Unicode, Bool, List, Dict, TraitError | |
@@ -388,7 +388,7 b' class IPControllerApp(BaseParallelApplication):' | |||||
388 | self.log.addHandler(handler) |
|
388 | self.log.addHandler(handler) | |
389 | self._log_handler = handler |
|
389 | self._log_handler = handler | |
390 |
|
390 | |||
391 | @catch_config |
|
391 | @catch_config_error | |
392 | def initialize(self, argv=None): |
|
392 | def initialize(self, argv=None): | |
393 | super(IPControllerApp, self).initialize(argv) |
|
393 | super(IPControllerApp, self).initialize(argv) | |
394 | self.forward_logging() |
|
394 | self.forward_logging() |
@@ -34,7 +34,7 b' from IPython.parallel.apps.baseapp import (' | |||||
34 | BaseParallelApplication, |
|
34 | BaseParallelApplication, | |
35 | base_aliases, |
|
35 | base_aliases, | |
36 | base_flags, |
|
36 | base_flags, | |
37 | catch_config, |
|
37 | catch_config_error, | |
38 | ) |
|
38 | ) | |
39 | from IPython.zmq.log import EnginePUBHandler |
|
39 | from IPython.zmq.log import EnginePUBHandler | |
40 | from IPython.zmq.session import ( |
|
40 | from IPython.zmq.session import ( | |
@@ -319,7 +319,7 b' class IPEngineApp(BaseParallelApplication):' | |||||
319 | else: |
|
319 | else: | |
320 | mpi = None |
|
320 | mpi = None | |
321 |
|
321 | |||
322 | @catch_config |
|
322 | @catch_config_error | |
323 | def initialize(self, argv=None): |
|
323 | def initialize(self, argv=None): | |
324 | super(IPEngineApp, self).initialize(argv) |
|
324 | super(IPEngineApp, self).initialize(argv) | |
325 | self.init_mpi() |
|
325 | self.init_mpi() |
@@ -31,7 +31,7 b' from IPython.utils.traitlets import Bool, Dict, Unicode' | |||||
31 | from IPython.parallel.apps.baseapp import ( |
|
31 | from IPython.parallel.apps.baseapp import ( | |
32 | BaseParallelApplication, |
|
32 | BaseParallelApplication, | |
33 | base_aliases, |
|
33 | base_aliases, | |
34 | catch_config, |
|
34 | catch_config_error, | |
35 | ) |
|
35 | ) | |
36 | from IPython.parallel.apps.logwatcher import LogWatcher |
|
36 | from IPython.parallel.apps.logwatcher import LogWatcher | |
37 |
|
37 | |||
@@ -69,7 +69,7 b' class IPLoggerApp(BaseParallelApplication):' | |||||
69 | classes = [LogWatcher, ProfileDir] |
|
69 | classes = [LogWatcher, ProfileDir] | |
70 | aliases = Dict(aliases) |
|
70 | aliases = Dict(aliases) | |
71 |
|
71 | |||
72 | @catch_config |
|
72 | @catch_config_error | |
73 | def initialize(self, argv=None): |
|
73 | def initialize(self, argv=None): | |
74 | super(IPLoggerApp, self).initialize(argv) |
|
74 | super(IPLoggerApp, self).initialize(argv) | |
75 | self.init_watcher() |
|
75 | self.init_watcher() |
@@ -28,7 +28,7 b' import zmq' | |||||
28 |
|
28 | |||
29 | # Local imports. |
|
29 | # Local imports. | |
30 | from IPython.config.configurable import Configurable |
|
30 | from IPython.config.configurable import Configurable | |
31 | from IPython.config.application import boolean_flag, catch_config |
|
31 | from IPython.config.application import boolean_flag, catch_config_error | |
32 | from IPython.core.application import ProfileDir |
|
32 | from IPython.core.application import ProfileDir | |
33 | from IPython.core.error import StdinNotImplementedError |
|
33 | from IPython.core.error import StdinNotImplementedError | |
34 | from IPython.core.shellapp import ( |
|
34 | from IPython.core.shellapp import ( | |
@@ -731,7 +731,7 b' class IPKernelApp(KernelApp, InteractiveShellApp):' | |||||
731 | """ |
|
731 | """ | |
732 | ) |
|
732 | ) | |
733 |
|
733 | |||
734 | @catch_config |
|
734 | @catch_config_error | |
735 | def initialize(self, argv=None): |
|
735 | def initialize(self, argv=None): | |
736 | super(IPKernelApp, self).initialize(argv) |
|
736 | super(IPKernelApp, self).initialize(argv) | |
737 | self.init_shell() |
|
737 | self.init_shell() |
@@ -26,7 +26,7 b' import zmq' | |||||
26 | # IPython imports. |
|
26 | # IPython imports. | |
27 | from IPython.core.ultratb import FormattedTB |
|
27 | from IPython.core.ultratb import FormattedTB | |
28 | from IPython.core.application import ( |
|
28 | from IPython.core.application import ( | |
29 | BaseIPythonApplication, base_flags, base_aliases, catch_config |
|
29 | BaseIPythonApplication, base_flags, base_aliases, catch_config_error | |
30 | ) |
|
30 | ) | |
31 | from IPython.utils import io |
|
31 | from IPython.utils import io | |
32 | from IPython.utils.localinterfaces import LOCALHOST |
|
32 | from IPython.utils.localinterfaces import LOCALHOST | |
@@ -275,7 +275,7 b' class KernelApp(BaseIPythonApplication):' | |||||
275 | ) |
|
275 | ) | |
276 | self.kernel.record_ports(self.ports) |
|
276 | self.kernel.record_ports(self.ports) | |
277 |
|
277 | |||
278 | @catch_config |
|
278 | @catch_config_error | |
279 | def initialize(self, argv=None): |
|
279 | def initialize(self, argv=None): | |
280 | super(KernelApp, self).initialize(argv) |
|
280 | super(KernelApp, self).initialize(argv) | |
281 | self.init_blackhole() |
|
281 | self.init_blackhole() |
General Comments 0
You need to be logged in to leave comments.
Login now