Language¶
GraphQL Language
The graphql.language
package is responsible for parsing and operating on the
GraphQL language.
-
class
graphql.language.
ArgumentNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name', 'value']¶
-
kind
= 'argument'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
value
: ValueNode¶
-
-
class
graphql.language.
BooleanValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'boolean_value'¶
-
loc
¶
-
value
: bool¶
-
-
class
graphql.language.
DefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'definition'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
DirectiveDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
keys
= ['loc', 'description', 'name', 'arguments', 'repeatable', 'locations']¶
-
kind
= 'directive_definition'¶
-
loc
¶
-
locations
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NameNode]¶
-
name
: graphql.language.ast.NameNode¶
-
repeatable
: bool¶
-
-
class
graphql.language.
DirectiveLocation
(value)¶ Bases:
enum.Enum
The enum type representing the directive location values.
-
ARGUMENT_DEFINITION
= 'argument definition'¶
-
ENUM
= 'enum'¶
-
ENUM_VALUE
= 'enum value'¶
-
FIELD
= 'field'¶
-
FIELD_DEFINITION
= 'field definition'¶
-
FRAGMENT_DEFINITION
= 'fragment definition'¶
-
FRAGMENT_SPREAD
= 'fragment spread'¶
-
INLINE_FRAGMENT
= 'inline fragment'¶
-
INPUT_FIELD_DEFINITION
= 'input field definition'¶
-
INPUT_OBJECT
= 'input object'¶
-
INTERFACE
= 'interface'¶
-
MUTATION
= 'mutation'¶
-
OBJECT
= 'object'¶
-
QUERY
= 'query'¶
-
SCALAR
= 'scalar'¶
-
SCHEMA
= 'schema'¶
-
SUBSCRIPTION
= 'subscription'¶
-
UNION
= 'union'¶
-
VARIABLE_DEFINITION
= 'variable definition'¶
-
-
class
graphql.language.
DirectiveNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.ArgumentNode]¶
-
keys
= ['loc', 'name', 'arguments']¶
-
kind
= 'directive'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
DocumentNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
definitions
: graphql.pyutils.frozen_list.FrozenList[DefinitionNode]¶
-
keys
= ['loc', 'definitions']¶
-
kind
= 'document'¶
-
loc
¶
-
-
class
graphql.language.
EnumTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
keys
= ['loc', 'description', 'name', 'directives', 'values']¶
-
kind
= 'enum_type_definition'¶
-
loc
¶
-
name
¶
-
values
: Optional[graphql.pyutils.frozen_list.FrozenList[EnumValueDefinitionNode]]¶
-
-
class
graphql.language.
EnumTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'values']¶
-
kind
= 'enum_type_extension'¶
-
loc
¶
-
name
¶
-
values
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.EnumValueDefinitionNode]]¶
-
-
class
graphql.language.
EnumValueDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'enum_value_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
EnumValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'enum_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
ExecutableDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set']¶
-
kind
= 'executable_definition'¶
-
loc
¶
-
name
: Optional[graphql.language.ast.NameNode]¶
-
selection_set
: SelectionSetNode¶
-
variable_definitions
: graphql.pyutils.frozen_list.FrozenList[VariableDefinitionNode]¶
-
-
class
graphql.language.
FieldDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[InputValueDefinitionNode]]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'arguments', 'type']¶
-
kind
= 'field_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
FieldNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
alias
: Optional[graphql.language.ast.NameNode]¶
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[ArgumentNode]]¶
-
directives
¶
-
keys
= ['loc', 'directives', 'alias', 'name', 'arguments', 'selection_set']¶
-
kind
= 'field'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
selection_set
: Optional[graphql.language.ast.SelectionSetNode]¶
-
-
class
graphql.language.
FloatValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'float_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
FragmentDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.ExecutableDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set', 'type_condition']¶
-
kind
= 'fragment_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
selection_set
¶
-
type_condition
: NamedTypeNode¶
-
variable_definitions
¶
-
-
class
graphql.language.
FragmentSpreadNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'directives', 'name']¶
-
kind
= 'fragment_spread'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
InlineFragmentNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'directives', 'type_condition', 'selection_set']¶
-
kind
= 'inline_fragment'¶
-
loc
¶
-
selection_set
: graphql.language.ast.SelectionSetNode¶
-
type_condition
: NamedTypeNode¶
-
-
class
graphql.language.
InputObjectTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'fields']¶
-
kind
= 'input_object_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InputObjectTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
keys
= ['loc', 'name', 'directives', 'fields']¶
-
kind
= 'input_object_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InputValueDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
default_value
: Optional[graphql.language.ast.ValueNode]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'type', 'default_value']¶
-
kind
= 'input_value_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
IntValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'int_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
InterfaceTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'fields', 'interfaces']¶
-
kind
= 'interface_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InterfaceTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'interface_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
Lexer
(source: graphql.language.source.Source)¶ Bases:
object
GraphQL Lexer
A Lexer is a stateful stream generator in that every time it is advanced, it returns the next token in the Source. Assuming the source lexes, the final Token emitted by the lexer will be of kind EOF, after which the lexer will repeatedly return the same EOF token whenever called.
-
__init__
(source: graphql.language.source.Source)¶ Given a Source object, initialize a Lexer for that source.
-
advance
() → graphql.language.ast.Token¶ Advance the token stream to the next non-ignored token.
-
lookahead
() → graphql.language.ast.Token¶ Look ahead and return the next non-ignored token, but do not change state.
-
position_after_whitespace
(body: str, start_position: int) → int¶ Go to next position after a whitespace.
Reads from body starting at start_position until it finds a non-whitespace character, then returns the position of that character for lexing.
-
read_block_string
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶
-
read_comment
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read a comment token from the source file.
-
read_digits
(start: int, char: str) → int¶ Return the new position in the source after reading digits.
-
read_name
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read an alphanumeric + underscore name from the source.
-
read_number
(start: int, char: str, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Reads a number token from the source file.
Either a float or an int depending on whether a decimal point appears.
-
read_string
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read a string token from the source file.
-
read_token
(prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Get the next token from the source starting at the given position.
This skips over whitespace until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper function for more complicated tokens.
-
-
class
graphql.language.
ListTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'type']¶
-
kind
= 'list_type'¶
-
loc
¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
ListValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'values']¶
-
kind
= 'list_value'¶
-
loc
¶
-
values
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.ValueNode]¶
-
-
class
graphql.language.
Location
(start_token: graphql.language.ast.Token, end_token: graphql.language.ast.Token, source: graphql.language.source.Source)¶ Bases:
object
AST Location
Contains a range of UTF-8 character offsets and token references that identify the region of the source from which the AST derived.
-
__init__
(start_token: graphql.language.ast.Token, end_token: graphql.language.ast.Token, source: graphql.language.source.Source)¶ Initialize self. See help(type(self)) for accurate signature.
-
end
: int¶
-
end_token
: graphql.language.ast.Token¶
-
source
: graphql.language.source.Source¶
-
start
: int¶
-
start_token
: graphql.language.ast.Token¶
-
-
class
graphql.language.
NameNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'name'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
NamedTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name']¶
-
kind
= 'named_type'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
Node
(**kwargs)¶ Bases:
object
AST nodes
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'ast'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
NonNullTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'type']¶
-
kind
= 'non_null_type'¶
-
loc
¶
-
type
: Union[graphql.language.ast.NamedTypeNode, graphql.language.ast.ListTypeNode]¶
-
-
class
graphql.language.
NullValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'null_value'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
ObjectFieldNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name', 'value']¶
-
kind
= 'object_field'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
value
: graphql.language.ast.ValueNode¶
-
-
class
graphql.language.
ObjectTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'object_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
ObjectTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'object_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
ObjectValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
fields
: graphql.pyutils.frozen_list.FrozenList[ObjectFieldNode]¶
-
keys
= ['loc', 'fields']¶
-
kind
= 'object_value'¶
-
loc
¶
-
-
class
graphql.language.
OperationDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.ExecutableDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set', 'operation']¶
-
kind
= 'operation_definition'¶
-
loc
¶
-
name
¶
-
operation
: graphql.language.ast.OperationType¶
-
selection_set
¶
-
variable_definitions
¶
-
-
class
graphql.language.
OperationType
(value)¶ Bases:
enum.Enum
An enumeration.
-
MUTATION
= 'mutation'¶
-
QUERY
= 'query'¶
-
SUBSCRIPTION
= 'subscription'¶
-
-
class
graphql.language.
OperationTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'operation', 'type']¶
-
kind
= 'operation_type_definition'¶
-
loc
¶
-
operation
: graphql.language.ast.OperationType¶
-
type
: graphql.language.ast.NamedTypeNode¶
-
-
class
graphql.language.
ParallelVisitor
(visitors: Collection[graphql.language.visitor.Visitor])¶ Bases:
graphql.language.visitor.Visitor
A Visitor which delegates to many visitors to run in parallel.
Each visitor will be visited for each node before moving on.
If a prior visitor edits a node, no following visitors will see that node.
-
BREAK
= True¶
-
IDLE
= None¶
-
REMOVE
= Ellipsis¶
-
SKIP
= False¶
-
__init__
(visitors: Collection[graphql.language.visitor.Visitor])¶ Create a new visitor from the given list of parallel visitors.
-
enter
(node, *args)¶
-
classmethod
get_visit_fn
(kind, is_leaving=False) → Callable¶ Get the visit function for the given node kind and direction.
-
leave
(node, *args)¶
-
-
class
graphql.language.
ScalarTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'scalar_type_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
ScalarTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives']¶
-
kind
= 'scalar_type_extension'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
SchemaDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'directives', 'operation_types']¶
-
kind
= 'schema_definition'¶
-
loc
¶
-
operation_types
: graphql.pyutils.frozen_list.FrozenList[OperationTypeDefinitionNode]¶
-
-
class
graphql.language.
SchemaExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'directives', 'operation_types']¶
-
kind
= 'schema_extension'¶
-
loc
¶
-
operation_types
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.OperationTypeDefinitionNode]]¶
-
-
class
graphql.language.
SelectionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[DirectiveNode]]¶
-
keys
= ['loc', 'directives']¶
-
kind
= 'selection'¶
-
loc
¶
-
-
class
graphql.language.
SelectionSetNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'selections']¶
-
kind
= 'selection_set'¶
-
loc
¶
-
selections
: graphql.pyutils.frozen_list.FrozenList[SelectionNode]¶
-
-
class
graphql.language.
Source
(body: str, name: str = 'GraphQL request', location_offset: graphql.language.location.SourceLocation = SourceLocation(line=1, column=1))¶ Bases:
object
A representation of source input to GraphQL.
-
__init__
(body: str, name: str = 'GraphQL request', location_offset: graphql.language.location.SourceLocation = SourceLocation(line=1, column=1)) → None¶ Initialize source input.
name
andlocation_offset
are optional. They are useful for clients who store GraphQL documents in source files; for example, if the GraphQL input starts at line 40 in a file named Foo.graphql, it might be useful for name to be “Foo.graphql” and location to be(40, 0)
.line and column in location_offset are 1-indexed
-
body
¶
-
get_location
(position: int) → graphql.language.location.SourceLocation¶
-
location_offset
¶
-
name
¶
-
-
class
graphql.language.
SourceLocation
(line: int, column: int)¶ Bases:
tuple
Represents a location in a Source.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
_asdict
()¶ Return a new dict which maps field names to their values.
-
_field_defaults
= {}¶
-
_fields
= ('line', 'column')¶
-
classmethod
_make
(iterable)¶ Make a new SourceLocation object from a sequence or iterable
-
_replace
(**kwds)¶ Return a new SourceLocation object replacing specified fields with new values
-
column
: int¶ Alias for field number 1
-
count
(value, /)¶ Return number of occurrences of value.
-
property
formatted
¶
-
index
(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
line
: int¶ Alias for field number 0
-
-
class
graphql.language.
StringValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
block
: Optional[bool]¶
-
keys
= ['loc', 'value', 'block']¶
-
kind
= 'string_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
Token
(kind: graphql.language.token_kind.TokenKind, start: int, end: int, line: int, column: int, prev: Optional[Token] = None, value: Optional[str] = None)¶ Bases:
object
AST Token
Represents a range of characters represented by a lexical token within a Source.
-
__init__
(kind: graphql.language.token_kind.TokenKind, start: int, end: int, line: int, column: int, prev: Optional[Token] = None, value: Optional[str] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
column
: int¶
-
property
desc
¶ A helper property to describe a token as a string for debugging
-
end
: int¶
-
kind
: graphql.language.token_kind.TokenKind¶
-
line
: int¶
-
next
: Optional[Token]¶
-
prev
: Optional[Token]¶
-
start
: int¶
-
value
: Optional[str]¶
-
-
class
graphql.language.
TokenKind
(value)¶ Bases:
enum.Enum
The different kinds of tokens that the lexer emits
-
AMP
= '&'¶
-
AT
= '@'¶
-
BANG
= '!'¶
-
BLOCK_STRING
= 'BlockString'¶
-
BRACE_L
= '{'¶
-
BRACE_R
= '}'¶
-
BRACKET_L
= '['¶
-
BRACKET_R
= ']'¶
-
COLON
= ':'¶
-
COMMENT
= 'Comment'¶
-
DOLLAR
= '$'¶
-
EOF
= '<EOF>'¶
-
EQUALS
= '='¶
-
FLOAT
= 'Float'¶
-
INT
= 'Int'¶
-
NAME
= 'Name'¶
-
PAREN_L
= '('¶
-
PAREN_R
= ')'¶
-
PIPE
= '|'¶
-
SOF
= '<SOF>'¶
-
SPREAD
= '...'¶
-
STRING
= 'String'¶
-
-
class
graphql.language.
TypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'type_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
TypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives']¶
-
kind
= 'type_extension'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
TypeNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'type'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
TypeSystemDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'type_system_definition'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
graphql.language.
TypeSystemExtensionNode
¶ alias of Union[graphql.language.ast.SchemaExtensionNode, graphql.language.ast.TypeExtensionNode]
-
class
graphql.language.
UnionTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
keys
¶
-
kind
¶
-
loc
¶
-
name
¶
-
types
¶
-
-
class
graphql.language.
UnionTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
¶
-
kind
¶
-
loc
¶
-
name
¶
-
types
¶
-
-
class
graphql.language.
ValueNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
¶
-
kind
¶
-
loc
¶
-
-
class
graphql.language.
VariableDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
default_value
¶
-
directives
¶
-
keys
¶
-
kind
¶
-
loc
¶
-
type
¶
-
variable
¶
-
-
class
graphql.language.
VariableNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
¶
-
kind
¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
Visitor
¶ Bases:
object
Visitor that walks through an AST.
Visitors can define two generic methods “enter” and “leave”. The former will be called when a node is entered in the traversal, the latter is called after visiting the node and its child nodes. These methods have the following signature:
def enter(self, node, key, parent, path, ancestors): # The return value has the following meaning: # IDLE (None): no action # SKIP: skip visiting this node # BREAK: stop visiting altogether # REMOVE: delete this node # any other value: replace this node with the returned value return def leave(self, node, key, parent, path, ancestors): # The return value has the following meaning: # IDLE (None) or SKIP: no action # BREAK: stop visiting altogether # REMOVE: delete this node # any other value: replace this node with the returned value return
The parameters have the following meaning:
- Parameters
node – The current node being visiting.
key – The index or key to this node from the parent node or Array.
parent – the parent immediately above this node, which may be an Array.
path – The key path to get to this node from the root node.
ancestors – All nodes and Arrays visited before reaching parent of this node. These correspond to array indices in
path
. Note: ancestors includes arrays which contain the parent of visited node.
You can also define node kind specific methods by suffixing them with an underscore followed by the kind of the node to be visited. For instance, to visit
field
nodes, you would defined the methodsenter_field()
and/orleave_field()
, with the same signature as above. If no kind specific method has been defined for a given node, the generic method is called.-
BREAK
¶
-
IDLE
¶
-
REMOVE
¶
-
SKIP
¶
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
get_visit_fn
(kind, is_leaving=False) → Callable¶ Get the visit function for the given node kind and direction.
-
graphql.language.
get_location
(source: Source, position: int) → graphql.language.location.SourceLocation¶ Get the line and column for a character position in the source.
Takes a Source and a UTF-8 character offset, and returns the corresponding line and column as a SourceLocation.
-
graphql.language.
is_definition_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_executable_definition_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_selection_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_type_definition_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_type_extension_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_type_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_type_system_definition_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_type_system_extension_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
is_value_node
(node: graphql.language.ast.Node) → bool¶
-
graphql.language.
parse
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.DocumentNode¶ Given a GraphQL source, parse it into a Document.
Throws GraphQLError if a syntax error is encountered.
By default, the parser creates AST nodes that know the location in the source that they correspond to. The
no_location
option disables that behavior for performance or testing.Experimental features:
If
experimental_fragment_variables
is set toTrue
, the parser will understand and parse variable definitions contained in a fragment definition. They’ll be represented in thevariable_definitions
field of theFragmentDefinitionNode
.The syntax is identical to normal, query-defined variables. For example:
fragment A($var: Boolean = false) on T { ... }
-
graphql.language.
parse_type
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.TypeNode¶ Parse the AST for a given string containing a GraphQL Type.
Throws GraphQLError if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function:
value_from_ast()
.
-
graphql.language.
parse_value
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.ValueNode¶ Parse the AST for a given string containing a GraphQL value.
Throws GraphQLError if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Values directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function:
value_from_ast()
.
-
graphql.language.
print_ast
(ast: graphql.language.ast.Node) → str¶ Convert an AST into a string.
The conversion is done using a set of reasonable formatting rules.
-
graphql.language.
print_location
(location: graphql.language.ast.Location) → str¶ Render a helpful description of the location in the GraphQL Source document.
-
graphql.language.
print_source_location
(source: graphql.language.source.Source, source_location: graphql.language.location.SourceLocation) → str¶ Render a helpful description of the location in the GraphQL Source document.
-
graphql.language.
visit
(root: graphql.language.ast.Node, visitor: graphql.language.visitor.Visitor, visitor_keys=None) → Any¶ Visit each node in an AST.
visit()
will walk through an AST using a depth first traversal, calling the visitor’s enter methods at each node in the traversal, and calling the leave methods after visiting that node and all of its child nodes.By returning different values from the enter and leave methods, the behavior of the visitor can be altered, including skipping over a sub-tree of the AST (by returning False), editing the AST by returning a value or None to remove the value, or to stop the whole traversal by returning
BREAK
.When using
visit()
to edit an AST, the original AST will not be modified, and a new version of the AST with the changes applied will be returned from the visit function.To customize the node attributes to be used for traversal, you can provide a dictionary visitor_keys mapping node kinds to node attributes.
AST¶
-
class
graphql.language.
Location
(start_token: graphql.language.ast.Token, end_token: graphql.language.ast.Token, source: graphql.language.source.Source)¶ Bases:
object
AST Location
Contains a range of UTF-8 character offsets and token references that identify the region of the source from which the AST derived.
-
__init__
(start_token: graphql.language.ast.Token, end_token: graphql.language.ast.Token, source: graphql.language.source.Source)¶ Initialize self. See help(type(self)) for accurate signature.
-
end
: int¶
-
end_token
: graphql.language.ast.Token¶
-
source
: graphql.language.source.Source¶
-
start
: int¶
-
start_token
: graphql.language.ast.Token¶
-
-
class
graphql.language.
Node
(**kwargs)¶ Bases:
object
AST nodes
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'ast'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
Each kind of AST node has its own class:
-
class
graphql.language.
ArgumentNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name', 'value']¶
-
kind
= 'argument'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
value
: ValueNode¶
-
-
class
graphql.language.
BooleanValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'boolean_value'¶
-
loc
¶
-
value
: bool¶
-
-
class
graphql.language.
DefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'definition'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
DirectiveDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
keys
= ['loc', 'description', 'name', 'arguments', 'repeatable', 'locations']¶
-
kind
= 'directive_definition'¶
-
loc
¶
-
locations
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NameNode]¶
-
name
: graphql.language.ast.NameNode¶
-
repeatable
: bool¶
-
-
class
graphql.language.
DirectiveNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.ArgumentNode]¶
-
keys
= ['loc', 'name', 'arguments']¶
-
kind
= 'directive'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
DocumentNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
definitions
: graphql.pyutils.frozen_list.FrozenList[DefinitionNode]¶
-
keys
= ['loc', 'definitions']¶
-
kind
= 'document'¶
-
loc
¶
-
-
class
graphql.language.
EnumTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
keys
= ['loc', 'description', 'name', 'directives', 'values']¶
-
kind
= 'enum_type_definition'¶
-
loc
¶
-
name
¶
-
values
: Optional[graphql.pyutils.frozen_list.FrozenList[EnumValueDefinitionNode]]¶
-
-
class
graphql.language.
EnumTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'values']¶
-
kind
= 'enum_type_extension'¶
-
loc
¶
-
name
¶
-
values
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.EnumValueDefinitionNode]]¶
-
-
class
graphql.language.
EnumValueDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'enum_value_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
EnumValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'enum_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
ExecutableDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set']¶
-
kind
= 'executable_definition'¶
-
loc
¶
-
name
: Optional[graphql.language.ast.NameNode]¶
-
selection_set
: SelectionSetNode¶
-
variable_definitions
: graphql.pyutils.frozen_list.FrozenList[VariableDefinitionNode]¶
-
-
class
graphql.language.
FieldDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[InputValueDefinitionNode]]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'arguments', 'type']¶
-
kind
= 'field_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
FieldNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
alias
: Optional[graphql.language.ast.NameNode]¶
-
arguments
: Optional[graphql.pyutils.frozen_list.FrozenList[ArgumentNode]]¶
-
directives
¶
-
keys
= ['loc', 'directives', 'alias', 'name', 'arguments', 'selection_set']¶
-
kind
= 'field'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
selection_set
: Optional[graphql.language.ast.SelectionSetNode]¶
-
-
class
graphql.language.
FloatValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'float_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
FragmentDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.ExecutableDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set', 'type_condition']¶
-
kind
= 'fragment_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
selection_set
¶
-
type_condition
: NamedTypeNode¶
-
variable_definitions
¶
-
-
class
graphql.language.
FragmentSpreadNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'directives', 'name']¶
-
kind
= 'fragment_spread'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
InlineFragmentNode
(**kwargs)¶ Bases:
graphql.language.ast.SelectionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'directives', 'type_condition', 'selection_set']¶
-
kind
= 'inline_fragment'¶
-
loc
¶
-
selection_set
: graphql.language.ast.SelectionSetNode¶
-
type_condition
: NamedTypeNode¶
-
-
class
graphql.language.
InputObjectTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'fields']¶
-
kind
= 'input_object_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InputObjectTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.InputValueDefinitionNode]]¶
-
keys
= ['loc', 'name', 'directives', 'fields']¶
-
kind
= 'input_object_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InputValueDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
default_value
: Optional[graphql.language.ast.ValueNode]¶
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'type', 'default_value']¶
-
kind
= 'input_value_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
IntValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'int_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
InterfaceTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'fields', 'interfaces']¶
-
kind
= 'interface_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
InterfaceTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'interface_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
ListTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'type']¶
-
kind
= 'list_type'¶
-
loc
¶
-
type
: graphql.language.ast.TypeNode¶
-
-
class
graphql.language.
ListValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'values']¶
-
kind
= 'list_value'¶
-
loc
¶
-
values
: graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.ValueNode]¶
-
-
class
graphql.language.
NameNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'value']¶
-
kind
= 'name'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
NamedTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name']¶
-
kind
= 'named_type'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
NonNullTypeNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'type']¶
-
kind
= 'non_null_type'¶
-
loc
¶
-
type
: Union[graphql.language.ast.NamedTypeNode, graphql.language.ast.ListTypeNode]¶
-
-
class
graphql.language.
NullValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'null_value'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
ObjectFieldNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'name', 'value']¶
-
kind
= 'object_field'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
value
: graphql.language.ast.ValueNode¶
-
-
class
graphql.language.
ObjectTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'object_type_definition'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
ObjectTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
fields
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.FieldDefinitionNode]]¶
-
interfaces
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
keys
= ['loc', 'name', 'directives', 'interfaces', 'fields']¶
-
kind
= 'object_type_extension'¶
-
loc
¶
-
name
¶
-
-
class
graphql.language.
ObjectValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
fields
: graphql.pyutils.frozen_list.FrozenList[ObjectFieldNode]¶
-
keys
= ['loc', 'fields']¶
-
kind
= 'object_value'¶
-
loc
¶
-
-
class
graphql.language.
OperationDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.ExecutableDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'variable_definitions', 'selection_set', 'operation']¶
-
kind
= 'operation_definition'¶
-
loc
¶
-
name
¶
-
operation
: graphql.language.ast.OperationType¶
-
selection_set
¶
-
variable_definitions
¶
-
-
class
graphql.language.
OperationType
(value)¶ Bases:
enum.Enum
An enumeration.
-
MUTATION
= 'mutation'¶
-
QUERY
= 'query'¶
-
SUBSCRIPTION
= 'subscription'¶
-
-
class
graphql.language.
OperationTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'operation', 'type']¶
-
kind
= 'operation_type_definition'¶
-
loc
¶
-
operation
: graphql.language.ast.OperationType¶
-
type
: graphql.language.ast.NamedTypeNode¶
-
-
class
graphql.language.
ScalarTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'scalar_type_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
ScalarTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives']¶
-
kind
= 'scalar_type_extension'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
SchemaDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'directives', 'operation_types']¶
-
kind
= 'schema_definition'¶
-
loc
¶
-
operation_types
: graphql.pyutils.frozen_list.FrozenList[OperationTypeDefinitionNode]¶
-
-
class
graphql.language.
SchemaExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'directives', 'operation_types']¶
-
kind
= 'schema_extension'¶
-
loc
¶
-
operation_types
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.OperationTypeDefinitionNode]]¶
-
-
class
graphql.language.
SelectionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[DirectiveNode]]¶
-
keys
= ['loc', 'directives']¶
-
kind
= 'selection'¶
-
loc
¶
-
-
class
graphql.language.
SelectionSetNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc', 'selections']¶
-
kind
= 'selection_set'¶
-
loc
¶
-
selections
: graphql.pyutils.frozen_list.FrozenList[SelectionNode]¶
-
-
class
graphql.language.
StringValueNode
(**kwargs)¶ Bases:
graphql.language.ast.ValueNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
block
: Optional[bool]¶
-
keys
= ['loc', 'value', 'block']¶
-
kind
= 'string_value'¶
-
loc
¶
-
value
: str¶
-
-
class
graphql.language.
TypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
: Optional[graphql.language.ast.StringValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'description', 'name', 'directives']¶
-
kind
= 'type_definition'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
TypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeSystemDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.DirectiveNode]]¶
-
keys
= ['loc', 'name', 'directives']¶
-
kind
= 'type_extension'¶
-
loc
¶
-
name
: graphql.language.ast.NameNode¶
-
-
class
graphql.language.
TypeNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'type'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
TypeSystemDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.DefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'type_system_definition'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
graphql.language.
TypeSystemExtensionNode
¶
-
class
graphql.language.
UnionTypeDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeDefinitionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
description
¶
-
directives
¶
-
keys
= ['loc', 'description', 'name', 'directives', 'types']¶
-
kind
= 'union_type_definition'¶
-
loc
¶
-
name
¶
-
types
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
-
class
graphql.language.
UnionTypeExtensionNode
(**kwargs)¶ Bases:
graphql.language.ast.TypeExtensionNode
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
directives
¶
-
keys
= ['loc', 'name', 'directives', 'types']¶
-
kind
= 'union_type_extension'¶
-
loc
¶
-
name
¶
-
types
: Optional[graphql.pyutils.frozen_list.FrozenList[graphql.language.ast.NamedTypeNode]]¶
-
-
class
graphql.language.
ValueNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
keys
= ['loc']¶
-
kind
: str = 'value'¶
-
loc
: Optional[graphql.language.ast.Location]¶
-
-
class
graphql.language.
VariableDefinitionNode
(**kwargs)¶ Bases:
graphql.language.ast.Node
-
__init__
(**kwargs)¶ Initialize the node with the given keyword arguments.
-
default_value
: Optional[ValueNode]¶
-
directives
: Optional[graphql.pyutils.frozen_list.FrozenList[DirectiveNode]]¶
-
keys
= ['loc', 'variable', 'type', 'default_value', 'directives']¶
-
kind
= 'variable_definition'¶
-
loc
¶
-
type
: TypeNode¶
-
variable
: VariableNode¶
-
Lexer¶
-
class
graphql.language.
Lexer
(source: graphql.language.source.Source)¶ Bases:
object
GraphQL Lexer
A Lexer is a stateful stream generator in that every time it is advanced, it returns the next token in the Source. Assuming the source lexes, the final Token emitted by the lexer will be of kind EOF, after which the lexer will repeatedly return the same EOF token whenever called.
-
__init__
(source: graphql.language.source.Source)¶ Given a Source object, initialize a Lexer for that source.
-
advance
() → graphql.language.ast.Token¶ Advance the token stream to the next non-ignored token.
-
lookahead
() → graphql.language.ast.Token¶ Look ahead and return the next non-ignored token, but do not change state.
-
position_after_whitespace
(body: str, start_position: int) → int¶ Go to next position after a whitespace.
Reads from body starting at start_position until it finds a non-whitespace character, then returns the position of that character for lexing.
-
read_block_string
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶
-
read_comment
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read a comment token from the source file.
-
read_digits
(start: int, char: str) → int¶ Return the new position in the source after reading digits.
-
read_name
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read an alphanumeric + underscore name from the source.
-
read_number
(start: int, char: str, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Reads a number token from the source file.
Either a float or an int depending on whether a decimal point appears.
-
read_string
(start: int, line: int, col: int, prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Read a string token from the source file.
-
read_token
(prev: graphql.language.ast.Token) → graphql.language.ast.Token¶ Get the next token from the source starting at the given position.
This skips over whitespace until it finds the next lexable token, then lexes punctuators immediately or calls the appropriate helper function for more complicated tokens.
-
-
class
graphql.language.
TokenKind
(value)¶ Bases:
enum.Enum
The different kinds of tokens that the lexer emits
-
AMP
= '&'¶
-
AT
= '@'¶
-
BANG
= '!'¶
-
BLOCK_STRING
= 'BlockString'¶
-
BRACE_L
= '{'¶
-
BRACE_R
= '}'¶
-
BRACKET_L
= '['¶
-
BRACKET_R
= ']'¶
-
COLON
= ':'¶
-
COMMENT
= 'Comment'¶
-
DOLLAR
= '$'¶
-
EOF
= '<EOF>'¶
-
EQUALS
= '='¶
-
FLOAT
= 'Float'¶
-
INT
= 'Int'¶
-
NAME
= 'Name'¶
-
PAREN_L
= '('¶
-
PAREN_R
= ')'¶
-
PIPE
= '|'¶
-
SOF
= '<SOF>'¶
-
SPREAD
= '...'¶
-
STRING
= 'String'¶
-
-
class
graphql.language.
Token
(kind: graphql.language.token_kind.TokenKind, start: int, end: int, line: int, column: int, prev: Optional[Token] = None, value: Optional[str] = None)¶ Bases:
object
AST Token
Represents a range of characters represented by a lexical token within a Source.
-
__init__
(kind: graphql.language.token_kind.TokenKind, start: int, end: int, line: int, column: int, prev: Optional[Token] = None, value: Optional[str] = None) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
column
: int¶
-
property
desc
¶ A helper property to describe a token as a string for debugging
-
end
: int¶
-
kind
: graphql.language.token_kind.TokenKind¶
-
line
: int¶
-
next
: Optional[Token]¶
-
prev
: Optional[Token]¶
-
start
: int¶
-
value
: Optional[str]¶
-
Location¶
-
graphql.language.
get_location
(source: Source, position: int) → graphql.language.location.SourceLocation¶ Get the line and column for a character position in the source.
Takes a Source and a UTF-8 character offset, and returns the corresponding line and column as a SourceLocation.
-
class
graphql.language.
SourceLocation
(line: int, column: int)¶ Bases:
tuple
Represents a location in a Source.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
_asdict
()¶ Return a new dict which maps field names to their values.
-
_field_defaults
= {}¶
-
_fields
= ('line', 'column')¶
-
classmethod
_make
(iterable)¶ Make a new SourceLocation object from a sequence or iterable
-
_replace
(**kwds)¶ Return a new SourceLocation object replacing specified fields with new values
-
column
: int¶ Alias for field number 1
-
count
(value, /)¶ Return number of occurrences of value.
-
property
formatted
¶
-
index
(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
line
: int¶ Alias for field number 0
-
-
graphql.language.
print_location
(location: graphql.language.ast.Location) → str¶ Render a helpful description of the location in the GraphQL Source document.
Parser¶
-
graphql.language.
parse
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.DocumentNode¶ Given a GraphQL source, parse it into a Document.
Throws GraphQLError if a syntax error is encountered.
By default, the parser creates AST nodes that know the location in the source that they correspond to. The
no_location
option disables that behavior for performance or testing.Experimental features:
If
experimental_fragment_variables
is set toTrue
, the parser will understand and parse variable definitions contained in a fragment definition. They’ll be represented in thevariable_definitions
field of theFragmentDefinitionNode
.The syntax is identical to normal, query-defined variables. For example:
fragment A($var: Boolean = false) on T { ... }
-
graphql.language.
parse_type
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.TypeNode¶ Parse the AST for a given string containing a GraphQL Type.
Throws GraphQLError if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function:
value_from_ast()
.
-
graphql.language.
parse_value
(source: Union[graphql.language.source.Source, str], no_location=False, experimental_fragment_variables=False) → graphql.language.ast.ValueNode¶ Parse the AST for a given string containing a GraphQL value.
Throws GraphQLError if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Values directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function:
value_from_ast()
.
Source¶
-
class
graphql.language.
Source
(body: str, name: str = 'GraphQL request', location_offset: graphql.language.location.SourceLocation = SourceLocation(line=1, column=1))¶ Bases:
object
A representation of source input to GraphQL.
-
__init__
(body: str, name: str = 'GraphQL request', location_offset: graphql.language.location.SourceLocation = SourceLocation(line=1, column=1)) → None¶ Initialize source input.
name
andlocation_offset
are optional. They are useful for clients who store GraphQL documents in source files; for example, if the GraphQL input starts at line 40 in a file named Foo.graphql, it might be useful for name to be “Foo.graphql” and location to be(40, 0)
.line and column in location_offset are 1-indexed
-
body
¶
-
get_location
(position: int) → graphql.language.location.SourceLocation¶
-
location_offset
¶
-
name
¶
-
-
graphql.language.
print_source_location
(source: graphql.language.source.Source, source_location: graphql.language.location.SourceLocation) → str¶ Render a helpful description of the location in the GraphQL Source document.
Visitor¶
-
graphql.language.
visit
(root: graphql.language.ast.Node, visitor: graphql.language.visitor.Visitor, visitor_keys=None) → Any¶ Visit each node in an AST.
visit()
will walk through an AST using a depth first traversal, calling the visitor’s enter methods at each node in the traversal, and calling the leave methods after visiting that node and all of its child nodes.By returning different values from the enter and leave methods, the behavior of the visitor can be altered, including skipping over a sub-tree of the AST (by returning False), editing the AST by returning a value or None to remove the value, or to stop the whole traversal by returning
BREAK
.When using
visit()
to edit an AST, the original AST will not be modified, and a new version of the AST with the changes applied will be returned from the visit function.To customize the node attributes to be used for traversal, you can provide a dictionary visitor_keys mapping node kinds to node attributes.
-
class
graphql.language.
Visitor
¶ Bases:
object
Visitor that walks through an AST.
Visitors can define two generic methods “enter” and “leave”. The former will be called when a node is entered in the traversal, the latter is called after visiting the node and its child nodes. These methods have the following signature:
def enter(self, node, key, parent, path, ancestors): # The return value has the following meaning: # IDLE (None): no action # SKIP: skip visiting this node # BREAK: stop visiting altogether # REMOVE: delete this node # any other value: replace this node with the returned value return def leave(self, node, key, parent, path, ancestors): # The return value has the following meaning: # IDLE (None) or SKIP: no action # BREAK: stop visiting altogether # REMOVE: delete this node # any other value: replace this node with the returned value return
The parameters have the following meaning:
- Parameters
node – The current node being visiting.
key – The index or key to this node from the parent node or Array.
parent – the parent immediately above this node, which may be an Array.
path – The key path to get to this node from the root node.
ancestors – All nodes and Arrays visited before reaching parent of this node. These correspond to array indices in
path
. Note: ancestors includes arrays which contain the parent of visited node.
You can also define node kind specific methods by suffixing them with an underscore followed by the kind of the node to be visited. For instance, to visit
field
nodes, you would defined the methodsenter_field()
and/orleave_field()
, with the same signature as above. If no kind specific method has been defined for a given node, the generic method is called.-
BREAK
= True¶
-
IDLE
= None¶
-
REMOVE
= Ellipsis¶
-
SKIP
= False¶
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
get_visit_fn
(kind, is_leaving=False) → Callable¶ Get the visit function for the given node kind and direction.
-
class
graphql.language.
ParallelVisitor
(visitors: Collection[graphql.language.visitor.Visitor])¶ Bases:
graphql.language.visitor.Visitor
A Visitor which delegates to many visitors to run in parallel.
Each visitor will be visited for each node before moving on.
If a prior visitor edits a node, no following visitors will see that node.
-
BREAK
= True¶
-
IDLE
= None¶
-
REMOVE
= Ellipsis¶
-
SKIP
= False¶
-
__init__
(visitors: Collection[graphql.language.visitor.Visitor])¶ Create a new visitor from the given list of parallel visitors.
-
enter
(node, *args)¶
-
classmethod
get_visit_fn
(kind, is_leaving=False) → Callable¶ Get the visit function for the given node kind and direction.
-
leave
(node, *args)¶
-
The module also exports the following special symbols which can be used as
return values in the Visitor
methods to signal particular actions:
-
graphql.language.
BREAK
= True¶ This return value signals that no further nodes shall be visited.
-
graphql.language.
SKIP
= False¶ This return value signals that the current node shall be skipped.
-
graphql.language.
REMOVE
= Ellipsis¶ This return value signals that the current node shall be deleted.
-
graphql.language.
IDLE
= None¶ This return value signals that no additional action shall take place.