Skip to content

Commit a2d9569

Browse files
authored
Merge pull request #641 from opsmill/pog-pygrep-hooks
Use specific rule codes when using noqa
2 parents 8483c5a + 3cf549f commit a2d9569

File tree

8 files changed

+21
-22
lines changed

8 files changed

+21
-22
lines changed

infrahub_sdk/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def logger(self) -> InfrahubLoggers:
173173
# When using structlog the logger doesn't expose the expected methods by looking at the
174174
# object to pydantic rejects them. This is a workaround to allow structlog to be used
175175
# as a logger
176-
return self.log # type: ignore
176+
return self.log # type: ignore[return-value]
177177

178178
@model_validator(mode="before")
179179
@classmethod

infrahub_sdk/query_groups.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def update_group(self) -> None:
168168
return
169169

170170
# Calculate how many nodes should be deleted
171-
self.unused_member_ids = set(existing_group.members.peer_ids) - set(members) # type: ignore
171+
self.unused_member_ids = list(set(existing_group.members.peer_ids) - set(members)) # type: ignore[union-attr]
172172

173173
if not self.delete_unused_nodes:
174174
return
@@ -262,7 +262,7 @@ def update_group(self) -> None:
262262
return
263263

264264
# Calculate how many nodes should be deleted
265-
self.unused_member_ids = set(existing_group.members.peer_ids) - set(members) # type: ignore
265+
self.unused_member_ids = list(set(existing_group.members.peer_ids) - set(members)) # type: ignore[union-attr]
266266

267267
if not self.delete_unused_nodes:
268268
return

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ ignore = [
164164
# Rules below needs to be Investigated #
165165
##################################################################################################
166166
"PT", # flake8-pytest-style
167-
"PGH", # pygrep-hooks
168167
"ERA", # eradicate commented-out code
169168
"SLF001", # flake8-self
170169
"EM", # flake8-errmsg

tests/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
from rich import inspect as rinspect
44
from rich import print as rprint
55

6-
builtins.rprint = rprint # type: ignore
7-
builtins.rinspect = rinspect # type: ignore
6+
builtins.rprint = rprint # type: ignore[attr-defined]
7+
builtins.rinspect = rinspect # type: ignore[attr-defined]

tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
# },
249249
# ],
250250
# }
251-
# return NodeSchema(**data) # type: ignore
251+
# return NodeSchema(**data)
252252

253253

254254
# @pytest.fixture

tests/unit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from rich import print as rprint
44

5-
builtins.rprint = rprint # type: ignore
5+
builtins.rprint = rprint # type: ignore[attr-defined]

tests/unit/sdk/conftest.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ async def location_schema() -> NodeSchemaAPI:
174174
},
175175
],
176176
}
177-
return NodeSchema(**data).convert_api() # type: ignore
177+
return NodeSchema(**data).convert_api()
178178

179179

180180
@pytest.fixture
@@ -216,7 +216,7 @@ async def location_schema_with_dropdown() -> NodeSchemaAPI:
216216
},
217217
],
218218
}
219-
return NodeSchema(**data).convert_api() # type: ignore
219+
return NodeSchema(**data).convert_api()
220220

221221

222222
@pytest.fixture
@@ -281,7 +281,7 @@ async def schema_with_hfid() -> dict[str, NodeSchemaAPI]:
281281
],
282282
},
283283
}
284-
return {k: NodeSchema(**v).convert_api() for k, v in data.items()} # type: ignore
284+
return {k: NodeSchema(**v).convert_api() for k, v in data.items()}
285285

286286

287287
@pytest.fixture
@@ -295,7 +295,7 @@ async def std_group_schema() -> NodeSchemaAPI:
295295
{"name": "description", "kind": "String", "optional": True},
296296
],
297297
}
298-
return NodeSchema(**data).convert_api() # type: ignore
298+
return NodeSchema(**data).convert_api()
299299

300300

