Skip to content

Commit

Permalink
remove unused code, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Dec 24, 2024
1 parent 88f775a commit 154c2bf
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions asdf/_node_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,27 @@ def from_root_node(
key, parent, identifier, node, current_depth, extension_manager=extension_manager
)

# If this is the first node keep a reference so we can return it.
if root_info is None:
root_info = info

if parent is not None:
# Why check that __asdf_traverse__ doesn't exist here?
# If the parent has a schema and the identifier is in
# the schema we have a valid subschema for this node.
# Why does it matter if it does or doesn't support
# __asdf_traverse__ (as that only determines the
# children).
if parent.schema is not None and not traversable:
# descend within the schema of the parent
info.set_schema_for_property(parent, identifier)

# track that this node is a child of the parent
parent.children.append(info)

# Track which nodes have been seen to avoid an infinite
# loop and to find recursive references
# This is tree wide but should be per-branch.
seen.add(id(node))

# if the node has __asdf_traverse__ and a _tag attribute
Expand All @@ -314,12 +326,7 @@ def from_root_node(
# be using _tag for a non-ASDF purpose.
pass

if parent is None:
# isn't schema always None? since this is within a parent is None
# check it will only work on the root level node which won't
# have a schema...
info.schema = schema

# add children to queue
for child_identifier, child_node in get_children(t_node):
next_nodes.append((info, child_identifier, child_node))

Expand Down

0 comments on commit 154c2bf

Please sign in to comment.