Skip to content

Commit ec2a9ca

Browse files
committed
fix backticks in docstrings
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
1 parent a09cdce commit ec2a9ca

19 files changed

+61
-61
lines changed

src/graphql/execution/execute.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797
class ExecutionResult(NamedTuple):
9898
"""The result of GraphQL execution.
9999
100-
- `data` is the result of a successful execution of the query.
101-
- `errors` is included when any errors occurred as a non-empty list.
100+
- ``data`` is the result of a successful execution of the query.
101+
- ``errors`` is included when any errors occurred as a non-empty list.
102102
"""
103103

104104
data: Optional[Dict[str, Any]]
@@ -678,7 +678,7 @@ 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 definition.
682682
683683
If the field is an abstract type, determine the runtime type of the value and
684684
then complete based on that type.
@@ -948,7 +948,7 @@ def collect_subfields(
948948
"""Collect subfields.
949949
950950
A cached collection of relevant subfields with regard to the return type is
951-
kept in the execution context as `_subfields_cache`. This ensures the
951+
kept in the execution context as ``_subfields_cache``. This ensures the
952952
subfields are not repeatedly calculated, which saves overhead when resolving
953953
lists of values.
954954
"""
@@ -1065,9 +1065,9 @@ def get_field_def(
10651065
"""Get field definition.
10661066
10671067
This method looks up the field on the given type definition. It has special casing
1068-
for the two introspection fields, `__schema` and `__typename`. `__typename` is
1068+
for the two introspection fields, ``__schema`` and ``__typename``. ``__typename`` is
10691069
special because it can always be queried as a field, even in situations where no
1070-
other fields are allowed, like on a Union. `__schema` could get automatically
1070+
other fields are allowed, like on a Union. ``__schema`` could get automatically
10711071
added to the query type, but that would require mutating type definitions, which
10721072
would cause issues.
10731073
@@ -1098,7 +1098,7 @@ def invalid_return_type_error(
10981098

10991099

11001100
def get_typename(value: Any) -> Optional[str]:
1101-
"""Get the `__typename` property of the given value."""
1101+
"""Get the ``__typename`` property of the given value."""
11021102
if isinstance(value, dict):
11031103
return value.get("__typename")
11041104
# need to de-mangle the attribute assumed to be "private" in Python
@@ -1117,10 +1117,10 @@ def default_type_resolver(
11171117
If a resolve_type function is not given, then a default resolve behavior is used
11181118
which attempts two strategies:
11191119
1120-
First, See if the provided value has a `__typename` field defined, if so, use that
1120+
First, See if the provided value has a ``__typename`` field defined, if so, use that
11211121
value as name of the resolved type.
11221122
1123-
Otherwise, test each possible type for the abstract type by calling `is_type_of`
1123+
Otherwise, test each possible type for the abstract type by calling :meth:`~graphql.type.GraphQLObjectType.is_type_of`
11241124
for the object being coerced, returning the first type that matches.
11251125
"""
11261126
# First, look for `__typename`.

src/graphql/execution/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MiddlewareManager:
1313
1414
This class helps to wrap resolver functions with the provided middleware functions
1515
and/or objects. The functions take the next middleware function as first argument.
16-
If middleware is provided as an object, it must provide a method `resolve` that is
16+
If middleware is provided as an object, it must provide a method ``resolve`` that is
1717
used as the middleware function.
1818
1919
Note that since resolvers return "AwaitableOrValue"s, all middleware functions

src/graphql/graphql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ 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 `is_type_of` method).
68+
``__typename`` field or alternatively calls the :meth:`~graphql.type.GraphQLObjectType.is_type_of` method).
6969
:arg middleware:
7070
The middleware to wrap the resolvers with
7171
:arg execution_context_class:

