Skip to content

Commit cd1c50f

Browse files
committed
Run Black autoformatting on all the files
1 parent 54df11f commit cd1c50f

File tree

91 files changed

+8553
-6820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+8553
-6820
lines changed

graphql/__init__.py

Lines changed: 98 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''
1+
"""
22
GraphQL.js provides a reference implementation for the GraphQL specification
33
but is also a useful utility for operating on GraphQL files and building
44
sophisticated tools.
@@ -20,18 +20,15 @@
2020
2121
from graphql import parse
2222
from graphql.language.base import parse
23-
'''
23+
"""
2424
from .pyutils.version import get_version
2525

2626
# The primary entry point into fulfilling a GraphQL request.
27-
from .graphql import (
28-
graphql
29-
)
27+
from .graphql import graphql
3028

3129
# Create and operate on GraphQL type definitions and schema.
3230
from .type import ( # no import order
3331
GraphQLSchema,
34-
3532
# Definitions
3633
GraphQLScalarType,
3734
GraphQLObjectType,
@@ -45,32 +42,25 @@
4542
GraphQLField,
4643
GraphQLInputObjectField,
4744
GraphQLArgument,
48-
4945
# "Enum" of Type Kinds
5046
TypeKind,
51-
5247
# "Enum" of Directive locations
5348
DirectiveLocation,
54-
5549
# Scalars
5650
GraphQLInt,
5751
GraphQLFloat,
5852
GraphQLString,
5953
GraphQLBoolean,
6054
GraphQLID,
61-
6255
# Directive definition
6356
GraphQLDirective,
64-
6557
# Built-in directives defined by the Spec
6658
specified_directives,
6759
GraphQLSkipDirective,
6860
GraphQLIncludeDirective,
6961
GraphQLDeprecatedDirective,
70-
7162
# Constant Deprecation Reason
7263
DEFAULT_DEPRECATION_REASON,
73-
7464
# GraphQL Types for introspection.
7565
__Schema,
7666
__Directive,
@@ -80,20 +70,17 @@
8070
__InputValue,
8171
__EnumValue,
8272
__TypeKind,
83-
8473
# Meta-field definitions.
8574
SchemaMetaFieldDef,
8675
TypeMetaFieldDef,
8776
TypeNameMetaFieldDef,
88-
8977
# Predicates
9078
is_type,
9179
is_input_type,
9280
is_output_type,
9381
is_leaf_type,
9482
is_composite_type,
9583
is_abstract_type,
96-
9784
# Un-modifiers
9885
get_nullable_type,
9986
get_named_type,
@@ -103,14 +90,11 @@
10390
from .language.base import ( # no import order
10491
Source,
10592
get_location,
106-
10793
# Parse
10894
parse,
10995
parse_value,
110-
11196
# Print
11297
print_ast,
113-
11498
# Visit
11599
visit,
116100
ParallelVisitor,
@@ -124,72 +108,51 @@
124108
subscribe,
125109
ResolveInfo,
126110
MiddlewareManager,
127-
middlewares
111+
middlewares,
128112
)
129113

130114
# Validate GraphQL queries.
131-
from .validation import ( # no import order
132-
validate,
133-
specified_rules,
134-
)
115+
from .validation import validate, specified_rules # no import order
135116

136117
# Create and format GraphQL errors.
137-
from .error import (
138-
GraphQLError,
139-
format_error,
140-
)
118+
from .error import GraphQLError, format_error
141119

142120
# Utilities for operating on GraphQL type schema and parsed sources.
143121
from .utils.base import (
144122
# The GraphQL query recommended for a full schema introspection.
145123
introspection_query,
146-
147124
# Gets the target Operation from a Document
148125
get_operation_ast,
149-
150126
# Build a GraphQLSchema from an introspection result.
151127
build_client_schema,
152-
153128
# Build a GraphQLSchema from a parsed GraphQL Schema language AST.
154129
build_ast_schema,
155-
156130
# Extends an existing GraphQLSchema from a parsed GraphQL Schema
157131
# language AST.
158132
extend_schema,
159-
160133
# Print a GraphQLSchema to GraphQL Schema language.
161134
print_schema,
162-
163135
# Create a GraphQLType from a GraphQL language AST.
164136
type_from_ast,
165-
166137
# Create a JavaScript value from a GraphQL language AST.
167138
value_from_ast,
168-
169139
# Create a GraphQL language AST from a JavaScript value.
170140
ast_from_value,
171-
172141
# A helper to use within recursive-descent visitors which need to be aware of
173142
# the GraphQL type system.
174143
TypeInfo,
175-
176144
# Determine if JavaScript values adhere to a GraphQL type.
177145
is_valid_value,
178-
179146
# Determine if AST values adhere to a GraphQL type.
180147
is_valid_literal_value,
181-
182148
# Concatenates multiple AST together.
183149
concat_ast,
184-
185150
# Comparators for types
186151
is_equal_type,
187152
is_type_sub_type_of,
188153
do_types_overlap,
189-
190154
# Asserts a string is a valid GraphQL name.
191155
assert_valid_name,
192-
193156
# Undefined const
194157
Undefined,
195158
)
@@ -205,100 +168,100 @@
205168
set_default_backend,
206169
)
207170

