Skip to content

Commit c9f876f

Browse files
committed
fix too long lines in docstrings
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
1 parent ec2a9ca commit c9f876f

File tree

10 files changed

+52
-40
lines changed

10 files changed

+52
-40
lines changed

src/graphql/execution/execute.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ def complete_value(
678678
inner type on each item in the list.
679679
680680
If the field type is a Scalar or Enum, ensures the completed value is a legal
681-
value of the type by calling the ``serialize`` method of GraphQL type definition.
681+
value of the type by calling the ``serialize`` method of GraphQL type
682+
definition.
682683
683684
If the field is an abstract type, determine the runtime type of the value and
684685
then complete based on that type.
@@ -1120,8 +1121,9 @@ def default_type_resolver(
11201121
First, See if the provided value has a ``__typename`` field defined, if so, use that
11211122
value as name of the resolved type.
11221123
1123-
Otherwise, test each possible type for the abstract type by calling :meth:`~graphql.type.GraphQLObjectType.is_type_of`
1124-
for the object being coerced, returning the first type that matches.
1124+
Otherwise, test each possible type for the abstract type by calling
1125+
:meth:`~graphql.type.GraphQLObjectType.is_type_of` for the object
1126+
being coerced, returning the first type that matches.
11251127
"""
11261128
# First, look for `__typename`.
11271129
type_name = get_typename(value)

src/graphql/graphql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ async def graphql(
6565
:arg type_resolver:
6666
A type resolver function to use when none is provided by the schema.
6767
If not provided, the default type resolver is used (which looks for a
68-
``__typename`` field or alternatively calls the :meth:`~graphql.type.GraphQLObjectType.is_type_of` method).
68+
``__typename`` field or alternatively calls the
69+
:meth:`~graphql.type.GraphQLObjectType.is_type_of` method).
6970
:arg middleware:
7071
The middleware to wrap the resolvers with
7172
:arg execution_context_class:

src/graphql/language/parser.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ def parse(
7777
Throws GraphQLError if a syntax error is encountered.
7878
7979
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.
8282
8383
Experimental features:
8484
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`.
8890
8991
The syntax is identical to normal, query-defined variables. For example::
9092
@@ -110,7 +112,8 @@ def parse_value(
110112
This is useful within tools that operate upon GraphQL Values directly and in
111113
isolation of complete GraphQL documents.
112114
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`.
114117
"""
115118
parser = Parser(
116119
source,
@@ -133,7 +136,8 @@ def parse_type(
133136
This is useful within tools that operate upon GraphQL Types directly and
134137
in isolation of complete GraphQL documents.
135138
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`.
137141
"""
138142
parser = Parser(
139143
source,
@@ -1044,7 +1048,8 @@ def any(
10441048
10451049
Returns a possibly empty list of parse nodes, determined by the ``parse_fn``.
10461050
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.
10481053
"""
10491054
self.expect_token(open_kind)
10501055
nodes: List[T] = []
@@ -1061,7 +1066,8 @@ def optional_many(
10611066
Returns a list of parse nodes, determined by the ``parse_fn``. It can be empty
10621067
only if the open token is missing, otherwise it will always return a non-empty
10631068
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.
10651071
"""
10661072
if self.expect_optional_token(open_kind):
10671073
nodes = [parse_fn()]
@@ -1078,7 +1084,8 @@ def many(
10781084
10791085
Returns a non-empty list of parse nodes, determined by the ``parse_fn``.
10801086
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
1088+
token.
10821089
"""
10831090
self.expect_token(open_kind)
10841091
nodes = [parse_fn()]

src/graphql/language/visitor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def enter(self, node, key, parent, path, ancestors):
147147
148148
You can also define node kind specific methods by suffixing them with an underscore
149149
followed by the kind of the node to be visited. For instance, to visit ``field``
150-
nodes, you would defined the methods ``enter_field()`` and/or ``leave_field()``, with
151-
the same signature as above. If no kind specific method has been defined for a given
152-
node, the generic method is called.
150+
nodes, you would defined the methods ``enter_field()`` and/or ``leave_field()``,
151+
with the same signature as above. If no kind specific method has been defined
152+
for a given node, the generic method is called.
153153
"""
154154

155155
# Provide special return values as attributes
@@ -209,9 +209,9 @@ def visit(root: Node, visitor: Visitor, visitor_keys=None) -> Any:
209209
False), editing the AST by returning a value or None to remove the value, or to stop
210210
the whole traversal by returning :data:`~.BREAK`.
211211
212-
When using :func:`~.visit` to edit an AST, the original AST will not be modified, and a
213-
new version of the AST with the changes applied will be returned from the visit
214-
function.
212+
When using :func:`~.visit` to edit an AST, the original AST will not be modified,
213+
and a new version of the AST with the changes applied will be returned from the
214+
visit function.
215215
216216
To customize the node attributes to be used for traversal, you can provide a
217217
dictionary visitor_keys mapping node kinds to node attributes.

src/graphql/subscription/subscribe.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ async def map_source_to_response(payload) -> ExecutionResult:
7575
"""Map source to response.
7676
7777
For each payload yielded from a subscription, map it over the normal GraphQL
78-
:func:`~graphql.execute` function, with ``payload`` as the ``root_value``. This implements the
79-
"MapSourceToResponseEvent" algorithm described in the GraphQL specification.
80-
The :func:`~graphql.execute` function provides the "ExecuteSubscriptionEvent" algorithm,
81-
as it is nearly identical to the "ExecuteQuery" algorithm, for which :func:`~graphql.execute`
82-
is also used.
78+
:func:`~graphql.execute` function, with ``payload`` as the ``root_value``.
79+
This implements the "MapSourceToResponseEvent" algorithm described in the
80+
GraphQL specification. The :func:`~graphql.execute` function provides the
81+
"ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the
82+
"ExecuteQuery" algorithm, for which :func:`~graphql.execute` is also used.
8383
"""
8484
result = execute(
8585
schema,

src/graphql/utilities/build_ast_schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def build_ast_schema(
3636
resolve methods, so execution will use default resolvers.
3737
3838
When building a schema from a GraphQL service's introspection result, it might
39-
be safe to assume the schema is valid. Set ``assume_valid`` to ``True`` to assume the
40-
produced schema is valid. Set ``assume_valid_sdl`` to ``True`` to assume it is already
41-
a valid SDL document.
39+
be safe to assume the schema is valid. Set ``assume_valid`` to ``True`` to assume
40+
the produced schema is valid. Set ``assume_valid_sdl`` to ``True`` to assume it is
41+
already a valid SDL document.
4242
"""
4343
if not isinstance(document_ast, DocumentNode):
4444
raise TypeError("Must provide valid Document AST.")

src/graphql/utilities/extend_schema.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ def extend_schema(
108108
copy. The original schema remains unaltered.
109109
110110
When extending a schema with a known valid extension, it might be safe to assume the
111-
schema is valid. Set ``assume_valid`` to ``True`` to assume the produced schema is valid.
112-
Set ``assume_valid_sdl`` to ``True`` to assume it is already a valid SDL document.
111+
schema is valid. Set ``assume_valid`` to ``True`` to assume the produced schema is
112+
valid. Set ``assume_valid_sdl`` to ``True`` to assume it is already a valid SDL
113+
document.
113114
"""
114115
assert_schema(schema)
115116

src/graphql/utilities/type_info.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class TypeInfo:
5656
5757
TypeInfo is a utility class which, given a GraphQL schema, can keep track of the
5858
current field and type definitions at any point in a GraphQL document AST during
59-
a recursive descent by calling :meth:`enter(node) <.TypeInfo.enter>` and :meth:`leave(node) <.TypeInfo.leave>`.
59+
a recursive descent by calling :meth:`enter(node) <.TypeInfo.enter>` and
60+
:meth:`leave(node) <.TypeInfo.leave>`.
6061
"""
6162

6263
def __init__(
@@ -262,9 +263,9 @@ def get_field_def(
262263
) -> Optional[GraphQLField]:
263264
"""Get field definition.
264265
265-
Not exactly the same as the executor's definition of :func:`graphql.execution.get_field_def`, in this
266-
statically evaluated environment we do not always have an Object type, and need
267-
to handle Interface and Union types.
266+
Not exactly the same as the executor's definition of
267+
:func:`graphql.execution.get_field_def`, in this statically evaluated environment
268+
we do not always have an Object type, and need to handle Interface and Union types.
268269
"""
269270
name = field_node.name.value
270271
if name == "__schema" and schema.query_type is parent_type:

src/graphql/utilities/value_from_ast_untyped.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def value_from_ast_untyped(
1212
) -> Any:
1313
"""Produce a Python value given a GraphQL Value AST.
1414
15-
Unlike :func:`~graphql.value_from_ast`, no type is provided. The resulting Python value will
16-
reflect the provided GraphQL value AST.
15+
Unlike :func:`~graphql.value_from_ast`, no type is provided.
16+
The resulting Python value will reflect the provided GraphQL value AST.
1717
1818
=================== ============== ================
1919
GraphQL Value JSON Value Python Value

src/graphql/validation/rules/overlapping_fields_can_be_merged.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ def collect_conflicts_between(
466466
) -> None:
467467
"""Collect all Conflicts between two collections of fields.
468468
469-
This is similar to, but different from the :func:`~.collect_conflicts_within` function above.
470-
This check assumes that :func:`~.collect_conflicts_within` has already been called on each
471-
provided collection of fields. This is true because this validator traverses each
472-
individual selection set.
469+
This is similar to, but different from the :func:`~.collect_conflicts_within`
470+
function above. This check assumes that :func:`~.collect_conflicts_within` has
471+
already been called on each provided collection of fields. This is true because
472+
this validator traverses each individual selection set.
473473
"""
474474
# A field map is a keyed collection, where each key represents a response name and
475475
# the value at that key is a list of all fields which provide that response name.

0 commit comments

Comments
 (0)