From c577973854d663771782fe8dd7db27ad9e83d40e Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Wed, 14 Dec 2016 17:11:02 +0000 Subject: [PATCH] Merge class config dicts when flattening flags Closes ipython/ipython#10088 This is not a technically correct fix, but it's probably good enough for any cases in our code. The whole flatten_flags method seems like a very awkward workaround to make one priority ordering more important than another. It only 'flattens' one level of inheritance, and it ignores that parent classes may be instantiated. It skips over any parent class with multiple configurable children. --- traitlets/config/application.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/traitlets/config/application.py b/traitlets/config/application.py index 91a6f121..c682d3d9 100644 --- a/traitlets/config/application.py +++ b/traitlets/config/application.py @@ -522,7 +522,12 @@ def flatten_flags(self): # exactly one descendent, promote flag section if len(children) == 1: cls = children[0] - newflag[cls] = subdict + + if cls in newflag: + newflag[cls].update(subdict) + else: + newflag[cls] = subdict + if not isinstance(key, tuple): key = (key, ) for k in key: