Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion infrahub_sdk/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def __init__(self, schema: MainSchemaTypesAPI, branch: str, data: dict | None =
# This is done to avoid confusion and potential conflicts between the IDs
self._internal_id = generate_short_id()

self.id = data.get("id", None) if isinstance(data, dict) else None
# Typed as Any to preserve pre-2.3.1 mypy behavior: newer mypy no longer collapses
# ``Any | None`` to ``Any``, which would otherwise force None-narrowing on every id use.
self.id: Any = data.get("id", None) if isinstance(data, dict) else None
Comment thread
ogenstad marked this conversation as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change where the .id previously got assigned the type Any | None. We already have multiple ignores throughout the codebase in pyproject.toml with regards to ty for this line. It's something that we'd want to clean up at some point but it won't be part of this change.

self.display_label: str | None = data.get("display_label", None) if isinstance(data, dict) else None
self.typename: str | None = data.get("__typename", schema.kind) if isinstance(data, dict) else schema.kind

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ tests = [
]
lint = [
"yamllint",
"mypy==1.11.2",
"mypy==2.3.1",
"ruff==0.15.12",
"astroid>=3.1,<4.0",
"ty==0.0.14",
Expand Down
Loading