Skip to content

Commit 8abac2b

Browse files
committed
Correct typing on GraphQL attributes
1 parent 560c92b commit 8abac2b

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

backend/infrahub/core/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Registry:
3838
default_graphql_type: dict[str, InfrahubObject | type[BaseAttribute]] = field(default_factory=dict)
3939
graphql_type: dict = field(default_factory=lambda: defaultdict(dict))
4040
data_type: dict[str, type[InfrahubDataType]] = field(default_factory=dict)
41-
input_type: dict[str, Union[BaseAttributeCreate, BaseAttributeUpdate]] = field(default_factory=dict)
41+
input_type: dict[str, type[BaseAttributeCreate | BaseAttributeUpdate]] = field(default_factory=dict)
4242
account: dict = field(default_factory=dict)
4343
account_id: dict = field(default_factory=dict)
4444
node_group: dict = field(default_factory=dict)

backend/infrahub/graphql/mutations/attribute.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any
2+
13
from graphene import BigInt, Boolean, Field, InputObjectType, Int, String
24
from graphene.types.generic import GenericScalar
35

@@ -12,7 +14,7 @@ class BaseAttributeCreate(InputObjectType):
1214
owner = String(required=False)
1315

1416
@classmethod
15-
def __init_subclass__(cls, **kwargs) -> None:
17+
def __init_subclass__(cls, **kwargs: dict[str, Any]) -> None:
1618
super().__init_subclass__(**kwargs)
1719
registry.input_type[cls.__name__] = cls
1820

@@ -25,7 +27,7 @@ class BaseAttributeUpdate(InputObjectType):
2527
owner = String(required=False)
2628

2729
@classmethod
28-
def __init_subclass__(cls, **kwargs) -> None:
30+
def __init_subclass__(cls, **kwargs: dict[str, Any]) -> None:
2931
super().__init_subclass__(**kwargs)
3032
registry.input_type[cls.__name__] = cls
3133

pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,6 @@ ignore_errors = true
296296
module = "infrahub.git_credential.askpass"
297297
ignore_errors = true
298298

299-
[[tool.mypy.overrides]]
300-
module = "infrahub.graphql"
301-
ignore_errors = true
302-
303-
[[tool.mypy.overrides]]
304-
module = "infrahub.graphql.mutations.attribute"
305-
ignore_errors = true
306-
307299
[[tool.mypy.overrides]]
308300
module = "infrahub.graphql.mutations.ipam"
309301
ignore_errors = true

0 commit comments

Comments
 (0)