From 3b90f7436f2539ead146e5bdbc11568448077751 Mon Sep 17 00:00:00 2001 From: rafalp Date: Mon, 7 Oct 2024 22:46:30 +0200 Subject: [PATCH] Fix linters --- example/mutations/compare_roles.py | 10 ++++++++-- example/mutations/dates_delta.py | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/example/mutations/compare_roles.py b/example/mutations/compare_roles.py index 98795a4..feba961 100644 --- a/example/mutations/compare_roles.py +++ b/example/mutations/compare_roles.py @@ -13,10 +13,16 @@ class RoleDiff(IntEnum): class Mutation(GraphQLObject): - @GraphQLObject.field(name="compareRoles") + @GraphQLObject.field( + name="compareRoles", + args={ + "a": GraphQLObject.argument(graphql_type=RoleEnum), + "b": GraphQLObject.argument(graphql_type=RoleEnum), + }, + ) @staticmethod def resolve_compare_roles( - obj, info: GraphQLResolveInfo, *, a: RoleEnum, b: RoleEnum + obj, info: GraphQLResolveInfo, *, a: str, b: str ) -> RoleDiff: index_a = RoleEnum.__members__.index(a) index_b = RoleEnum.__members__.index(b) diff --git a/example/mutations/dates_delta.py b/example/mutations/dates_delta.py index 05141f2..d9fb651 100644 --- a/example/mutations/dates_delta.py +++ b/example/mutations/dates_delta.py @@ -1,3 +1,5 @@ +from datetime import date + from ariadne_graphql_modules import GraphQLObject from graphql import GraphQLResolveInfo @@ -11,10 +13,16 @@ class DatesDeltaType(GraphQLObject): class Mutation(GraphQLObject): - @GraphQLObject.field(name="datesDelta") + @GraphQLObject.field( + name="datesDelta", + args={ + "a": GraphQLObject.argument(graphql_type=DateScalar), + "b": GraphQLObject.argument(graphql_type=DateScalar), + }, + ) @staticmethod def resolve_dates_delta( - obj, info: GraphQLResolveInfo, *, a: DateScalar, b: DateScalar + obj, info: GraphQLResolveInfo, *, a: date, b: date ) -> DatesDeltaType: years = abs(a.year - b.year) months = years * 12 + abs(a.month - b.month)