class_docstr: Rewriting optimization calling replace on expressions.
  
  Explanation
  ===========
  
  The instance can be used as a function on expressions for which
  it will apply the ``replace`` method (see
  :meth:`sympy.core.basic.Basic.replace`).
  
  Parameters
  ==========
  
  query :
      First argument passed to replace.
  value :
      Second argument passed to replace.
  
  Examples
  ========
  
  >>> from sympy import Symbol
  >>> from sympy.codegen.rewriting import ReplaceOptim
  >>> from sympy.codegen.cfunctions import exp2
  >>> x = Symbol('x')
  >>> exp2_opt = ReplaceOptim(lambda p: p.is_Pow and p.base == 2,
  ...     lambda p: exp2(p.exp))
  >>> exp2_opt(2**x)
  exp2(x)
class_docstr_tok: ["Rewriting","optimization","calling","replace","on","expressions",".","Explanation","===========","The","instance","can","be","used","as","a","function","on","expressions","for","which","it","will","apply","the","``","replace","``","method","(","see",":","meth",":","`","sympy.core.basic.Basic.replace","`",")",".","Parameters","==========","query",":","First","argument","passed","to","replace",".","value",":","Second","argument","passed","to","replace",".","Examples","========",">",">",">","from","sympy","import","Symbol",">",">",">","from","sympy.codegen.rewriting","import","ReplaceOptim",">",">",">","from","sympy.codegen.cfunctions","import","exp2",">",">",">","x","=","Symbol","(","'","x","'",")",">",">",">","exp2_opt","=","ReplaceOptim","(","lambda","p",":","p.is_Pow","and","p.base","==","2",",","...","lambda","p",":","exp2","(","p.exp",")",")",">",">",">","exp2_opt","(","2","*","*","x",")","exp2","(","x",")"]
code: def __init__(self, query, value, **kwargs):
      super().__init__(**kwargs)
      self.query = query
      self.value = value
  
imports: from sympy.core.function import expand_log
  from sympy.core.singleton import S
  from sympy.core.symbol import Wild
  from sympy.functions.elementary.complexes import sign
  from sympy.functions.elementary.exponential import exp, log
  from sympy.functions.elementary.miscellaneous import Max, Min
  from sympy.functions.elementary.trigonometric import cos, sin, sinc
  from sympy.assumptions import Q, ask
  from sympy.codegen.cfunctions import log1p, log2, exp2, expm1
  from sympy.codegen.matrix_nodes import MatrixSolve
  from sympy.core.expr import UnevaluatedExpr
  from sympy.core.power import Pow
  from sympy.codegen.numpy_nodes import logaddexp, logaddexp2
  from sympy.codegen.scipy_nodes import cosm1, powm1
  from sympy.core.mul import Mul
  from sympy.matrices.expressions.matexpr import MatrixSymbol
  from sympy.utilities.iterables import sift
label_desc: Use image node_id 1 to create a new ReplaceOptim object from inherited base classes: Optimization with example: obj = ReplaceOptim(query, value)