src/graphql/language/parser.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ 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
80+
they correspond to. The ``no_location`` option disables that behavior for performance
8181
or testing.
8282
8383
Experimental features:
8484
85-
If `experimental_fragment_variables` is set to True, the parser will understand
85+
If ``experimental_fragment_variables`` is set to ``True``, the parser will understand
8686
and parse variable definitions contained in a fragment definition. They'll be
87-
represented in the `variable_definitions` field of the `FragmentDefinitionNode`.
87+
represented in the :attr:`~graphql.language.FragmentDefinitionNode.variable_definitions` field of the :class:`~graphql.language.FragmentDefinitionNode`.
8888
8989
The syntax is identical to normal, query-defined variables. For example::
9090
@@ -110,7 +110,7 @@ def parse_value(
110110
This is useful within tools that operate upon GraphQL Values directly and in
111111
isolation of complete GraphQL documents.
112112
113-
Consider providing the results to the utility function: `value_from_ast()`.
113+
Consider providing the results to the utility function: :func:`~graphql.value_from_ast`.
114114
"""
115115
parser = Parser(
116116
source,
@@ -133,7 +133,7 @@ def parse_type(
133133
This is useful within tools that operate upon GraphQL Types directly and
134134
in isolation of complete GraphQL documents.
135135
136-
Consider providing the results to the utility function: `type_from_ast()`.
136+
Consider providing the results to the utility function: :func:`~graphql.value_from_ast`.
137137
"""
138138
parser = Parser(
139139
source,
@@ -390,7 +390,7 @@ def parse_fragment_definition(self) -> FragmentDefinitionNode:
390390
)
391391

392392
def parse_fragment_name(self) -> NameNode:
393-
"""FragmentName: Name but not `on`"""
393+
"""FragmentName: Name but not ``on``"""
394394
if self._lexer.token.value == "on":
395395
raise self.unexpected()
396396
return self.parse_name()
@@ -1042,9 +1042,9 @@ def any(
10421042
) -> List[T]:
10431043
"""Fetch any matching nodes, possibly none.
10441044
1045-
Returns a possibly empty list of parse nodes, determined by the `parse_fn`.
1046-
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.
1045+
Returns a possibly empty list of parse nodes, determined by the ``parse_fn``.
1046+
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.
10481048
"""
10491049
self.expect_token(open_kind)
10501050
nodes: List[T] = []
@@ -1058,10 +1058,10 @@ def optional_many(
10581058
) -> List[T]:
10591059
"""Fetch matching nodes, maybe none.
10601060
1061-
Returns a list of parse nodes, determined by the `parse_fn`. It can be empty
1061+
Returns a list of parse nodes, determined by the ``parse_fn``. It can be empty
10621062
only if the open token is missing, otherwise it will always return a non-empty
1063-
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.
1063+
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.
10651065
"""
10661066
if self.expect_optional_token(open_kind):
10671067
nodes = [parse_fn()]
@@ -1076,9 +1076,9 @@ def many(
10761076
) -> List[T]:
10771077
"""Fetch matching nodes, at least one.
10781078
1079-
Returns a non-empty list of parse nodes, determined by the `parse_fn`.
1080-
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.
1079+
Returns a non-empty list of parse nodes, determined by the ``parse_fn``.
1080+
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.
10821082
"""
10831083
self.expect_token(open_kind)
10841084
nodes = [parse_fn()]

src/graphql/language/source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def __init__(
1818
"""Initialize source input.
1919
2020
21-
`name` and `location_offset` are optional. They are useful for clients who
21+
``name`` and ``location_offset`` are optional. They are useful for clients who
2222
store GraphQL documents in source files; for example, if the GraphQL input
2323
starts at line 40 in a file named Foo.graphql, it might be useful for name
24-
to be "Foo.graphql" and location to be `(40, 0)`.
24+
to be "Foo.graphql" and location to be ``(40, 0)``.
2525
2626
line and column in location_offset are 1-indexed
2727
"""

src/graphql/language/visitor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ def enter(self, node, key, parent, path, ancestors):
142142
:arg parent: the parent immediately above this node, which may be an Array.
143143
:arg path: The key path to get to this node from the root node.
144144
:arg ancestors: All nodes and Arrays visited before reaching parent
145-
of this node. These correspond to array indices in `path`.
145+
of this node. These correspond to array indices in ``path``.
146146
Note: ancestors includes arrays which contain the parent of visited node.
147147
148148
You can also define node kind specific methods by suffixing them with an underscore
149-
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
149+
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
151151
the same signature as above. If no kind specific method has been defined for a given
152152
node, the generic method is called.
153153
"""
@@ -200,16 +200,16 @@ class Stack(NamedTuple):
200200
def visit(root: Node, visitor: Visitor, visitor_keys=None) -> Any:
201201
"""Visit each node in an AST.
202202
203-
`visit()` will walk through an AST using a depth first traversal, calling the
203+
:func:`~.visit` will walk through an AST using a depth first traversal, calling the
204204
visitor's enter methods at each node in the traversal, and calling the leave methods
205205
after visiting that node and all of its child nodes.
206206
207207
By returning different values from the enter and leave methods, the behavior of the
208208
visitor can be altered, including skipping over a sub-tree of the AST (by returning
209209
False), editing the AST by returning a value or None to remove the value, or to stop
210-
the whole traversal by returning `BREAK`.
210+
the whole traversal by returning :data:`~.BREAK`.
211211
212-
When using `visit()` to edit an AST, the original AST will not be modified, and a
212+
When using :func:`~.visit` to edit an AST, the original AST will not be modified, and a
213213
new version of the AST with the changes applied will be returned from the visit
214214
function.
215215

src/graphql/subscription/subscribe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async def subscribe(
5151
5252
If the source stream could not be created due to faulty subscription resolver logic
5353
or underlying systems, the coroutine object will yield a single ExecutionResult
54-
containing `errors` and no `data`.
54+
containing ``errors`` and no ``data``.
5555
5656
If the operation succeeded, the coroutine will yield an AsyncIterator, which yields
5757
a stream of ExecutionResults representing the response stream.
@@ -75,10 +75,10 @@ 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-
`execute` function, with `payload` as the `root_value`. This implements the
78+
:func:`~graphql.execute` function, with ``payload`` as the ``root_value``. This implements the
7979
"MapSourceToResponseEvent" algorithm described in the GraphQL specification.
80-
The `execute` function provides the "ExecuteSubscriptionEvent" algorithm,
81-
as it is nearly identical to the "ExecuteQuery" algorithm, for which `execute`
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`
8282
is also used.
8383
"""
8484
result = execute(

src/graphql/type/definition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class GraphQLScalarType(GraphQLNamedType):
306306
and are defined with a name and a series of functions used to parse input from ast
307307
or variables and to ensure validity.
308308
309-
If a type's serialize function does not return a value (i.e. it returns `None`),
309+
If a type's serialize function does not return a value (i.e. it returns ``None``),
310310
then no error will be included in the response.
311311
312312
Example::
@@ -1245,7 +1245,7 @@ class GraphQLInputObjectType(GraphQLNamedType):
12451245
An input object defines a structured collection of fields which may be supplied
12461246
to a field argument.
12471247
1248-
Using `NonNull` will ensure that a value must be provided by the query.
1248+
Using ``NonNull`` will ensure that a value must be provided by the query.
12491249
12501250
Example::
12511251
@@ -1261,7 +1261,7 @@ class GeoPoint(GraphQLInputObjectType):
12611261
}
12621262
12631263
The outbound values will be Python dictionaries by default, but you can have them
1264-
converted to other types by specifying an `out_type` function or class.
1264+
converted to other types by specifying an ``out_type`` function or class.
12651265
"""
12661266

12671267
ast_node: Optional[InputObjectTypeDefinitionNode]

src/graphql/type/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class GraphQLSchema:
7878
# you want them to be included in the final schema.
7979
types=[human_type, droid_type])
8080
81-
Note: If a list of `directives` is provided to GraphQLSchema, that will be the
82-
exact list of directives represented and allowed. If `directives` is not provided,
81+
Note: If a list of ``directives`` is provided to GraphQLSchema, that will be the
82+
exact list of directives represented and allowed. If ``directives`` is not provided,
8383
then a default set of the specified directives (e.g. @include and @skip) will be
8484
used. If you wish to provide *additional* directives to these specified directives,
8585
you must explicitly declare them. Example::
@@ -119,7 +119,7 @@ def __init__(
119119
"""Initialize GraphQL schema.
120120
121121
If this schema was built from a source known to be valid, then it may be marked
122-
with `assume_valid` to avoid an additional type system validation.
122+
with ``assume_valid`` to avoid an additional type system validation.
123123
"""
124124
self._validation_errors = [] if assume_valid else None
125125

src/graphql/utilities/build_ast_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ 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
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
4141
a valid SDL document.
4242
"""
4343
if not isinstance(document_ast, DocumentNode):

src/graphql/utilities/extend_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ 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 valid.
112+
Set ``assume_valid_sdl`` to ``True`` to assume it is already a valid SDL document.
113113
"""
114114
assert_schema(schema)
115115

src/graphql/utilities/type_from_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def type_from_ast(schema, type_node):
4444
4545
Given a Schema and an AST node describing a type, return a GraphQLType definition
4646
which applies to that type. For example, if provided the parsed AST node for
47-
`[User]`, a GraphQLList instance will be returned, containing the type called
47+
``[User]``, a GraphQLList instance will be returned, containing the type called
4848
"User" found in the schema. If a type called "User" is not found in the schema,
4949
then None will be returned.
5050
"""

src/graphql/utilities/type_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ 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 `enter(node)` and `leave(node)`.
59+
a recursive descent by calling :meth:`enter(node) <.TypeInfo.enter>` and :meth:`leave(node) <.TypeInfo.leave>`.
6060
"""
6161

6262
def __init__(
@@ -262,7 +262,7 @@ def get_field_def(
262262
) -> Optional[GraphQLField]:
263263
"""Get field definition.
264264
265-
Not exactly the same as the executor's definition of `get_field_def()`, in this
265+
Not exactly the same as the executor's definition of :func:`graphql.execution.get_field_def`, in this
266266
statically evaluated environment we do not always have an Object type, and need
267267
to handle Interface and Union types.
268268
"""

src/graphql/utilities/value_from_ast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def value_from_ast(
3333
A GraphQL type must be provided, which will be used to interpret different GraphQL
3434
Value literals.
3535
36-
Returns `Undefined` when the value could not be validly coerced according
36+
Returns ``Undefined`` when the value could not be validly coerced according
3737
to the provided type.
3838
3939
=================== ============== ================
@@ -143,7 +143,7 @@ def value_from_ast(
143143
def is_missing_variable(
144144
value_node: ValueNode, variables: Optional[Dict[str, Any]] = None
145145
) -> bool:
146-
"""Check if `value_node` is a variable not defined in the `variables` dict."""
146+
"""Check if ``value_node`` is a variable not defined in the ``variables`` dict."""
147147
return isinstance(value_node, VariableNode) and (
148148
not variables or variables.get(value_node.name.value, Undefined) is Undefined
149149
)

src/graphql/utilities/value_from_ast_untyped.py

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

src/graphql/validation/rules/fields_on_correct_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FieldsOnCorrectTypeRule(ValidationRule):
2424
"""Fields on correct type
2525
2626
A GraphQL document is only valid if all fields selected are defined by the parent
27-
type, or are an allowed meta field such as `__typename`.
27+
type, or are an allowed meta field such as ``__typename``.
2828
"""
2929

3030
def enter_field(self, node: FieldNode, *_args):

src/graphql/validation/rules/known_directives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class KnownDirectivesRule(ASTValidationRule):
1818
"""Known directives
1919
20-
A GraphQL document is only valid if all `@directives` are known by the schema and
20+
A GraphQL document is only valid if all ``@directives`` are known by the schema and
2121
legally positioned.
2222
"""
2323

src/graphql/validation/rules/known_fragment_names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class KnownFragmentNamesRule(ValidationRule):
99
"""Known fragment names
1010
11-
A GraphQL document is only valid if all `...Fragment` fragment spreads refer to
11+
A GraphQL document is only valid if all ``...Fragment`` fragment spreads refer to
1212
fragments defined in the same document.
1313
"""
1414

0 commit comments

Comments
 (0)