Skip to content

Commit

Permalink
Fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Oct 7, 2024
1 parent 4bbdd78 commit 3b90f74
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions example/mutations/compare_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions example/mutations/dates_delta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import date

from ariadne_graphql_modules import GraphQLObject
from graphql import GraphQLResolveInfo

Expand All @@ -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)
Expand Down

0 comments on commit 3b90f74

Please sign in to comment.