
    g                     $    d Z  G d d          ZdS )z
Replacement rules.
c                   2    e Zd ZdZd fdZd Zd ZddZdS )		Transforma  
    Immutable mapping that can be used as a generic transformation rule.

    Parameters
    ==========

    transform : callable
        Computes the value corresponding to any key.

    filter : callable, optional
        If supplied, specifies which objects are in the mapping.

    Examples
    ========

    >>> from sympy.core.rules import Transform
    >>> from sympy.abc import x

    This Transform will return, as a value, one more than the key:

    >>> add1 = Transform(lambda x: x + 1)
    >>> add1[1]
    2
    >>> add1[x]
    x + 1

    By default, all values are considered to be in the dictionary. If a filter
    is supplied, only the objects for which it returns True are considered as
    being in the dictionary:

    >>> add1_odd = Transform(lambda x: x + 1, lambda x: x%2 == 1)
    >>> 2 in add1_odd
    False
    >>> add1_odd.get(2, 0)
    0
    >>> 3 in add1_odd
    True
    >>> add1_odd[3]
    4
    >>> add1_odd.get(3, 0)
    4
    c                     dS )NT )xs    L/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/core/rules.py<lambda>zTransform.<lambda>1   s    4     c                 "    || _         || _        d S N)
_transform_filter)self	transformfilters      r   __init__zTransform.__init__1   s    #r	   c                 ,    |                      |          S r   )r   )r   items     r   __contains__zTransform.__contains__5   s    ||D!!!r	   c                 t    |                      |          r|                     |          S t          |          r   )r   r   KeyError)r   keys     r   __getitem__zTransform.__getitem__8   s4    << 	 ??3'''3--r	   Nc                     || v r| |         S |S r   r   )r   r   defaults      r   getzTransform.get>   s    4<<:Nr	   r   )__name__
__module____qualname____doc__r   r   r   r   r   r	   r   r   r      sl        ) )V *8    " " "          r	   r   N)r   r   r   r	   r   <module>r       sA    = = = = = = = = = =r	   