Closed braingram closed 9 months ago
Calling merge_schemas modifies the inputs. A minimal example is as follows:
merge_schemas
import stdatamodels.jwst.datamodels.schema_editor s0 = {'title': 'a'} s1 = {'title': 'b'} merged = stdatamodels.jwst.datamodels.schema_editor.Keyword_db.merge_schemas(None, [s0, s1]) assert merged['title'] == 'b' assert s1['title'] == 'b' assert s0['title'] == 'b'
This creates an issue during combining the keywords into a schema: https://github.com/spacetelescope/stdatamodels/blob/15e5ae69d75658138960ecafac59115aad376eb6/src/stdatamodels/jwst/datamodels/schema_editor.py#L985-L987 The call to create_dict (which calls merge_schemas) modifies the schema created from the keyword files. This can be seen by stepping through the above code in pdb. After line 985 the following is False
create_dict
'subpixel_number' in keyword_db.schema['properties']['meta']['properties']['dither']['properties']['allOf'][0]
After line 986 the above is True as the first item was modified by a call to merge_schemas.
Calling
merge_schemas
modifies the inputs. A minimal example is as follows:This creates an issue during combining the keywords into a schema: https://github.com/spacetelescope/stdatamodels/blob/15e5ae69d75658138960ecafac59115aad376eb6/src/stdatamodels/jwst/datamodels/schema_editor.py#L985-L987 The call to
create_dict
(which callsmerge_schemas
) modifies the schema created from the keyword files. This can be seen by stepping through the above code in pdb. After line 985 the following is FalseAfter line 986 the above is True as the first item was modified by a call to
merge_schemas
.