TrackingDict
- class endf_parserpy.utils.debugging_utils.TrackingDict(dict_like)[source]
Class for tracking read access of elements in
dict-like objects.This class implements an interface to
dict-like objects for the purpose of tracking keys whose associated elements were retrieved. This tracking is applied recursively, hence also elements ofdict-like andlist-like objects stored within the rootdict-like object 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
intElements within
dict-like`` objects are never tracked if thedict-like object itself is stored under a key that starts with two underscores (__).If an object is
list-like, it’s elements are tracked.
The first criteria are owed to the mode of operation of the
EndfParserclass. The methodsparsefile()andwritefile()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-like objects 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 ranges of arrays.Initialize a
TrackingDictobject.