Skip to content

Commit

Permalink
remove unused ignore_version_mismatch (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Aug 20, 2024
1 parent e3dc4f8 commit 45b009e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

- add grating keyword to dark and superbias schemas [#317]

- remove uses of now unused ``ignore_version_mismatch`` [#313]

2.0.0 (2024-06-24)
===================

Expand Down
3 changes: 0 additions & 3 deletions src/stdatamodels/fits_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ def from_fits(hdulist, schema, context, skip_fits_update=None, **kwargs):


def from_fits_asdf(hdulist,
ignore_version_mismatch=True,
ignore_unrecognized_tag=False,
**kwargs):
"""
Expand All @@ -742,7 +741,6 @@ def from_fits_asdf(hdulist,
except (KeyError, IndexError, AttributeError):
# This means there is no ASDF extension
return asdf.AsdfFile(
ignore_version_mismatch=ignore_version_mismatch,
ignore_unrecognized_tag=ignore_unrecognized_tag,
)

Expand All @@ -754,7 +752,6 @@ def from_fits_asdf(hdulist,
}
af = asdf.open(
generic_file,
ignore_version_mismatch=ignore_version_mismatch,
ignore_unrecognized_tag=ignore_unrecognized_tag,
ignore_missing_extensions=ignore_missing_extensions,
**akwargs
Expand Down
3 changes: 0 additions & 3 deletions src/stdatamodels/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,21 +556,18 @@ def save(self, path, dir_path=None, *args, **kwargs):

@staticmethod
def open_asdf(init=None,
ignore_version_mismatch=True,
ignore_unrecognized_tag=False,
**kwargs):
"""
Open an asdf object from a filename or create a new asdf object
"""
if isinstance(init, str):
asdffile = asdf.open(init,
ignore_version_mismatch=ignore_version_mismatch,
ignore_unrecognized_tag=ignore_unrecognized_tag,
**kwargs)

else:
asdffile = AsdfFile(init,
ignore_version_mismatch=ignore_version_mismatch,
ignore_unrecognized_tag=ignore_unrecognized_tag
)
return asdffile
Expand Down
6 changes: 2 additions & 4 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,15 @@ def test_initialize_arrays_with_arglist():

def test_open_asdf_model(tmp_path):
# Open an empty asdf file, pass extra arguments
with DataModel(ignore_version_mismatch=False, ignore_unrecognized_tag=True) as model:
assert not model._asdf._ignore_version_mismatch
with DataModel(ignore_unrecognized_tag=True) as model:
assert model._asdf._ignore_unrecognized_tag

file_path = tmp_path/"test.asdf"

with asdf.AsdfFile() as af:
af.write_to(file_path)

with DataModel(file_path, ignore_version_mismatch=False, ignore_unrecognized_tag=True) as model:
assert not model._asdf._ignore_version_mismatch
with DataModel(file_path, ignore_unrecognized_tag=True) as model:
assert model._asdf._ignore_unrecognized_tag


Expand Down

0 comments on commit 45b009e

Please sign in to comment.