code: def detect_cycle_recursive(self, fragment):
      fragment_name = fragment.name.value
      self.visited_frags.add(fragment_name)
  
      spread_nodes = self.context.get_fragment_spreads(
          fragment.selection_set
      )
      if not spread_nodes:
          return
  
      self.spread_path_index_by_name[fragment_name] = len(
          self.spread_path
      )
  
      for spread_node in spread_nodes:
          spread_name = spread_node.name.value
          cycle_index = self.spread_path_index_by_name.get(spread_name)
  
          if cycle_index is None:
              self.spread_path.append(spread_node)
              if spread_name not in self.visited_frags:
                  spread_fragment = self.context.get_fragment(
                      spread_name
                  )
                  if spread_fragment:
                      self.detect_cycle_recursive(spread_fragment)
              self.spread_path.pop()
          else:
              cycle_path = self.spread_path[cycle_index:]
              self.context.report_error(
                  GraphQLError(
                      self.cycle_error_message(
                          spread_name,
                          [s.name.value for s in cycle_path],
                      ),
                      cycle_path + [spread_node],
                  )
              )
  
      self.spread_path_index_by_name[fragment_name] = None
  
file_path: wandb/wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py
imports: from ...error import GraphQLError
  from .base import ValidationRule
label_desc: Use image node_id 4 for calling the NoFragmentCycles obj's underlying member method code with example usage: obj.detect_cycle_recursive(fragment) without return types