Skip to content

Commit

Permalink
Merge class config dicts when flattening flags
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
takluyver committed Dec 14, 2016
1 parent b2266cc commit c577973
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion traitlets/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c577973

Please sign in to comment.