You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/graphql/language/parser.py
+17-10Lines changed: 17 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -77,14 +77,16 @@ def parse(
77
77
Throws GraphQLError if a syntax error is encountered.
78
78
79
79
By default, the parser creates AST nodes that know the location in the source that
80
-
they correspond to. The ``no_location`` option disables that behavior for performance
81
-
or testing.
80
+
they correspond to. The ``no_location`` option disables that behavior for
81
+
performance or testing.
82
82
83
83
Experimental features:
84
84
85
-
If ``experimental_fragment_variables`` is set to ``True``, the parser will understand
86
-
and parse variable definitions contained in a fragment definition. They'll be
87
-
represented in the :attr:`~graphql.language.FragmentDefinitionNode.variable_definitions` field of the :class:`~graphql.language.FragmentDefinitionNode`.
85
+
If ``experimental_fragment_variables`` is set to ``True``, the parser will
86
+
understand and parse variable definitions contained in a fragment definition.
87
+
They'll be represented in the
88
+
:attr:`~graphql.language.FragmentDefinitionNode.variable_definitions` field
89
+
of the :class:`~graphql.language.FragmentDefinitionNode`.
88
90
89
91
The syntax is identical to normal, query-defined variables. For example::
90
92
@@ -110,7 +112,8 @@ def parse_value(
110
112
This is useful within tools that operate upon GraphQL Values directly and in
111
113
isolation of complete GraphQL documents.
112
114
113
-
Consider providing the results to the utility function: :func:`~graphql.value_from_ast`.
115
+
Consider providing the results to the utility function:
116
+
:func:`~graphql.value_from_ast`.
114
117
"""
115
118
parser=Parser(
116
119
source,
@@ -133,7 +136,8 @@ def parse_type(
133
136
This is useful within tools that operate upon GraphQL Types directly and
134
137
in isolation of complete GraphQL documents.
135
138
136
-
Consider providing the results to the utility function: :func:`~graphql.value_from_ast`.
139
+
Consider providing the results to the utility function:
140
+
:func:`~graphql.value_from_ast`.
137
141
"""
138
142
parser=Parser(
139
143
source,
@@ -1044,7 +1048,8 @@ def any(
1044
1048
1045
1049
Returns a possibly empty list of parse nodes, determined by the ``parse_fn``.
1046
1050
This list begins with a lex token of ``open_kind`` and ends with a lex token of
1047
-
``close_kind``. Advances the parser to the next lex token after the closing token.
1051
+
``close_kind``. Advances the parser to the next lex token after the closing
1052
+
token.
1048
1053
"""
1049
1054
self.expect_token(open_kind)
1050
1055
nodes: List[T] = []
@@ -1061,7 +1066,8 @@ def optional_many(
1061
1066
Returns a list of parse nodes, determined by the ``parse_fn``. It can be empty
1062
1067
only if the open token is missing, otherwise it will always return a non-empty
1063
1068
list that begins with a lex token of ``open_kind`` and ends with a lex token of
1064
-
``close_kind``. Advances the parser to the next lex token after the closing token.
1069
+
``close_kind``. Advances the parser to the next lex token after the closing
1070
+
token.
1065
1071
"""
1066
1072
ifself.expect_optional_token(open_kind):
1067
1073
nodes= [parse_fn()]
@@ -1078,7 +1084,8 @@ def many(
1078
1084
1079
1085
Returns a non-empty list of parse nodes, determined by the ``parse_fn``.
1080
1086
This list begins with a lex token of ``open_kind`` and ends with a lex token of
1081
-
``close_kind``. Advances the parser to the next lex token after the closing token.
1087
+
``close_kind``. Advances the parser to the next lex token after the closing
0 commit comments