Skip to content

Commit 62726e4

Browse files
committed
Remove dead code since args are always present on fields and directives
Replicates graphql/graphql-js@1512eeb
1 parent f2f89fc commit 62726e4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

graphql/type/directives.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Sequence, cast
1+
from typing import Any, Dict, Optional, Sequence, cast
22

33
from ..language import ast, DirectiveLocation
44
from ..pyutils import inspect, FrozenList
@@ -26,6 +26,12 @@ class GraphQLDirective:
2626
Type system creators will usually not create these directly.
2727
"""
2828

29+
name: str
30+
locations: Sequence[DirectiveLocation]
31+
args: Dict[str, GraphQLArgument]
32+
description: Optional[str]
33+
ast_node: Optional[ast.DirectiveDefinitionNode]
34+
2935
def __init__(
3036
self,
3137
name: str,

graphql/type/introspection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
),
9696
"args": GraphQLField(
9797
GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
98-
resolve=lambda directive, _info: (directive.args or {}).items(),
98+
resolve=lambda directive, _info: directive.args.items(),
9999
),
100100
},
101101
)
@@ -323,7 +323,7 @@ def of_type(type_, _info):
323323
),
324324
"args": GraphQLField(
325325
GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
326-
resolve=lambda item, _info: (item[1].args or {}).items(),
326+
resolve=lambda item, _info: item[1].args.items(),
327327
),
328328
"type": GraphQLField(
329329
GraphQLNonNull(__Type), resolve=lambda item, _info: item[1].type

0 commit comments

Comments
 (0)