Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit b78a3a7

Browse files
fix types
1 parent 8a1cd23 commit b78a3a7

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

graphql_api/tests/test_owner.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -769,15 +769,12 @@ def test_fetch_owner_on_unauthenticated_enteprise_guest_access_not_activated(sel
769769
user.organizations = [owner.ownerid]
770770
user.save()
771771
owner.save()
772-
query = (
773-
"""{
774-
owner(username: "%s") {
775-
isCurrentUserActivated
776-
}
777-
}
778-
"""
779-
% owner.username
780-
)
772+
query = """{
773+
owner(username: "%s") {
774+
isCurrentUserActivated
775+
}
776+
}
777+
""" % (owner.username)
781778

782779
try:
783780
self.gql_request(query, owner=user)

graphql_api/types/query/query.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional
1+
from typing import Any, Optional
22

33
from ariadne import ObjectType
44
from django.conf import settings
@@ -20,7 +20,7 @@ def query_name(info: GraphQLResolveInfo) -> Optional[str]:
2020
return info.operation.name.value
2121

2222

23-
def configure_sentry_scope(query_name: str):
23+
def configure_sentry_scope(query_name: Optional[str]) -> None:
2424
# this sets the Sentry transaction name to the GraphQL query name which
2525
# should make it easier to search/filter transactions
2626
# we're configuring this here since it's the main entrypoint into GraphQL resolvers
@@ -33,14 +33,16 @@ def configure_sentry_scope(query_name: str):
3333

3434
@query_bindable.field("me")
3535
@sync_to_async
36-
def resolve_me(_, info) -> Optional[Owner]:
36+
def resolve_me(_: Any, info: GraphQLResolveInfo) -> Optional[Owner]:
3737
configure_sentry_scope(query_name(info))
3838
# will be `None` for anonymous users or users w/ no linked owners
3939
return info.context["request"].current_owner
4040

4141

4242
@query_bindable.field("owner")
43-
async def resolve_owner(_, info, username):
43+
async def resolve_owner(
44+
_: Any, info: GraphQLResolveInfo, username: str
45+
) -> Optional[Owner]:
4446
configure_sentry_scope(query_name(info))
4547

4648
service = info.context["service"]
@@ -60,7 +62,7 @@ async def resolve_owner(_, info, username):
6062

6163

6264
@query_bindable.field("config")
63-
def resolve_config(_, info):
65+
def resolve_config(_: Any, info: GraphQLResolveInfo) -> object:
6466
configure_sentry_scope(query_name(info))
6567

6668
# we have to return something here just to allow access to the child resolvers

0 commit comments

Comments
 (0)