Skip to content

Commit

Permalink
cover missing children
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpearsonuk committed Dec 17, 2024
1 parent 3b17b56 commit ef78b4d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/ansys/fluent/core/codegen/walk_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ def walk_api(api_root_cls, on_each_path, current_path: str | List[str] = ""):
on_each_path(current_path)

# Get child names and their respective classes
child_names = getattr(api_root_cls, "child_names", [])
all_names = [
name
for attr in ("child_names", "argument_names", "command_names", "query_names")
for name in getattr(api_root_cls, attr, [])
]
child_classes = getattr(api_root_cls, "_child_classes", {})

# Traverse each child
for child_name in child_names:
for child_name in all_names:
if child_name in child_classes:
child_cls = child_classes[child_name]
# Construct the new path
Expand All @@ -46,3 +50,8 @@ def walk_api(api_root_cls, on_each_path, current_path: str | List[str] = ""):
)
# Recursively walk the child
walk_api(child_cls, on_each_path, new_path)

# Delegate directly to any child_object_type (relevant for named objects)
child_object_type = getattr(api_root_cls, "child_object_type", None)
if child_object_type:
walk_api(child_cls, on_each_path, current_path)

0 comments on commit ef78b4d

Please sign in to comment.