TrackingDict
- class endf_parserpy.utils.debugging_utils.TrackingDict(dict_like)[source]
Class for tracking read access of elements in
dict_likeobjects.This class implements an interface to
dict_likeobjects for the purpose of tracking keys whose associated elements were retrieved. This tracking is applied recursively, hence also keys ofdict_likeobjects stored within the rootdict_likeobject are potentially tracked. Not all keys are tracked, though. Read access to a key is only tracked if the following two criteria are met:The key is an integer, i.e. of type
intKeys within
dict_likeobjects are never tracked if thedict_likeobject itself is stored under a key that starts with two underscores (__).
These two rules are owed to the mode of operation of the
endf_parserpy.endf_parser.EndfParserclass. The methods.parsefile()and.writefile()of theEndfParserclass will temporarily create auxiliary variables stored under keys starting with two underscores. It is not pertinent to track read access to those ephemeral objects. The purpose of theTrackingDictclass— when it comes to writing ENDF-6 formatted data—is to ensure that all elements in arrays (emulated withdict_likeobjects containing only integer keys) are accessed. Otherwise, it means that some elements have not been written to the ENDF-6 file and this situation indicates an inconsistency between counter variables and the index range of arrays.Initialize a
TrackingDictobject.- Parameters:
dict_like (dict) – The
dict_likeobject for which read access should be tracked.