More dictionary methods for AthConfigFlags
The changes I made in !64979 (merged) left a few uncomfortable loose ends:
- I defined
__getitem__but no__setitem__ - The
asdict()only works for a subset of the flags, i.e.flags.A.asdict()works butflags.asdict()fails - Iterating over the flags is only possible via
which is kind of ugly and confusing
for key in flags.A.asdict(): do_something(key)
I fixed all these issues and added corresponding unit tests. One ugly thing I found, while testing this in some real AthAnalysis code, is that trying to convert all the flags to a dict will throw a lot of ModuleNotFound. For lack of a better idea I'm catching this exception in the top level asdict() function.
Might be interesting to @khoo
Goals:
-
Add __setitem__for flags -
Extend asdict()to coverAthConfigFlags, not justFlagAddress -
Support iterators, which behave like nested dictionary iterators (key iteration over the direct children) -
Test in a complete setup
Edited by Dan Guest