This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List and use boto3 exceptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Vividict(dict): | |
""" | |
dict class which allows to set deeply nested values. Any nested dict will get autovivified. | |
Note that using defaultdict is more performant, so in case of huge datasets revert to that one. | |
However using this class and not 'closing' it after setting values might result in undesired behavior: | |
When accessing a value which is not set, no KeyError is thrown, instead it's autovivified into an empty Vividict. | |
To guarantee this doesn't happen but KeyError is thrown, dictify() needs to be called to transform the data structure | |
into regular dicts. | |