Branch to fix the problem of objects overwriting the enum dictionaries of previously-created objects.
The problem was that properties
is a class attribute on text_array
(or any other GeneralContainer
but text_array
is the example in the test cases), so when facility
inherits from text_array
, it also gets properties
as a class attribute that points to text_array.properties
. I understood class variables well enough, but didn't realize that they have the same exact behavior for objects of the same class as for objects of an inherited class.
The child class' class attribute can be set to not point to the parent attribute by giving it a value in the definition of the child class. The Container class factory (container.py) sets the property
attribute to an empty dictionary, then fills in the dictionary with the values from text_array.properties
(since the schema files only require the information that is different from the GeneralContainer
). Then it loops through the input schema to change/add any values that were given in the schema. This all starts in container.py on line 49.
Other changes:
property
attribute was updated after the Container
was created, right before the class factory returns the Container
class. These lines were removed.OECD Nuclear Energy Agency GitLab