Skip to content

Commit e936820

Browse files
committed
Make fragment spreads calculation a bit more Pythonic
1 parent 4071971 commit e936820

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

graphql/core/validation/rules.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,11 @@ class PossibleFragmentSpreads(ValidationRule):
181181
class NoFragmentCycles(ValidationRule):
182182
def __init__(self, context):
183183
super(NoFragmentCycles, self).__init__(context)
184-
185-
self.spreads_in_fragment = {}
186-
definitions = context.get_ast().definitions
187-
for node in definitions:
188-
if isinstance(node, ast.FragmentDefinition):
189-
self.spreads_in_fragment[node.name.value] = self.gather_spreads(node)
190-
184+
self.spreads_in_fragment = {
185+
node.name.value: self.gather_spreads(node)
186+
for node in context.get_ast().definitions
187+
if isinstance(node, ast.FragmentDefinition)
188+
}
191189
self.known_to_lead_to_cycle = set()
192190

193191
def enter_FragmentDefinition(self, node, *args):

0 commit comments

Comments
 (0)