##// END OF EJS Templates
Don't calculate default value when setting traitlet for the first time
Thomas Kluyver -
Show More
@@ -199,11 +199,12 b' class BaseIPythonApplication(Application):'
199 return crashhandler.crash_handler_lite(etype, evalue, tb)
199 return crashhandler.crash_handler_lite(etype, evalue, tb)
200
200
201 def _ipython_dir_changed(self, name, old, new):
201 def _ipython_dir_changed(self, name, old, new):
202 str_old = py3compat.cast_bytes_py2(os.path.abspath(old),
202 if old is not None:
203 sys.getfilesystemencoding()
203 str_old = py3compat.cast_bytes_py2(os.path.abspath(old),
204 )
204 sys.getfilesystemencoding()
205 if str_old in sys.path:
205 )
206 sys.path.remove(str_old)
206 if str_old in sys.path:
207 sys.path.remove(str_old)
207 str_path = py3compat.cast_bytes_py2(os.path.abspath(new),
208 str_path = py3compat.cast_bytes_py2(os.path.abspath(new),
208 sys.getfilesystemencoding()
209 sys.getfilesystemencoding()
209 )
210 )
@@ -13,6 +13,7 b' This module does not import anything from matplotlib.'
13 # Imports
13 # Imports
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15
15
16 from IPython.config import Config
16 from IPython.config.configurable import SingletonConfigurable
17 from IPython.config.configurable import SingletonConfigurable
17 from IPython.utils.traitlets import (
18 from IPython.utils.traitlets import (
18 Dict, Instance, CaselessStrEnum, Set, Bool, Int, TraitError, Unicode
19 Dict, Instance, CaselessStrEnum, Set, Bool, Int, TraitError, Unicode
@@ -42,7 +43,7 b' class InlineBackend(InlineBackendConfig):'
42
43
43 def _config_changed(self, name, old, new):
44 def _config_changed(self, name, old, new):
44 # warn on change of renamed config section
45 # warn on change of renamed config section
45 if new.InlineBackendConfig != old.InlineBackendConfig:
46 if new.InlineBackendConfig != getattr(old, 'InlineBackendConfig', Config()):
46 warn("InlineBackendConfig has been renamed to InlineBackend")
47 warn("InlineBackendConfig has been renamed to InlineBackend")
47 super(InlineBackend, self)._config_changed(name, old, new)
48 super(InlineBackend, self)._config_changed(name, old, new)
48
49
@@ -415,7 +415,11 b' class TraitType(object):'
415
415
416 def __set__(self, obj, value):
416 def __set__(self, obj, value):
417 new_value = self._validate(obj, value)
417 new_value = self._validate(obj, value)
418 old_value = self.__get__(obj)
418 try:
419 old_value = obj._trait_values[self.name]
420 except KeyError:
421 old_value = None
422
419 obj._trait_values[self.name] = new_value
423 obj._trait_values[self.name] = new_value
420 try:
424 try:
421 silent = bool(old_value == new_value)
425 silent = bool(old_value == new_value)
General Comments 0
You need to be logged in to leave comments. Login now