      COMPILED_REGEX_TYPE,
      RegexObject,
      resolve_relation,
  )
  from django.utils.topological_sort import stable_topological_sort
  
  
  class MigrationAutodetector:
      """
      Take a pair of ProjectStates and compare them to see what the first would
 
</s> remove from django.utils.topological_sort import CyclicDependencyError, stable_topological_sort
 </s> add  </s> remove         dependency_graph = defaultdict(set)
 </s> add         ts = TopologicalSorter() </s> remove             dependency_graph.setdefault(head, set())
 </s> add             ts.add(head)
      COMPILED_REGEX_TYPE,
      RegexObject,
      resolve_relation,
  )

  
  
  class MigrationAutodetector:
      """
      Take a pair of ProjectStates and compare them to see what the first would
keep keep keep keep replace keep keep keep keep keep
 Fixed #32528 -- Replaced django.utils.topological_sort with graphlib.TopologicalSort().

graphlib.TopologicalSort() is available since Python 3.9. 
django/db/migrations/autodetector.py