Skip to content

Commit c2ab270

Browse files
Backout inappropriate reformatting
1 parent 56614ce commit c2ab270

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

src/graphql/validation/rules/lone_schema_definition.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@ def __init__(self, context: SDLValidationContext):
1717
super().__init__(context)
1818
old_schema = context.schema
1919
self.already_defined = old_schema and (
20-
old_schema.ast_node or old_schema.query_type or old_schema.mutation_type or old_schema.subscription_type
20+
old_schema.ast_node
21+
or old_schema.query_type
22+
or old_schema.mutation_type
23+
or old_schema.subscription_type
2124
)
2225
self.schema_definitions_count = 0
2326

2427
def enter_schema_definition(self, node: SchemaDefinitionNode, *_args: Any) -> None:
2528
if self.already_defined:
26-
self.report_error(GraphQLError("Cannot define a new schema within a schema extension.", node))
29+
self.report_error(
30+
GraphQLError(
31+
"Cannot define a new schema within a schema extension.", node
32+
)
33+
)
2734
else:
2835
if self.schema_definitions_count:
29-
self.report_error(GraphQLError("Must provide only one schema definition.", node))
36+
self.report_error(
37+
GraphQLError("Must provide only one schema definition.", node)
38+
)
3039
self.schema_definitions_count += 1

src/graphql/validation/validation_context.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def enter_variable_definition(self, *_args: Any) -> VisitorAction:
5656

5757
def enter_variable(self, node: VariableNode, *_args: Any) -> VisitorAction:
5858
type_info = self._type_info
59-
usage = VariableUsage(node, type_info.get_input_type(), type_info.get_default_value())
59+
usage = VariableUsage(
60+
node, type_info.get_input_type(), type_info.get_default_value()
61+
)
6062
self._append_usage(usage)
6163
return None
6264

@@ -73,9 +75,13 @@ class ASTValidationContext:
7375

7476
_fragments: Optional[Dict[str, FragmentDefinitionNode]]
7577
_fragment_spreads: Dict[SelectionSetNode, List[FragmentSpreadNode]]
76-
_recursively_referenced_fragments: Dict[OperationDefinitionNode, List[FragmentDefinitionNode]]
78+
_recursively_referenced_fragments: Dict[
79+
OperationDefinitionNode, List[FragmentDefinitionNode]
80+
]
7781

78-
def __init__(self, ast: DocumentNode, on_error: Callable[[GraphQLError], None]) -> None:
82+
def __init__(
83+
self, ast: DocumentNode, on_error: Callable[[GraphQLError], None]
84+
) -> None:
7985
self.document = ast
8086
self.on_error = on_error # type: ignore
8187
self._fragments = None
@@ -112,13 +118,17 @@ def get_fragment_spreads(self, node: SelectionSetNode) -> List[FragmentSpreadNod
112118
if isinstance(selection, FragmentSpreadNode):
113119
append_spread(selection)
114120
else:
115-
set_to_visit = cast(NodeWithSelectionSet, selection).selection_set
121+
set_to_visit = cast(
122+
NodeWithSelectionSet, selection
123+
).selection_set
116124
if set_to_visit:
117125
append_set(set_to_visit)
118126
self._fragment_spreads[node] = spreads
119127
return spreads
120128

121-
def get_recursively_referenced_fragments(self, operation: OperationDefinitionNode) -> List[FragmentDefinitionNode]:
129+
def get_recursively_referenced_fragments(
130+
self, operation: OperationDefinitionNode
131+
) -> List[FragmentDefinitionNode]:
122132
fragments = self._recursively_referenced_fragments.get(operation)
123133
if fragments is None:
124134
fragments = []
@@ -200,7 +210,9 @@ def get_variable_usages(self, node: NodeWithSelectionSet) -> List[VariableUsage]
200210
self._variable_usages[node] = usages
201211
return usages
202212

203-
def get_recursive_variable_usages(self, operation: OperationDefinitionNode) -> List[VariableUsage]:
213+
def get_recursive_variable_usages(
214+
self, operation: OperationDefinitionNode
215+
) -> List[VariableUsage]:
204216
usages = self._recursive_variable_usages.get(operation)
205217
if usages is None:
206218
get_variable_usages = self.get_variable_usages

0 commit comments

Comments
 (0)