Skip to content

Commit b668e47

Browse files
committed
Reformat with latest black version (20.8b1)
1 parent a455edf commit b668e47

20 files changed

+142
-57
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pytest-benchmark = "^3.2"
3838
pytest-cov = "^2.10"
3939
pytest-describe = "^1.0"
4040
pytest-timeout = "^1.4"
41-
black = "19.10b0"
41+
black = "20.8b1"
4242
flake8 = "^3.8"
4343
mypy = "0.782"
4444
codecov = "^2"

src/graphql/execution/execute.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,9 @@ async def await_and_set_result(
392392
elif is_awaitable(result):
393393
# noinspection PyShadowingNames
394394
async def set_result(
395-
results: Dict[str, Any], response_name: str, result: Awaitable,
395+
results: Dict[str, Any],
396+
response_name: str,
397+
result: Awaitable,
396398
) -> Dict[str, Any]:
397399
results[response_name] = await result
398400
return results

src/graphql/type/schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ def is_possible_type(
317317
return self.is_sub_type(abstract_type, possible_type)
318318

319319
def is_sub_type(
320-
self, abstract_type: GraphQLAbstractType, maybe_sub_type: GraphQLNamedType,
320+
self,
321+
abstract_type: GraphQLAbstractType,
322+
maybe_sub_type: GraphQLNamedType,
321323
) -> bool:
322324
"""Check whether a type is a subtype of a given abstract type."""
323325
types = self._sub_type_map.get(abstract_type.name)

src/graphql/utilities/type_from_ast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ def type_from_ast(schema: GraphQLSchema, type_node: TypeNode) -> Optional[GraphQ
4040
...
4141

4242

43-
def type_from_ast(schema: GraphQLSchema, type_node: TypeNode,) -> Optional[GraphQLType]:
43+
def type_from_ast(
44+
schema: GraphQLSchema,
45+
type_node: TypeNode,
46+
) -> Optional[GraphQLType]:
4447
"""Get the GraphQL type definition from an AST node.
4548
4649
Given a Schema and an AST node describing a type, return a GraphQLType definition

src/graphql/validation/rules/executable_definitions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def enter_document(self, node: DocumentNode, *_args: Any) -> VisitorAction:
4040
)
4141
self.report_error(
4242
GraphQLError(
43-
f"The {def_name} definition is not executable.", definition,
43+
f"The {def_name} definition is not executable.",
44+
definition,
4445
)
4546
)
4647
return SKIP

src/graphql/validation/rules/possible_type_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class PossibleTypeExtensionsRule(SDLValidationRule):
2222
"""Possible type extension
2323
24-
A type extension is only valid if the type is defined and has the same kind.
24+
A type extension is only valid if the type is defined and has the same kind.
2525
"""
2626

2727
def __init__(self, context: SDLValidationContext):

tests/execution/test_executor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,10 @@ def errors_if_empty_string_is_provided_as_operation_name():
668668
document = parse("{ a }")
669669

670670
result = execute(schema, document, operation_name="")
671-
assert result == (None, [{"message": "Unknown operation named ''."}],)
671+
assert result == (
672+
None,
673+
[{"message": "Unknown operation named ''."}],
674+
)
672675

673676
def uses_the_query_schema_for_queries():
674677
schema = GraphQLSchema(

tests/execution/test_middleware.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,20 @@ def skip_middleware_without_resolve_method():
157157
class BadMiddleware:
158158
pass # no resolve method here
159159

160-
assert execute(
161-
GraphQLSchema(
162-
GraphQLObjectType("TestType", {"foo": GraphQLField(GraphQLString)},)
163-
),
164-
parse("{ foo }"),
165-
{"foo": "bar"},
166-
middleware=MiddlewareManager(BadMiddleware()),
167-
) == ({"foo": "bar"}, None)
160+
assert (
161+
execute(
162+
GraphQLSchema(
163+
GraphQLObjectType(
164+
"TestType",
165+
{"foo": GraphQLField(GraphQLString)},
166+
)
167+
),
168+
parse("{ foo }"),
169+
{"foo": "bar"},
170+
middleware=MiddlewareManager(BadMiddleware()),
171+
)
172+
== ({"foo": "bar"}, None)
173+
)
168174

169175
def with_function_and_object():
170176
doc = parse("{ field }")

tests/execution/test_resolve.py

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,35 @@ class RootValue:
2929
schema=_test_schema(GraphQLField(GraphQLString)),
3030
source="{ test }",
3131
root_value=RootValue(),
32-
) == ({"test": "testValue"}, None,)
32+
) == (
33+
{"test": "testValue"},
34+
None,
35+
)
3336

3437
def default_function_accesses_keys_of_dict():
3538
root_value = {"test": "testValue"}
3639

37-
assert graphql_sync(
38-
schema=_test_schema(GraphQLField(GraphQLString)),
39-
source="{ test }",
40-
root_value=root_value,
41-
) == ({"test": "testValue"}, None)
40+
assert (
41+
graphql_sync(
42+
schema=_test_schema(GraphQLField(GraphQLString)),
43+
source="{ test }",
44+
root_value=root_value,
45+
)
46+
== ({"test": "testValue"}, None)
47+
)
4248

4349
def default_function_accesses_keys_of_chain_map():
4450
# use a mapping that is not a subclass of dict
4551
root_value = ChainMap({"test": "testValue"})
4652

47-
assert graphql_sync(
48-
schema=_test_schema(GraphQLField(GraphQLString)),
49-
source="{ test }",
50-
root_value=root_value,
51-
) == ({"test": "testValue"}, None)
53+
assert (
54+
graphql_sync(
55+
schema=_test_schema(GraphQLField(GraphQLString)),
56+
source="{ test }",
57+
root_value=root_value,
58+
)
59+
== ({"test": "testValue"}, None)
60+
)
5261

5362
def default_function_calls_methods():
5463
class RootValue:
@@ -61,7 +70,10 @@ def test(self, _info):
6170
schema=_test_schema(GraphQLField(GraphQLString)),
6271
source="{ test }",
6372
root_value=RootValue(),
64-
) == ({"test": "secretValue"}, None,)
73+
) == (
74+
{"test": "secretValue"},
75+
None,
76+
)
6577

6678
def default_function_passes_args_and_context():
6779
class Adder:
@@ -90,7 +102,10 @@ class ContextValue:
90102
source=source,
91103
root_value=root_value,
92104
context_value=context_value,
93-
) == ({"test": 789}, None,)
105+
) == (
106+
{"test": 789},
107+
None,
108+
)
94109

95110
def uses_provided_resolve_function():
96111
schema = _test_schema(
@@ -114,7 +129,10 @@ def execute(source, root_value=None, context_value=None):
114129

115130
assert execute("{ test }") == ({"test": "[None, {}]"}, None)
116131

117-
assert execute("{ test }", "Source!") == ({"test": "['Source!', {}]"}, None,)
132+
assert execute("{ test }", "Source!") == (
133+
{"test": "['Source!', {}]"},
134+
None,
135+
)
118136

119137
assert execute('{ test(aStr: "String!") }', "Source!") == (
120138
{"test": "['Source!', {'aStr': 'String!'}]"},
@@ -144,7 +162,10 @@ def execute(source: str, root_value: Optional[Any] = None) -> ExecutionResult:
144162

145163
assert execute("{ test }") == ({"test": "[None, {}]"}, None)
146164

147-
assert execute("{ test }", "Source!") == ({"test": "['Source!', {}]"}, None,)
165+
assert execute("{ test }", "Source!") == (
166+
{"test": "['Source!', {}]"},
167+
None,
168+
)
148169

149170
assert execute('{ test(aStr: "String!") }', "Source!") == (
150171
{"test": "['Source!', {'a_str': 'String!'}]"},
@@ -177,7 +198,11 @@ def transforms_arguments_with_inputs_using_out_names():
177198
)
178199

179200
def execute(source, root_value=None):
180-
return graphql_sync(schema=schema, source=source, root_value=root_value,)
201+
return graphql_sync(
202+
schema=schema,
203+
source=source,
204+
root_value=root_value,
205+
)
181206

182207
assert execute("{ test }") == ({"test": "[None, {}]"}, None)
183208

tests/execution/test_union_interface.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,10 @@ def resolve_type(_source, info, _type):
518518
document=document,
519519
root_value=root_value,
520520
context_value=context_value,
521-
) == ({"name": "John", "friends": [{"name": "Liz"}]}, None,)
521+
) == (
522+
{"name": "John", "friends": [{"name": "Liz"}]},
523+
None,
524+
)
522525

523526
assert encountered == {
524527
"schema": schema2,

0 commit comments

Comments
 (0)