py_gql.lang.ast#

GraphQL AST representations corresponding to the GraphQL language elements.

class py_gql.lang.ast.Node[source]#

Bases: object

Base AST node.

source = None#
loc = None#
copy()#
deepcopy()[source]#
to_dict()[source]#

Convert the current node and all of its children to a JSON serializable format.

This is mostly useful for testing and when you need to convert nodes to JSON such as interop with other languages, printing and serialisation.

The conversion rules are:

  • Each Node subclass is converted to a dict of their own converted attributes adding a __kind__ key corresponding to the node’s classname.

  • Primitive values (int, strings, etc.) are left as is.

  • Lists are converted per-element.

Returns

Converted value

Return type

Dict[str, Any]

class py_gql.lang.ast.Name(value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

value#
source#
loc#
class py_gql.lang.ast.Definition[source]#

Bases: py_gql.lang.ast.Node

class py_gql.lang.ast.ExecutableDefinition[source]#

Bases: py_gql.lang.ast.Definition

class py_gql.lang.ast.Value[source]#

Bases: py_gql.lang.ast.Node

class py_gql.lang.ast.Type[source]#

Bases: py_gql.lang.ast.Node

class py_gql.lang.ast.SupportDirectives[source]#

Bases: object

directives = NotImplemented#
class py_gql.lang.ast.NamedType(name, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Type

name#
source#
loc#
class py_gql.lang.ast.ListType(type, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Type

type#
source#
loc#
class py_gql.lang.ast.NonNullType(type, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Type

type#
source#
loc#
class py_gql.lang.ast.Document(definitions=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

definitions#
source#
loc#
class py_gql.lang.ast.OperationDefinition(operation, selection_set, name=None, variable_definitions=None, directives=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.ExecutableDefinition

operation#
name#
selection_set#
variable_definitions#
directives#
source#
loc#
class py_gql.lang.ast.Variable(name, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

name#
source#
loc#
class py_gql.lang.ast.VariableDefinition(variable, type, default_value=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

variable#
type#
default_value#
source#
loc#
class py_gql.lang.ast.Selection[source]#

Bases: py_gql.lang.ast.Node

class py_gql.lang.ast.SelectionSet(selections=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

selections#
source#
loc#
class py_gql.lang.ast.Field(name, alias=None, arguments=None, directives=None, selection_set=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.Selection

alias#
name#
arguments#
directives#
selection_set#
source#
loc#
property response_name#
Return type

str

class py_gql.lang.ast.Argument(name, value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

name#
value#
source#
loc#
class py_gql.lang.ast.FragmentSpread(name, directives=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.Selection

name#
directives#
source#
loc#
class py_gql.lang.ast.InlineFragment(selection_set, type_condition=None, directives=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.Selection

type_condition#
directives#
selection_set#
source#
loc#
class py_gql.lang.ast.FragmentDefinition(name, type_condition, selection_set, variable_definitions=None, directives=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.ExecutableDefinition

name#
variable_definitions#
type_condition#
directives#
selection_set#
loc#
class py_gql.lang.ast.IntValue(value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast._StringValue

loc#
source#
value#
class py_gql.lang.ast.FloatValue(value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast._StringValue

loc#
source#
value#
class py_gql.lang.ast.StringValue(value, block=False, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Value

value#
block#
source#
loc#
class py_gql.lang.ast.BooleanValue(value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Value

value#
source#
loc#
class py_gql.lang.ast.NullValue(source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Value

source#
loc#
class py_gql.lang.ast.EnumValue(value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast._StringValue

loc#
source#
value#
class py_gql.lang.ast.ListValue(values, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Value

values#
source#
loc#
class py_gql.lang.ast.ObjectValue(fields, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Value

fields#
source#
loc#
class py_gql.lang.ast.ObjectField(name, value, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

name#
value#
source#
loc#
class py_gql.lang.ast.Directive(name, arguments=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

name#
arguments#
source#
loc#
class py_gql.lang.ast.SupportDescription[source]#

Bases: object

description = NotImplemented#
class py_gql.lang.ast.TypeSystemDefinition[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.Definition

class py_gql.lang.ast.SchemaDefinition(directives=None, operation_types=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeSystemDefinition

directives#
operation_types#
source#
loc#
class py_gql.lang.ast.OperationTypeDefinition(operation, type, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.Node

operation#
type#
source#
loc#
class py_gql.lang.ast.TypeDefinition[source]#

Bases: py_gql.lang.ast.SupportDescription, py_gql.lang.ast.TypeSystemDefinition

name = NotImplemented#
class py_gql.lang.ast.ScalarTypeDefinition(name, directives=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
directives#
source#
loc#
description#
class py_gql.lang.ast.ObjectTypeDefinition(name, interfaces=None, directives=None, fields=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
interfaces#
directives#
fields#
source#
loc#
description#
class py_gql.lang.ast.FieldDefinition(name, type, arguments=None, directives=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.SupportDescription, py_gql.lang.ast.Node

name#
arguments#
type#
directives#
source#
loc#
description#
class py_gql.lang.ast.InputValueDefinition(name, type, default_value=None, directives=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.SupportDescription, py_gql.lang.ast.Node

name#
type#
default_value#
directives#
source#
loc#
description#
class py_gql.lang.ast.InterfaceTypeDefinition(name, directives=None, fields=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
directives#
fields#
source#
loc#
description#
class py_gql.lang.ast.UnionTypeDefinition(name, directives=None, types=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
directives#
types#
source#
loc#
description#
class py_gql.lang.ast.EnumTypeDefinition(name, directives=None, values=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
directives#
values#
source#
loc#
description#
class py_gql.lang.ast.EnumValueDefinition(name, directives=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.SupportDirectives, py_gql.lang.ast.SupportDescription, py_gql.lang.ast.Node

name#
directives#
source#
loc#
description#
class py_gql.lang.ast.InputObjectTypeDefinition(name, directives=None, fields=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.TypeDefinition

name#
directives#
fields#
source#
loc#
description#
class py_gql.lang.ast.TypeSystemExtension[source]#

Bases: py_gql.lang.ast.TypeSystemDefinition

class py_gql.lang.ast.SchemaExtension(directives=None, operation_types=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeSystemExtension

directives#
operation_types#
source#
loc#
class py_gql.lang.ast.TypeExtension[source]#

Bases: py_gql.lang.ast.TypeSystemExtension

name = NotImplemented#
class py_gql.lang.ast.ScalarTypeExtension(name, directives=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
directives#
source#
loc#
class py_gql.lang.ast.ObjectTypeExtension(name, interfaces=None, directives=None, fields=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
interfaces#
directives#
fields#
source#
loc#
class py_gql.lang.ast.InterfaceTypeExtension(name, directives=None, fields=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
directives#
fields#
source#
loc#
class py_gql.lang.ast.UnionTypeExtension(name, directives=None, types=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
directives#
types#
source#
loc#
class py_gql.lang.ast.EnumTypeExtension(name, directives=None, values=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
directives#
values#
source#
loc#
class py_gql.lang.ast.InputObjectTypeExtension(name, directives=None, fields=None, source=None, loc=None)[source]#

Bases: py_gql.lang.ast.TypeExtension

name#
directives#
fields#
source#
loc#
class py_gql.lang.ast.DirectiveDefinition(name, arguments=None, locations=None, source=None, loc=None, description=None)[source]#

Bases: py_gql.lang.ast.SupportDescription, py_gql.lang.ast.TypeSystemDefinition

name#
arguments#
locations#
source#
loc#
description#