class_docstr: A sequence of potential rewrites.
  
  Retrieve a sequence of rewrites as a `SequentialGraphRewriter` by calling
  `SequenceDB.query`.
  
  Each potential rewrite is registered with a floating-point position.
  No matter which rewrites are selected by a query, they are carried
  out in order of increasing position.
class_docstr_tok: ["A","sequence","of","potential","rewrites",".","Retrieve","a","sequence","of","rewrites","as","a","`","SequentialGraphRewriter","`","by","calling","`","SequenceDB.query","`",".","Each","potential","rewrite","is","registered","with","a","floating-point","position",".","No","matter","which","rewrites","are","selected","by","a","query",",","they","are","carried","out","in","order","of","increasing","position","."]
docstr: Parameters
  ----------
  position_cutoff : float or int
      Only rewrites with position less than the cutoff are returned.
code: def query(
      self,
      *tags,
      position_cutoff: Optional[Union[int, float]] = None,
      **kwtags,
  ):
      """
  
      Parameters
      ----------
      position_cutoff : float or int
          Only rewrites with position less than the cutoff are returned.
  
      """
      rewrites = super().query(*tags, **kwtags)
  
      if position_cutoff is None:
          position_cutoff = config.optdb__position_cutoff
  
      position_dict = self.__position__
  
      if len(tags) >= 1 and isinstance(tags[0], RewriteDatabaseQuery):
          # the call to super should have raise an error with a good message
          assert len(tags) == 1
          if getattr(tags[0], "position_cutoff", None):
              position_cutoff = tags[0].position_cutoff
  
          # The RewriteDatabaseQuery instance might contain extra rewrites which need
          # to be added to the sequence of rewrites (don't alter the
          # original dictionary)
          if len(tags[0].extra_rewrites) > 0:
              position_dict = position_dict.copy()
              for extra_rewrite in tags[0].extra_rewrites:
                  # Give a name to the extra rewrites (include both the
                  # class name for descriptiveness and id to avoid name
                  # collisions)
                  rewrite, position = extra_rewrite
                  rewrite.name = f"{rewrite.__class__}_{id(rewrite)}"
  
                  if position < position_cutoff:
                      rewrites.add(rewrite)
                      position_dict[rewrite.name] = position
  
      rewrites = [
          o for o in rewrites if position_dict[o.name] < position_cutoff
      ]
      rewrites.sort(key=lambda obj: (position_dict[obj.name], obj.name))
  
      if self.failure_callback:
          ret = self.seq_rewriter_type(
              rewrites, failure_callback=self.failure_callback
          )
      else:
          ret = self.seq_rewriter_type(rewrites)
  
      if hasattr(tags[0], "name"):
          ret.name = tags[0].name
      return ret
  
imports: import copy
  import math
  import sys
  from collections.abc import Iterable, Sequence
  from functools import cmp_to_key
  from io import StringIO
  from typing import Optional, Union
  from pytensor.configdefaults import config
  from pytensor.graph.rewriting import basic
  from pytensor.misc.ordered_set import OrderedSet
  from pytensor.utils import DefaultOrderedDict
label_desc: Use image node_id 3 for calling the SequenceDB obj's underlying member method code with example usage: obj.query() and returns: ret