Show More
@@ -51,7 +51,7 b' class MultipleInstanceError(ConfigurableError):' | |||
|
51 | 51 | |
|
52 | 52 | class Configurable(HasTraits): |
|
53 | 53 | |
|
54 | config = Instance(Config,(),{}) | |
|
54 | config = Instance(Config, (), {}) | |
|
55 | 55 | created = None |
|
56 | 56 | |
|
57 | 57 | def __init__(self, **kwargs): |
@@ -72,7 +72,7 b' class Configurable(HasTraits):' | |||
|
72 | 72 | |
|
73 | 73 | class MyConfigurable(Configurable): |
|
74 | 74 | def __init__(self, config=None): |
|
75 | super(MyConfigurable, self).__init__(config) | |
|
75 | super(MyConfigurable, self).__init__(config=config) | |
|
76 | 76 | # Then any other code you need to finish initialization. |
|
77 | 77 | |
|
78 | 78 | This ensures that instances will be configured properly. |
@@ -165,7 +165,7 b' class Configurable(HasTraits):' | |||
|
165 | 165 | final_help = [] |
|
166 | 166 | final_help.append(u'%s options' % cls.__name__) |
|
167 | 167 | final_help.append(len(final_help[0])*u'-') |
|
168 | for k,v in sorted(cls.class_traits(config=True).iteritems()): | |
|
168 | for k, v in sorted(cls.class_traits(config=True).iteritems()): | |
|
169 | 169 | help = cls.class_get_trait_help(v, inst) |
|
170 | 170 | final_help.append(help) |
|
171 | 171 | return '\n'.join(final_help) |
@@ -218,7 +218,7 b' class Configurable(HasTraits):' | |||
|
218 | 218 | |
|
219 | 219 | # section header |
|
220 | 220 | breaker = '#' + '-'*78 |
|
221 | s = "# %s configuration"%cls.__name__ | |
|
221 | s = "# %s configuration" % cls.__name__ | |
|
222 | 222 | lines = [breaker, s, breaker, ''] |
|
223 | 223 | # get the description trait |
|
224 | 224 | desc = cls.class_traits().get('description') |
@@ -245,7 +245,7 b' class Configurable(HasTraits):' | |||
|
245 | 245 | lines.append(c('%s will inherit config from: %s'%(cls.__name__, pstr))) |
|
246 | 246 | lines.append('') |
|
247 | 247 | |
|
248 | for name,trait in cls.class_traits(config=True).iteritems(): | |
|
248 | for name, trait in cls.class_traits(config=True).iteritems(): | |
|
249 | 249 | help = trait.get_metadata('help') or '' |
|
250 | 250 | lines.append(c(help)) |
|
251 | 251 | lines.append('# c.%s.%s = %r'%(cls.__name__, name, trait.get_default_value())) |
@@ -35,13 +35,11 b' import shutil' | |||
|
35 | 35 | import sys |
|
36 | 36 | |
|
37 | 37 | from IPython.config.application import Application, catch_config_error |
|
38 |
from IPython.config. |
|
|
39 | from IPython.config.loader import Config, ConfigFileNotFound | |
|
38 | from IPython.config.loader import ConfigFileNotFound | |
|
40 | 39 | from IPython.core import release, crashhandler |
|
41 | 40 | from IPython.core.profiledir import ProfileDir, ProfileDirError |
|
42 | 41 | from IPython.utils.path import get_ipython_dir, get_ipython_package_dir |
|
43 | 42 | from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict |
|
44 | from IPython.utils import py3compat | |
|
45 | 43 | |
|
46 | 44 | #----------------------------------------------------------------------------- |
|
47 | 45 | # Classes and functions |
@@ -245,7 +243,7 b' class BaseIPythonApplication(Application):' | |||
|
245 | 243 | p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config) |
|
246 | 244 | except ProfileDirError: |
|
247 | 245 | # not found, maybe create it (always create default profile) |
|
248 | if self.auto_create or self.profile=='default': | |
|
246 | if self.auto_create or self.profile == 'default': | |
|
249 | 247 | try: |
|
250 | 248 | p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config) |
|
251 | 249 | except ProfileDirError: |
General Comments 0
You need to be logged in to leave comments.
Login now