208-
VERSION = (2, 1, 0, 'rc', 2)
171+
VERSION = (2, 1, 0, "rc", 2)
209172
__version__ = get_version(VERSION)
210173

211174

212175
__all__ = (
213-
'__version__',
214-
'graphql',
215-
'GraphQLBoolean',
216-
'GraphQLEnumType',
217-
'GraphQLEnumValue',
218-
'GraphQLFloat',
219-
'GraphQLID',
220-
'GraphQLInputObjectType',
221-
'GraphQLInt',
222-
'GraphQLInterfaceType',
223-
'GraphQLList',
224-
'GraphQLNonNull',
225-
'GraphQLField',
226-
'GraphQLInputObjectField',
227-
'GraphQLArgument',
228-
'GraphQLObjectType',
229-
'GraphQLScalarType',
230-
'GraphQLSchema',
231-
'GraphQLString',
232-
'GraphQLUnionType',
233-
'GraphQLDirective',
234-
'specified_directives',
235-
'GraphQLSkipDirective',
236-
'GraphQLIncludeDirective',
237-
'GraphQLDeprecatedDirective',
238-
'DEFAULT_DEPRECATION_REASON',
239-
'TypeKind',
240-
'DirectiveLocation',
241-
'__Schema',
242-
'__Directive',
243-
'__DirectiveLocation',
244-
'__Type',
245-
'__Field',
246-
'__InputValue',
247-
'__EnumValue',
248-
'__TypeKind',
249-
'SchemaMetaFieldDef',
250-
'TypeMetaFieldDef',
251-
'TypeNameMetaFieldDef',
252-
'get_named_type',
253-
'get_nullable_type',
254-
'is_abstract_type',
255-
'is_composite_type',
256-
'is_input_type',
257-
'is_leaf_type',
258-
'is_output_type',
259-
'is_type',
260-
'BREAK',
261-
'ParallelVisitor',
262-
'Source',
263-
'TypeInfoVisitor',
264-
'get_location',
265-
'parse',
266-
'parse_value',
267-
'print_ast',
268-
'visit',
269-
'execute',
270-
'subscribe',
271-
'ResolveInfo',
272-
'MiddlewareManager',
273-
'middlewares',
274-
'specified_rules',
275-
'validate',
276-
'GraphQLError',
277-
'format_error',
278-
'TypeInfo',
279-
'assert_valid_name',
280-
'ast_from_value',
281-
'build_ast_schema',
282-
'build_client_schema',
283-
'concat_ast',
284-
'do_types_overlap',
285-
'extend_schema',
286-
'get_operation_ast',
287-
'introspection_query',
288-
'is_equal_type',
289-
'is_type_sub_type_of',
290-
'is_valid_literal_value',
291-
'is_valid_value',
292-
'print_schema',
293-
'type_from_ast',
294-
'value_from_ast',
295-
'get_version',
296-
'Undefined',
297-
'GraphQLBackend',
298-
'GraphQLDocument',
299-
'GraphQLCoreBackend',
300-
'GraphQLDeciderBackend',
301-
'GraphQLCachedBackend',
302-
'get_default_backend',
303-
'set_default_backend',
176+
"__version__",
177+
"graphql",
178+
"GraphQLBoolean",
179+
"GraphQLEnumType",
180+
"GraphQLEnumValue",
181+
"GraphQLFloat",
182+
"GraphQLID",
183+
"GraphQLInputObjectType",
184+
"GraphQLInt",
185+
"GraphQLInterfaceType",
186+
"GraphQLList",
187+
"GraphQLNonNull",
188+
"GraphQLField",
189+
"GraphQLInputObjectField",
190+
"GraphQLArgument",
191+
"GraphQLObjectType",
192+
"GraphQLScalarType",
193+
"GraphQLSchema",
194+
"GraphQLString",
195+
"GraphQLUnionType",
196+
"GraphQLDirective",
197+
"specified_directives",
198+
"GraphQLSkipDirective",
199+
"GraphQLIncludeDirective",
200+
"GraphQLDeprecatedDirective",
201+
"DEFAULT_DEPRECATION_REASON",
202+
"TypeKind",
203+
"DirectiveLocation",
204+
"__Schema",
205+
"__Directive",
206+
"__DirectiveLocation",
207+
"__Type",
208+
"__Field",
209+
"__InputValue",
210+
"__EnumValue",
211+
"__TypeKind",
212+
"SchemaMetaFieldDef",
213+
"TypeMetaFieldDef",
214+
"TypeNameMetaFieldDef",
215+
"get_named_type",
216+
"get_nullable_type",
217+
"is_abstract_type",
218+
"is_composite_type",
219+
"is_input_type",
220+
"is_leaf_type",
221+
"is_output_type",
222+
"is_type",
223+
"BREAK",
224+
"ParallelVisitor",
225+
"Source",
226+
"TypeInfoVisitor",
227+
"get_location",
228+
"parse",
229+
"parse_value",
230+
"print_ast",
231+
"visit",
232+
"execute",
233+
"subscribe",
234+
"ResolveInfo",
235+
"MiddlewareManager",
236+
"middlewares",
237+
"specified_rules",
238+
"validate",
239+
"GraphQLError",
240+
"format_error",
241+
"TypeInfo",
242+
"assert_valid_name",
243+
"ast_from_value",
244+
"build_ast_schema",
245+
"build_client_schema",
246+
"concat_ast",
247+
"do_types_overlap",
248+
"extend_schema",
249+
"get_operation_ast",
250+
"introspection_query",
251+
"is_equal_type",
252+
"is_type_sub_type_of",
253+
"is_valid_literal_value",
254+
"is_valid_value",
255+
"print_schema",
256+
"type_from_ast",
257+
"value_from_ast",
258+
"get_version",
259+
"Undefined",
260+
"GraphQLBackend",
261+
"GraphQLDocument",
262+
"GraphQLCoreBackend",
263+
"GraphQLDeciderBackend",
264+
"GraphQLCachedBackend",
265+
"get_default_backend",
266+
"set_default_backend",
304267
)