301301
@pytest.fixture
@@ -679,7 +679,7 @@ async def tag_schema() -> NodeSchemaAPI:
679679
{"name": "description", "kind": "Text", "optional": True},
680680
],
681681
}
682-
return NodeSchema(**data).convert_api() # type: ignore
682+
return NodeSchema(**data).convert_api()
683683

684684

685685
@pytest.fixture
@@ -917,7 +917,7 @@ async def ipaddress_schema() -> NodeSchemaAPI:
917917
}
918918
],
919919
}
920-
return NodeSchema(**data).convert_api() # type: ignore
920+
return NodeSchema(**data).convert_api()
921921

922922

923923
@pytest.fixture
@@ -941,7 +941,7 @@ async def ipnetwork_schema() -> NodeSchemaAPI:
941941
}
942942
],
943943
}
944-
return NodeSchema(**data).convert_api() # type: ignore
944+
return NodeSchema(**data).convert_api()
945945

946946

947947
@pytest.fixture
@@ -954,7 +954,7 @@ async def ipam_ipprefix_schema() -> NodeSchemaAPI:
954954
"order_by": ["prefix_value"],
955955
"inherit_from": ["BuiltinIPAddress"],
956956
}
957-
return NodeSchema(**data).convert_api() # type: ignore
957+
return NodeSchema(**data).convert_api()
958958

959959

960960
@pytest.fixture
@@ -986,7 +986,7 @@ async def simple_device_schema() -> NodeSchemaAPI:
986986
},
987987
],
988988
}
989-
return NodeSchema(**data).convert_api() # type: ignore
989+
return NodeSchema(**data).convert_api()
990990

991991

992992
@pytest.fixture
@@ -1106,7 +1106,7 @@ async def ipaddress_pool_schema() -> NodeSchemaAPI:
11061106
},
11071107
],
11081108
}
1109-
return NodeSchema(**data).convert_api() # type: ignore
1109+
return NodeSchema(**data).convert_api()
11101110

11111111

11121112
@pytest.fixture
@@ -1165,7 +1165,7 @@ async def ipprefix_pool_schema() -> NodeSchemaAPI:
11651165
},
11661166
],
11671167
}
1168-
return NodeSchema(**data).convert_api() # type: ignore
1168+
return NodeSchema(**data).convert_api()
11691169

11701170

11711171
@pytest.fixture
@@ -1274,7 +1274,7 @@ async def device_schema() -> NodeSchemaAPI:
12741274
{"name": "artifacts", "peer": "CoreArtifact", "optional": True, "cardinality": "many", "kind": "Generic"},
12751275
],
12761276
}
1277-
return NodeSchema(**data).convert_api() # type: ignore
1277+
return NodeSchema(**data).convert_api()
12781278

12791279

12801280
@pytest.fixture
@@ -1448,7 +1448,7 @@ async def artifact_definition_schema() -> NodeSchemaAPI:
14481448
{"name": "artifact_name", "kind": "Text"},
14491449
],
14501450
}
1451-
return NodeSchema(**data).convert_api() # type: ignore
1451+
return NodeSchema(**data).convert_api()
14521452

14531453

14541454
@pytest.fixture

tests/unit/sdk/test_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async def test_render_string_errors(test_case: JinjaTestCaseFailing) -> None:
220220
name="top-level template code",
221221
),
222222
syntax=Syntax(
223-
code="<html>\n<body>\n<ul>\n{% for server in servers %}\n <li>{{server.name}}: {{ server.ip.primary }}</li>\n{% endfor %}\n</ul>\n\n</body>\n\n</html>\n", # noqa E501
223+
code="<html>\n<body>\n<ul>\n{% for server in servers %}\n <li>{{server.name}}: {{ server.ip.primary }}</li>\n{% endfor %}\n</ul>\n\n</body>\n\n</html>\n", # noqa: E501
224224
lexer="",
225225
),
226226
)

0 commit comments

Comments
 (0)