Skip to content

Commit

Permalink
rename as_tagged to tagged
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Dec 8, 2023
1 parent bb3da04 commit 877a716
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The ASDF Standard is at v1.6.0
- Deprecate ``asdf.asdf`` and ``AsdfFile.resolve_and_inline`` [#1690]

- Introduce ``asdf.util.load_yaml`` to load just the YAML contents
of an ASDF file (with the option ``as_tagged`` to load the contents
of an ASDF file (with the option ``tagged`` to load the contents
as a tree of ``asdf.tagged.Tagged`` instances to preserve tags) [#1700]

3.0.1 (2023-10-30)
Expand Down
2 changes: 1 addition & 1 deletion asdf/_tests/tags/core/tests/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_integer_storage(tmpdir, inline):
with asdf.AsdfFile(tree) as af:
af.write_to(tmpfile)

tree = asdf.util.load_yaml(tmpfile, as_tagged=True)
tree = asdf.util.load_yaml(tmpfile, tagged=True)
if inline:
assert "source" not in tree["integer"]["words"]
assert "data" in tree["integer"]["words"]
Expand Down
8 changes: 4 additions & 4 deletions asdf/_tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def test_minversion():


@pytest.mark.parametrize("input_type", ["filename", "binary_file", "generic_file"])
@pytest.mark.parametrize("as_tagged", [True, False])
def test_load_yaml(tmp_path, input_type, as_tagged):
@pytest.mark.parametrize("tagged", [True, False])
def test_load_yaml(tmp_path, input_type, tagged):
fn = tmp_path / "test.asdf"
asdf.AsdfFile({"a": np.zeros(3)}).write_to(fn)

Expand All @@ -138,8 +138,8 @@ def test_load_yaml(tmp_path, input_type, as_tagged):
ctx = init

with ctx:
tree = util.load_yaml(init, as_tagged=as_tagged)
if as_tagged:
tree = util.load_yaml(init, tagged=tagged)
if tagged:
assert isinstance(tree["a"], asdf.tagged.TaggedDict)
else:
assert not isinstance(tree["a"], asdf.tagged.TaggedDict)
6 changes: 3 additions & 3 deletions asdf/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
]


def load_yaml(init, as_tagged=False):
def load_yaml(init, tagged=False):
"""
Load just the yaml portion of an ASDF file
Expand All @@ -68,7 +68,7 @@ def load_yaml(init, as_tagged=False):
init : filename or file-like
If file-like this must be opened in binary mode.
as_tagged: bool, optional
tagged: bool, optional
Return tree with instances of `asdf.tagged.Tagged` this
can be helpful if the yaml tags are of interest.
If False, the tree will only contain basic python types
Expand All @@ -84,7 +84,7 @@ def load_yaml(init, as_tagged=False):
from .generic_io import get_file
from .yamlutil import AsdfLoader

if as_tagged:
if tagged:
loader = AsdfLoader
else:
loader = yaml.CBaseLoader if getattr(yaml, "__with_libyaml__", None) else yaml.BaseLoader
Expand Down

0 comments on commit 877a716

Please sign in to comment.