class_docstr: An object that specifies a set of rewrites by tag/name.
class_docstr_tok: ["An","object","that","specifies","a","set","of","rewrites","by","tag\/name","."]
docstr: Parameters
  ==========
  include:
      A set of tags such that every rewrite obtained through this
      `RewriteDatabaseQuery` must have **one** of the tags listed. This
      field is required and basically acts as a starting point for the
      search.
  require:
      A set of tags such that every rewrite obtained through this
      `RewriteDatabaseQuery` must have **all** of these tags.
  exclude:
      A set of tags such that every rewrite obtained through this
      ``RewriteDatabaseQuery` must have **none** of these tags.
  subquery:
      A dictionary mapping the name of a sub-database to a special
      `RewriteDatabaseQuery`.  If no subquery is given for a sub-database,
      the original `RewriteDatabaseQuery` will be used again.
  position_cutoff:
      Only rewrites with position less than the cutoff are returned.
  extra_rewrites:
      Extra rewrites to be added.
code: def __init__(
      self,
      include: Iterable[Union[str, None]],
      require: Optional[Union[OrderedSet, Sequence[str]]] = None,
      exclude: Optional[Union[OrderedSet, Sequence[str]]] = None,
      subquery: Optional[dict[str, "RewriteDatabaseQuery"]] = None,
      position_cutoff: float = math.inf,
      extra_rewrites: Optional[
          Sequence[
              tuple[
                  Union["RewriteDatabaseQuery", RewritesType],
                  Union[int, float],
              ]
          ]
      ] = None,
  ):
      """
  
      Parameters
      ==========
      include:
          A set of tags such that every rewrite obtained through this
          `RewriteDatabaseQuery` must have **one** of the tags listed. This
          field is required and basically acts as a starting point for the
          search.
      require:
          A set of tags such that every rewrite obtained through this
          `RewriteDatabaseQuery` must have **all** of these tags.
      exclude:
          A set of tags such that every rewrite obtained through this
          ``RewriteDatabaseQuery` must have **none** of these tags.
      subquery:
          A dictionary mapping the name of a sub-database to a special
          `RewriteDatabaseQuery`.  If no subquery is given for a sub-database,
          the original `RewriteDatabaseQuery` will be used again.
      position_cutoff:
          Only rewrites with position less than the cutoff are returned.
      extra_rewrites:
          Extra rewrites to be added.
  
      """
      self.include = OrderedSet(include)
      self.require = OrderedSet(require) if require else OrderedSet()
      self.exclude = OrderedSet(exclude) if exclude else OrderedSet()
      self.subquery = subquery or {}
      self.position_cutoff = position_cutoff
      self.name: Optional[str] = None
      if extra_rewrites is None:
          extra_rewrites = []
      self.extra_rewrites = list(extra_rewrites)
  
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 1 to create a new RewriteDatabaseQuery object  with example: obj = RewriteDatabaseQuery(include, require, exclude, subquery, position_cutoff, extra_rewrites)