graphql/backend/quiver_cloud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def generate_source(self, schema, query):
7878
json_payload={"query": GRAPHQL_QUERY, "variables": variables},
7979
)
8080

81-
errors = json_response.get('errors')
81+
errors = json_response.get("errors")
8282
if errors:
83-
raise Exception(errors[0].get('message'))
83+
raise Exception(errors[0].get("message"))
8484
data = json_response.get("data", {})
8585
code_generation = data.get("generateCode", {})
8686
code = code_generation.get("code")

graphql/backend/tests/schema.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from graphql.type import (GraphQLField, GraphQLObjectType,
2-
GraphQLSchema, GraphQLString)
1+
from graphql.type import GraphQLField, GraphQLObjectType, GraphQLSchema, GraphQLString
32

43

5-
Query = GraphQLObjectType('Query', lambda: {
6-
'hello': GraphQLField(GraphQLString, resolver=lambda *_: "World"),
7-
})
4+
Query = GraphQLObjectType(
5+
"Query", lambda: {"hello": GraphQLField(GraphQLString, resolver=lambda *_: "World")}
6+
)
87

98
schema = GraphQLSchema(Query)

graphql/backend/tests/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ def test_set_default_backend_fails_if_invalid_backend():
2222
default_backend = get_default_backend()
2323
with pytest.raises(Exception) as exc_info:
2424
set_default_backend(object())
25-
assert str(exc_info.value) == 'backend must be an instance of GraphQLBackend.'
25+
assert str(exc_info.value) == "backend must be an instance of GraphQLBackend."
2626
assert get_default_backend() == default_backend

0 commit comments

Comments
 (0)