|
1 | | -from typing import Callable, Dict, List, Optional, Union, TypeVar, cast |
2 | 1 | from functools import partial |
| 2 | +from typing import Callable, Dict, List, Optional, TypeVar, Union, cast |
3 | 3 |
|
| 4 | +from ..error import GraphQLError, GraphQLSyntaxError |
4 | 5 | from .ast import ( |
5 | 6 | ArgumentNode, |
6 | 7 | BooleanValueNode, |
|
24 | 25 | InputObjectTypeDefinitionNode, |
25 | 26 | InputObjectTypeExtensionNode, |
26 | 27 | InputValueDefinitionNode, |
27 | | - IntValueNode, |
28 | 28 | InterfaceTypeDefinitionNode, |
29 | 29 | InterfaceTypeExtensionNode, |
| 30 | + IntValueNode, |
30 | 31 | ListTypeNode, |
31 | 32 | ListValueNode, |
32 | 33 | Location, |
33 | | - NameNode, |
34 | 34 | NamedTypeNode, |
| 35 | + NameNode, |
35 | 36 | NonNullTypeNode, |
36 | 37 | NullValueNode, |
37 | 38 | ObjectFieldNode, |
|
48 | 49 | SelectionNode, |
49 | 50 | SelectionSetNode, |
50 | 51 | StringValueNode, |
| 52 | + Token, |
51 | 53 | TypeNode, |
52 | 54 | TypeSystemExtensionNode, |
53 | 55 | UnionTypeDefinitionNode, |
|
57 | 59 | VariableNode, |
58 | 60 | ) |
59 | 61 | from .directive_locations import DirectiveLocation |
60 | | -from .ast import Token |
61 | 62 | from .lexer import Lexer, is_punctuator_token_kind |
62 | 63 | from .source import Source, is_source |
63 | 64 | from .token_kind import TokenKind |
64 | | -from ..error import GraphQLError, GraphQLSyntaxError |
65 | 65 |
|
66 | 66 | __all__ = ["parse", "parse_type", "parse_value", "parse_const_value"] |
67 | 67 |
|
@@ -401,8 +401,9 @@ def parse_field(self) -> FieldNode: |
401 | 401 | def parse_arguments(self, is_const: bool) -> List[ArgumentNode]: |
402 | 402 | """Arguments[Const]: (Argument[?Const]+)""" |
403 | 403 | item = self.parse_const_argument if is_const else self.parse_argument |
404 | | - item = cast(Callable[[], ArgumentNode], item) |
405 | | - return self.optional_many(TokenKind.PAREN_L, item, TokenKind.PAREN_R) |
| 404 | + return self.optional_many( |
| 405 | + TokenKind.PAREN_L, cast(Callable[[], ArgumentNode], item), TokenKind.PAREN_R |
| 406 | + ) |
406 | 407 |
|
407 | 408 | def parse_argument(self, is_const: bool = False) -> ArgumentNode: |
408 | 409 | """Argument[Const]: Name : Value[?Const]""" |
|
0 commit comments