From 8587e60a75b7889407d2179c4156364428627c6b Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Tue, 24 Mar 2026 09:03:03 +0100 Subject: [PATCH] Fix typing violation in extract_fields() --- infrahub_sdk/utils.py | 2 ++ pyproject.toml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/infrahub_sdk/utils.py b/infrahub_sdk/utils.py index de9bd625..4387298f 100644 --- a/infrahub_sdk/utils.py +++ b/infrahub_sdk/utils.py @@ -288,6 +288,8 @@ async def extract_fields(selection_set: SelectionSetNode | None) -> dict[str, di elif isinstance(node, InlineFragmentNode): for sub_node in node.selection_set.selections: + if not isinstance(sub_node, FieldNode): + continue sub_sub_selection_set = getattr(sub_node, "selection_set", None) value = await extract_fields(sub_sub_selection_set) if sub_node.name.value not in fields: diff --git a/pyproject.toml b/pyproject.toml index 17cafe2b..fdc2e1dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,10 +143,10 @@ include = ["infrahub_sdk/checks.py"] invalid-await = "ignore" # 1 violation [[tool.ty.overrides]] -include = ["infrahub_sdk/file_handler.py", "infrahub_sdk/utils.py"] +include = ["infrahub_sdk/file_handler.py"] [tool.ty.overrides.rules] -unresolved-attribute = "ignore" # 5 violations total (1 in file_handler.py, 4 in utils.py) +unresolved-attribute = "ignore" # 1 violation in file_handler.py (anyio type stub issue) [[tool.ty.overrides]] include = ["infrahub_sdk/transfer/**"]