diff --git a/infrahub_sdk/config.py b/infrahub_sdk/config.py index 9a27df82..2a1548c0 100644 --- a/infrahub_sdk/config.py +++ b/infrahub_sdk/config.py @@ -173,7 +173,7 @@ def logger(self) -> InfrahubLoggers: # When using structlog the logger doesn't expose the expected methods by looking at the # object to pydantic rejects them. This is a workaround to allow structlog to be used # as a logger - return self.log # type: ignore + return self.log # type: ignore[return-value] @model_validator(mode="before") @classmethod diff --git a/infrahub_sdk/query_groups.py b/infrahub_sdk/query_groups.py index fec00474..696aa260 100644 --- a/infrahub_sdk/query_groups.py +++ b/infrahub_sdk/query_groups.py @@ -168,7 +168,7 @@ async def update_group(self) -> None: return # Calculate how many nodes should be deleted - self.unused_member_ids = set(existing_group.members.peer_ids) - set(members) # type: ignore + self.unused_member_ids = list(set(existing_group.members.peer_ids) - set(members)) # type: ignore[union-attr] if not self.delete_unused_nodes: return @@ -262,7 +262,7 @@ def update_group(self) -> None: return # Calculate how many nodes should be deleted - self.unused_member_ids = set(existing_group.members.peer_ids) - set(members) # type: ignore + self.unused_member_ids = list(set(existing_group.members.peer_ids) - set(members)) # type: ignore[union-attr] if not self.delete_unused_nodes: return diff --git a/pyproject.toml b/pyproject.toml index 4a67fbf0..668048de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -164,7 +164,6 @@ ignore = [ # Rules below needs to be Investigated # ################################################################################################## "PT", # flake8-pytest-style - "PGH", # pygrep-hooks "ERA", # eradicate commented-out code "SLF001", # flake8-self "EM", # flake8-errmsg diff --git a/tests/__init__.py b/tests/__init__.py index c6ca0edb..b0e99a74 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,5 +3,5 @@ from rich import inspect as rinspect from rich import print as rprint -builtins.rprint = rprint # type: ignore -builtins.rinspect = rinspect # type: ignore +builtins.rprint = rprint # type: ignore[attr-defined] +builtins.rinspect = rinspect # type: ignore[attr-defined] diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 752f8fdc..a999d84e 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -248,7 +248,7 @@ # }, # ], # } -# return NodeSchema(**data) # type: ignore +# return NodeSchema(**data) # @pytest.fixture diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 9c48bcf9..2bb8e725 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -2,4 +2,4 @@ from rich import print as rprint -builtins.rprint = rprint # type: ignore +builtins.rprint = rprint # type: ignore[attr-defined] diff --git a/tests/unit/sdk/conftest.py b/tests/unit/sdk/conftest.py index efa4f845..76623b98 100644 --- a/tests/unit/sdk/conftest.py +++ b/tests/unit/sdk/conftest.py @@ -174,7 +174,7 @@ async def location_schema() -> NodeSchemaAPI: }, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -216,7 +216,7 @@ async def location_schema_with_dropdown() -> NodeSchemaAPI: }, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -281,7 +281,7 @@ async def schema_with_hfid() -> dict[str, NodeSchemaAPI]: ], }, } - return {k: NodeSchema(**v).convert_api() for k, v in data.items()} # type: ignore + return {k: NodeSchema(**v).convert_api() for k, v in data.items()} @pytest.fixture @@ -295,7 +295,7 @@ async def std_group_schema() -> NodeSchemaAPI: {"name": "description", "kind": "String", "optional": True}, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -679,7 +679,7 @@ async def tag_schema() -> NodeSchemaAPI: {"name": "description", "kind": "Text", "optional": True}, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -917,7 +917,7 @@ async def ipaddress_schema() -> NodeSchemaAPI: } ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -941,7 +941,7 @@ async def ipnetwork_schema() -> NodeSchemaAPI: } ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -954,7 +954,7 @@ async def ipam_ipprefix_schema() -> NodeSchemaAPI: "order_by": ["prefix_value"], "inherit_from": ["BuiltinIPAddress"], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -986,7 +986,7 @@ async def simple_device_schema() -> NodeSchemaAPI: }, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -1106,7 +1106,7 @@ async def ipaddress_pool_schema() -> NodeSchemaAPI: }, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -1165,7 +1165,7 @@ async def ipprefix_pool_schema() -> NodeSchemaAPI: }, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -1274,7 +1274,7 @@ async def device_schema() -> NodeSchemaAPI: {"name": "artifacts", "peer": "CoreArtifact", "optional": True, "cardinality": "many", "kind": "Generic"}, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture @@ -1448,7 +1448,7 @@ async def artifact_definition_schema() -> NodeSchemaAPI: {"name": "artifact_name", "kind": "Text"}, ], } - return NodeSchema(**data).convert_api() # type: ignore + return NodeSchema(**data).convert_api() @pytest.fixture diff --git a/tests/unit/sdk/test_template.py b/tests/unit/sdk/test_template.py index b8854e54..2554dc46 100644 --- a/tests/unit/sdk/test_template.py +++ b/tests/unit/sdk/test_template.py @@ -220,7 +220,7 @@ async def test_render_string_errors(test_case: JinjaTestCaseFailing) -> None: name="top-level template code", ), syntax=Syntax( - code="\n
\n