Skip to content

Commit

Permalink
remove _force_raw_types use in asdftool edit
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Jan 3, 2024
1 parent 1d86535 commit 92b12a2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions asdf/commands/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import yaml

from asdf import constants, generic_io, schema, util
from asdf._asdf import AsdfFile, open_asdf
from asdf._asdf import AsdfFile
from asdf._block import io as bio
from asdf._block.exceptions import BlockIndexError

Expand Down Expand Up @@ -259,11 +259,14 @@ def edit(path):
continue

try:
# Blocks are not read during validation, so this will not raise
# an error even though we're only opening the YAML portion of
# the file.
with open_asdf(io.BytesIO(new_content), _force_raw_types=True):
pass
# check this is an ASDF file
if new_content[: len(constants.ASDF_MAGIC)] != constants.ASDF_MAGIC:
msg = "Does not appear to be a ASDF file."
raise ValueError(msg)
# read the tagged tree (which also checks if the YAML is valid)
tagged_tree = util.load_yaml(io.BytesIO(new_content), tagged=True)
# validate the tagged tree
schema.validate(tagged_tree, reading=True)
except yaml.YAMLError as e:
print("Error: failed to parse updated YAML:")
print_exception(e)
Expand Down

0 comments on commit 92b12a2

Please sign in to comment.