From 92d44a9dc62afd01bb4b512b7fb1bdb9c85cbf7b Mon Sep 17 00:00:00 2001 From: Damian Czajkowski Date: Thu, 5 Sep 2024 13:24:00 +0200 Subject: [PATCH] fix circular import --- ariadne_graphql_modules/__init__.py | 3 +- ariadne_graphql_modules/base.py | 19 +--- ariadne_graphql_modules/base_graphql_model.py | 13 +++ .../base_object_type/graphql_type.py | 9 +- .../compatibility_layer.py | 3 +- ariadne_graphql_modules/enum_type/__init__.py | 6 +- .../enum_type/enum_model_utils.py | 104 ++++++++++++++++++ .../enum_type/graphql_type.py | 100 +---------------- ariadne_graphql_modules/enum_type/models.py | 2 +- ariadne_graphql_modules/executable_schema.py | 3 +- .../input_type/graphql_type.py | 3 +- ariadne_graphql_modules/input_type/models.py | 2 +- .../interface_type/graphql_type.py | 3 +- .../interface_type/models.py | 2 +- .../object_type/graphql_type.py | 3 +- ariadne_graphql_modules/object_type/models.py | 2 +- .../scalar_type/graphql_type.py | 3 +- ariadne_graphql_modules/scalar_type/models.py | 2 +- .../subscription_type/graphql_type.py | 9 +- .../subscription_type/models.py | 2 +- .../union_type/graphql_type.py | 3 +- ariadne_graphql_modules/union_type/models.py | 2 +- tests/test_interface_type_validation.py | 4 +- tests/test_subscription_type.py | 16 ++- 24 files changed, 176 insertions(+), 142 deletions(-) create mode 100644 ariadne_graphql_modules/base_graphql_model.py create mode 100644 ariadne_graphql_modules/enum_type/enum_model_utils.py diff --git a/ariadne_graphql_modules/__init__.py b/ariadne_graphql_modules/__init__.py index 906aa5a..04cc176 100644 --- a/ariadne_graphql_modules/__init__.py +++ b/ariadne_graphql_modules/__init__.py @@ -1,4 +1,5 @@ -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.convert_name import ( convert_graphql_name_to_python, convert_python_name_to_graphql, diff --git a/ariadne_graphql_modules/base.py b/ariadne_graphql_modules/base.py index 8c1670b..9ef0145 100644 --- a/ariadne_graphql_modules/base.py +++ b/ariadne_graphql_modules/base.py @@ -3,7 +3,7 @@ from enum import Enum from typing import Any, Optional, Union -from graphql import GraphQLSchema, TypeDefinitionNode +from ariadne_graphql_modules.base_graphql_model import GraphQLModel class GraphQLType: @@ -35,7 +35,7 @@ def __get_graphql_name__(cls) -> str: return name @classmethod - def __get_graphql_model__(cls, metadata: "GraphQLMetadata") -> "GraphQLModel": + def __get_graphql_model__(cls, metadata: "GraphQLMetadata") -> GraphQLModel: raise NotImplementedError( "Subclasses of 'GraphQLType' must define '__get_graphql_model__'" ) @@ -48,16 +48,6 @@ def __get_graphql_types__( return [cls] -@dataclass(frozen=True) -class GraphQLModel: - name: str - ast: TypeDefinitionNode - ast_type: type[TypeDefinitionNode] - - def bind_to_schema(self, schema: GraphQLSchema): - pass - - @dataclass(frozen=True) class GraphQLMetadata: data: dict[Union[type[GraphQLType], type[Enum]], Any] = field(default_factory=dict) @@ -85,7 +75,10 @@ def get_graphql_model( if hasattr(graphql_type, "__get_graphql_model__"): self.models[graphql_type] = graphql_type.__get_graphql_model__(self) elif issubclass(graphql_type, Enum): - from ariadne_graphql_modules.enum_type import create_graphql_enum_model + # pylint: disable=import-outside-toplevel + from ariadne_graphql_modules.enum_type.enum_model_utils import ( + create_graphql_enum_model, + ) self.models[graphql_type] = create_graphql_enum_model(graphql_type) else: diff --git a/ariadne_graphql_modules/base_graphql_model.py b/ariadne_graphql_modules/base_graphql_model.py new file mode 100644 index 0000000..30ffa80 --- /dev/null +++ b/ariadne_graphql_modules/base_graphql_model.py @@ -0,0 +1,13 @@ +from dataclasses import dataclass + +from graphql import GraphQLSchema, TypeDefinitionNode + + +@dataclass(frozen=True) +class GraphQLModel: + name: str + ast: TypeDefinitionNode + ast_type: type[TypeDefinitionNode] + + def bind_to_schema(self, schema: GraphQLSchema): + pass diff --git a/ariadne_graphql_modules/base_object_type/graphql_type.py b/ariadne_graphql_modules/base_object_type/graphql_type.py index 4a78118..4b31f0d 100644 --- a/ariadne_graphql_modules/base_object_type/graphql_type.py +++ b/ariadne_graphql_modules/base_object_type/graphql_type.py @@ -14,7 +14,8 @@ StringValueNode, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.base_object_type.graphql_field import ( GraphQLClassData, GraphQLFieldData, @@ -115,9 +116,9 @@ def _create_fields_and_resolvers_with_schema( for arg_name, arg_options in final_args.items(): arg_description = get_description_node(arg_options.description) if arg_description: - args_descriptions[cls_attr.field][arg_name] = ( - arg_description - ) + args_descriptions[cls_attr.field][ + arg_name + ] = arg_description if arg_options.default_value is not None: args_defaults[cls_attr.field][arg_name] = get_value_node( diff --git a/ariadne_graphql_modules/compatibility_layer.py b/ariadne_graphql_modules/compatibility_layer.py index 1d3e117..cf2cffa 100644 --- a/ariadne_graphql_modules/compatibility_layer.py +++ b/ariadne_graphql_modules/compatibility_layer.py @@ -21,7 +21,8 @@ GraphQLSubscriptionModel, GraphQLUnionModel, ) -from ariadne_graphql_modules.base import GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.v1.bases import BaseType, BindableType from ariadne_graphql_modules.v1.directive_type import DirectiveType from ariadne_graphql_modules.v1.enum_type import EnumType diff --git a/ariadne_graphql_modules/enum_type/__init__.py b/ariadne_graphql_modules/enum_type/__init__.py index 4bf34ec..f0c3d80 100644 --- a/ariadne_graphql_modules/enum_type/__init__.py +++ b/ariadne_graphql_modules/enum_type/__init__.py @@ -1,8 +1,10 @@ -from ariadne_graphql_modules.enum_type.graphql_type import ( - GraphQLEnum, +from ariadne_graphql_modules.enum_type.enum_model_utils import ( create_graphql_enum_model, graphql_enum, ) +from ariadne_graphql_modules.enum_type.graphql_type import ( + GraphQLEnum, +) from ariadne_graphql_modules.enum_type.models import GraphQLEnumModel __all__ = [ diff --git a/ariadne_graphql_modules/enum_type/enum_model_utils.py b/ariadne_graphql_modules/enum_type/enum_model_utils.py new file mode 100644 index 0000000..23b69b2 --- /dev/null +++ b/ariadne_graphql_modules/enum_type/enum_model_utils.py @@ -0,0 +1,104 @@ +from collections.abc import Iterable +from enum import Enum +from typing import Any, Optional, cast + +from graphql import EnumTypeDefinitionNode, EnumValueDefinitionNode, NameNode + +from ariadne_graphql_modules.description import get_description_node +from ariadne_graphql_modules.enum_type.models import GraphQLEnumModel + + +def create_graphql_enum_model( # noqa: C901 + enum: type[Enum], + *, + name: Optional[str] = None, + description: Optional[str] = None, + members_descriptions: Optional[dict[str, str]] = None, + members_include: Optional[Iterable[str]] = None, + members_exclude: Optional[Iterable[str]] = None, +) -> "GraphQLEnumModel": + if members_include and members_exclude: + raise ValueError( + "'members_include' and 'members_exclude' options are mutually exclusive." + ) + + if hasattr(enum, "__get_graphql_model__"): + return cast(GraphQLEnumModel, enum.__get_graphql_model__()) + + if not name: + if hasattr(enum, "__get_graphql_name__"): + name = cast("str", enum.__get_graphql_name__()) + else: + name = enum.__name__ + + members: dict[str, Any] = {i.name: i for i in enum} + final_members: dict[str, Any] = {} + + if members_include: + for key, value in members.items(): + if key in members_include: + final_members[key] = value + elif members_exclude: + for key, value in members.items(): + if key not in members_exclude: + final_members[key] = value + else: + final_members = members + + members_descriptions = members_descriptions or {} + for member in members_descriptions: + if member not in final_members: + raise ValueError( + f"Member description was specified for a member '{member}' " + "not present in final GraphQL enum." + ) + + return GraphQLEnumModel( + name=name, + members=final_members, + ast_type=EnumTypeDefinitionNode, + ast=EnumTypeDefinitionNode( + name=NameNode(value=name), + description=get_description_node(description), + values=tuple( + EnumValueDefinitionNode( + name=NameNode(value=value_name), + description=get_description_node( + members_descriptions.get(value_name) + ), + ) + for value_name in final_members + ), + ), + ) + + +def graphql_enum( + cls=None, + *, + name: Optional[str] = None, + description: Optional[str] = None, + members_descriptions: Optional[dict[str, str]] = None, + members_include: Optional[Iterable[str]] = None, + members_exclude: Optional[Iterable[str]] = None, +): + def graphql_enum_decorator(cls): + graphql_model = create_graphql_enum_model( + cls, + name=name, + description=description, + members_descriptions=members_descriptions, + members_include=members_include, + members_exclude=members_exclude, + ) + + def __get_graphql_model__(*_) -> GraphQLEnumModel: # noqa: N807 + return graphql_model + + setattr(cls, "__get_graphql_model__", classmethod(__get_graphql_model__)) + return cls + + if cls: + return graphql_enum_decorator(cls) + + return graphql_enum_decorator diff --git a/ariadne_graphql_modules/enum_type/graphql_type.py b/ariadne_graphql_modules/enum_type/graphql_type.py index 3f7c764..702432f 100644 --- a/ariadne_graphql_modules/enum_type/graphql_type.py +++ b/ariadne_graphql_modules/enum_type/graphql_type.py @@ -1,4 +1,3 @@ -from collections.abc import Iterable from enum import Enum from inspect import isclass from typing import Any, Optional, Union, cast @@ -141,8 +140,7 @@ def _validate_enum_type_with_schema(cls): validate_description(cls, definition) members_names = { - value.name.value - for value in definition.values # pylint: disable=no-member + value.name.value for value in definition.values # pylint: disable=no-member } if not members_names: raise ValueError( @@ -251,99 +249,3 @@ def get_members_set( f"Expected members to be of type Dict[str, Any], List[str], or Enum." f"Got {type(members).__name__} instead." ) - - -def create_graphql_enum_model( # noqa: C901 - enum: type[Enum], - *, - name: Optional[str] = None, - description: Optional[str] = None, - members_descriptions: Optional[dict[str, str]] = None, - members_include: Optional[Iterable[str]] = None, - members_exclude: Optional[Iterable[str]] = None, -) -> "GraphQLEnumModel": - if members_include and members_exclude: - raise ValueError( - "'members_include' and 'members_exclude' options are mutually exclusive." - ) - - if hasattr(enum, "__get_graphql_model__"): - return cast(GraphQLEnumModel, enum.__get_graphql_model__()) - - if not name: - if hasattr(enum, "__get_graphql_name__"): - name = cast("str", enum.__get_graphql_name__()) - else: - name = enum.__name__ - - members: dict[str, Any] = {i.name: i for i in enum} - final_members: dict[str, Any] = {} - - if members_include: - for key, value in members.items(): - if key in members_include: - final_members[key] = value - elif members_exclude: - for key, value in members.items(): - if key not in members_exclude: - final_members[key] = value - else: - final_members = members - - members_descriptions = members_descriptions or {} - for member in members_descriptions: - if member not in final_members: - raise ValueError( - f"Member description was specified for a member '{member}' " - "not present in final GraphQL enum." - ) - - return GraphQLEnumModel( - name=name, - members=final_members, - ast_type=EnumTypeDefinitionNode, - ast=EnumTypeDefinitionNode( - name=NameNode(value=name), - description=get_description_node(description), - values=tuple( - EnumValueDefinitionNode( - name=NameNode(value=value_name), - description=get_description_node( - members_descriptions.get(value_name) - ), - ) - for value_name in final_members - ), - ), - ) - - -def graphql_enum( - cls=None, - *, - name: Optional[str] = None, - description: Optional[str] = None, - members_descriptions: Optional[dict[str, str]] = None, - members_include: Optional[Iterable[str]] = None, - members_exclude: Optional[Iterable[str]] = None, -): - def graphql_enum_decorator(cls): - graphql_model = create_graphql_enum_model( - cls, - name=name, - description=description, - members_descriptions=members_descriptions, - members_include=members_include, - members_exclude=members_exclude, - ) - - def __get_graphql_model__(*_) -> GraphQLEnumModel: # noqa: N807 - return graphql_model - - setattr(cls, "__get_graphql_model__", classmethod(__get_graphql_model__)) - return cls - - if cls: - return graphql_enum_decorator(cls) - - return graphql_enum_decorator diff --git a/ariadne_graphql_modules/enum_type/models.py b/ariadne_graphql_modules/enum_type/models.py index 2b30e93..6ccbd08 100644 --- a/ariadne_graphql_modules/enum_type/models.py +++ b/ariadne_graphql_modules/enum_type/models.py @@ -4,7 +4,7 @@ from ariadne import EnumType from graphql import GraphQLSchema -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/executable_schema.py b/ariadne_graphql_modules/executable_schema.py index f2bae53..fa40b99 100644 --- a/ariadne_graphql_modules/executable_schema.py +++ b/ariadne_graphql_modules/executable_schema.py @@ -19,7 +19,8 @@ parse, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.roots import ROOTS_NAMES, merge_root_nodes from ariadne_graphql_modules.sort import sort_schema_document diff --git a/ariadne_graphql_modules/input_type/graphql_type.py b/ariadne_graphql_modules/input_type/graphql_type.py index 14496aa..4057898 100644 --- a/ariadne_graphql_modules/input_type/graphql_type.py +++ b/ariadne_graphql_modules/input_type/graphql_type.py @@ -5,7 +5,8 @@ from graphql import InputObjectTypeDefinitionNode, InputValueDefinitionNode, NameNode -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.convert_name import ( convert_graphql_name_to_python, convert_python_name_to_graphql, diff --git a/ariadne_graphql_modules/input_type/models.py b/ariadne_graphql_modules/input_type/models.py index 5e21480..bcffa56 100644 --- a/ariadne_graphql_modules/input_type/models.py +++ b/ariadne_graphql_modules/input_type/models.py @@ -4,7 +4,7 @@ from ariadne import InputType as InputTypeBindable from graphql import GraphQLSchema -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/interface_type/graphql_type.py b/ariadne_graphql_modules/interface_type/graphql_type.py index e06b90a..a1da0e5 100644 --- a/ariadne_graphql_modules/interface_type/graphql_type.py +++ b/ariadne_graphql_modules/interface_type/graphql_type.py @@ -8,7 +8,8 @@ NameNode, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel +from ariadne_graphql_modules.base import GraphQLMetadata +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.base_object_type import ( GraphQLBaseObject, GraphQLFieldData, diff --git a/ariadne_graphql_modules/interface_type/models.py b/ariadne_graphql_modules/interface_type/models.py index 153f36b..41f0270 100644 --- a/ariadne_graphql_modules/interface_type/models.py +++ b/ariadne_graphql_modules/interface_type/models.py @@ -5,7 +5,7 @@ from ariadne.types import Resolver from graphql import GraphQLField, GraphQLObjectType, GraphQLSchema, GraphQLTypeResolver -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/object_type/graphql_type.py b/ariadne_graphql_modules/object_type/graphql_type.py index c7918a0..4bffd68 100644 --- a/ariadne_graphql_modules/object_type/graphql_type.py +++ b/ariadne_graphql_modules/object_type/graphql_type.py @@ -11,7 +11,8 @@ ObjectTypeDefinitionNode, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel +from ariadne_graphql_modules.base import GraphQLMetadata +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.base_object_type import ( GraphQLBaseObject, GraphQLFieldData, diff --git a/ariadne_graphql_modules/object_type/models.py b/ariadne_graphql_modules/object_type/models.py index eb4832e..b58052e 100644 --- a/ariadne_graphql_modules/object_type/models.py +++ b/ariadne_graphql_modules/object_type/models.py @@ -5,7 +5,7 @@ from ariadne.types import Resolver from graphql import GraphQLField, GraphQLObjectType, GraphQLSchema -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/scalar_type/graphql_type.py b/ariadne_graphql_modules/scalar_type/graphql_type.py index 449c6da..dc8d417 100644 --- a/ariadne_graphql_modules/scalar_type/graphql_type.py +++ b/ariadne_graphql_modules/scalar_type/graphql_type.py @@ -7,7 +7,8 @@ value_from_ast_untyped, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.description import get_description_node from ariadne_graphql_modules.scalar_type.models import GraphQLScalarModel from ariadne_graphql_modules.scalar_type.validators import ( diff --git a/ariadne_graphql_modules/scalar_type/models.py b/ariadne_graphql_modules/scalar_type/models.py index a544ef9..8cf07d8 100644 --- a/ariadne_graphql_modules/scalar_type/models.py +++ b/ariadne_graphql_modules/scalar_type/models.py @@ -9,7 +9,7 @@ GraphQLSchema, ) -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/subscription_type/graphql_type.py b/ariadne_graphql_modules/subscription_type/graphql_type.py index 94127cc..94aa075 100644 --- a/ariadne_graphql_modules/subscription_type/graphql_type.py +++ b/ariadne_graphql_modules/subscription_type/graphql_type.py @@ -9,7 +9,8 @@ StringValueNode, ) -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel +from ariadne_graphql_modules.base import GraphQLMetadata +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.base_object_type import ( GraphQLBaseObject, GraphQLFieldData, @@ -100,9 +101,9 @@ def __get_graphql_model_with_schema__(cls) -> "GraphQLModel": # noqa: C901 for arg_name, arg_options in final_args.items(): arg_description = get_description_node(arg_options.description) if arg_description: - args_descriptions[cls_attr.field][arg_name] = ( - arg_description - ) + args_descriptions[cls_attr.field][ + arg_name + ] = arg_description arg_default = arg_options.default_value if arg_default is not None: diff --git a/ariadne_graphql_modules/subscription_type/models.py b/ariadne_graphql_modules/subscription_type/models.py index a3f6809..8d491b9 100644 --- a/ariadne_graphql_modules/subscription_type/models.py +++ b/ariadne_graphql_modules/subscription_type/models.py @@ -5,7 +5,7 @@ from ariadne.types import Resolver, Subscriber from graphql import GraphQLField, GraphQLObjectType, GraphQLSchema -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/ariadne_graphql_modules/union_type/graphql_type.py b/ariadne_graphql_modules/union_type/graphql_type.py index d6003aa..51fa7fc 100644 --- a/ariadne_graphql_modules/union_type/graphql_type.py +++ b/ariadne_graphql_modules/union_type/graphql_type.py @@ -3,7 +3,8 @@ from graphql import NamedTypeNode, NameNode, UnionTypeDefinitionNode -from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLModel, GraphQLType +from ariadne_graphql_modules.base import GraphQLMetadata, GraphQLType +from ariadne_graphql_modules.base_graphql_model import GraphQLModel from ariadne_graphql_modules.description import get_description_node from ariadne_graphql_modules.object_type.graphql_type import GraphQLObject from ariadne_graphql_modules.union_type.models import GraphQLUnionModel diff --git a/ariadne_graphql_modules/union_type/models.py b/ariadne_graphql_modules/union_type/models.py index 32c5d25..51860d0 100644 --- a/ariadne_graphql_modules/union_type/models.py +++ b/ariadne_graphql_modules/union_type/models.py @@ -3,7 +3,7 @@ from ariadne import UnionType from graphql import GraphQLSchema, GraphQLTypeResolver -from ariadne_graphql_modules.base import GraphQLModel +from ariadne_graphql_modules.base_graphql_model import GraphQLModel @dataclass(frozen=True) diff --git a/tests/test_interface_type_validation.py b/tests/test_interface_type_validation.py index 7481bbc..2ba5684 100644 --- a/tests/test_interface_type_validation.py +++ b/tests/test_interface_type_validation.py @@ -30,7 +30,9 @@ def test_interface_with_schema_object_with_no_schema(data_regression): with pytest.raises(ValueError) as exc_info: class UserInterface(GraphQLInterface): - __schema__: Optional[str] = """ + __schema__: Optional[ + str + ] = """ interface UserInterface { summary: String! score: Int! diff --git a/tests/test_subscription_type.py b/tests/test_subscription_type.py index 6c8ed63..0e82871 100644 --- a/tests/test_subscription_type.py +++ b/tests/test_subscription_type.py @@ -180,7 +180,9 @@ async def message_added_generator(*_, channel: GraphQLID): @GraphQLSubscription.field @staticmethod - def message_added(message, *_, channel: GraphQLID): # pylint: disable=unused-argument + def message_added( + message, *_, channel: GraphQLID + ): # pylint: disable=unused-argument return message class QueryType(GraphQLObject): @@ -354,7 +356,9 @@ async def message_added_generator(*_, channel_id: GraphQLID): "messages_in_channel", ) @staticmethod - async def resolve_message_added(message, *_, channel_id: GraphQLID): # pylint: disable=unused-argument + async def resolve_message_added( + message, *_, channel_id: GraphQLID + ): # pylint: disable=unused-argument return message class QueryType(GraphQLObject): @@ -571,7 +575,9 @@ async def message_added_generator(*_, channel: GraphQLID): "messageAdded", ) @staticmethod - async def resolve_message_added(message, *_, channel: GraphQLID): # pylint: disable=unused-argument + async def resolve_message_added( + message, *_, channel: GraphQLID + ): # pylint: disable=unused-argument return message class QueryType(GraphQLObject): @@ -742,7 +748,9 @@ async def message_added_generator(*_, channel_id: GraphQLID): "messagesInChannel", ) @staticmethod - async def resolve_message_added(message, *_, channel_id: GraphQLID): # pylint: disable=unused-argument + async def resolve_message_added( + message, *_, channel_id: GraphQLID + ): # pylint: disable=unused-argument return message class QueryType(GraphQLObject):