Simplify open#1955
Merged
Merged
Conversation
03a16e5 to
6e8f56b
Compare
fe63e17 to
3bb0535
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Simply what happens when
asdf.openis called. On main this involves:asdf.openan alias of asdf._asdf.open_asdfThis PR simplifies the process to:
asdf.openan alias of asdf._asdf.open_asdfasdf._io.open_asdf(which reads the comments, tree and blocks)As part of the simplification the following private API changes are made:
asdf._iothis may expand in future PR to encapsulate more of the "low-level" IO and is currently the new home of some code that was previously part ofAsdfFileincluding _parse_header_line _read_comment_section etcAsdfFile._fnameand instead usesAsdfFile._fd._uri(the value that was assigned inasdf.open)AsdfFile._pre_writeandAsdfFile._post_write_get_yaml_contentargument toasdf.open(unused)Requires: astropy/asdf-astropy#290EDIT: mergedThe pytest-asdf plugin had to be fixed as part of this work. This originally revealed some issues with the ndarray examples (where the external block example was only partially tested and the mask example fails to round-trip). See asdf-format/asdf-standard#475 for more details. The approach taken in this PR is to update the plugin to:
This avoids any need to roundtrip data or provide blocks (or external blocks) which ultimately improves decoupling between the example testing and the quirks of the python asdf library.
Tasks
pre-commiton your machinepyteston your machineno-changelog-entry-needed)changes/:echo "changed something" > changes/<PR#>.<changetype>.rst(see below for change types)docs/pagenews fragment change types...
changes/<PR#>.feature.rst: new featurechanges/<PR#>.bugfix.rst: bug fixchanges/<PR#>.doc.rst: documentation changechanges/<PR#>.removal.rst: deprecation or removal of public APIchanges/<PR#>.general.rst: infrastructure or miscellaneous change