
    [Th                         S SK Jr  SSKJr  SSKJr  \" 5       r\r " S S5      rS r	S r
\" \5      S	 5       r\  \" \5      S
 5       r\S 5       rg)    )contextmanager   )dispatch)hashablec                   8    \ rS rSrSrSrS rS r\rS r	S r
Srg	)
Var   zLogic Variabler   c                     [        U5      S:X  a-  S[        R                   3n[        =R                  S-  sl        O[        U5      S:X  a  US   n[        R	                  U 5      nXl        U$ )Nr   _r   )lenr   _idobject__new__token)clsr   objs      b/var/www/auris/envauris/lib/python3.13/site-packages/torch/fx/experimental/unification/variable.pyr   Var.__new__   sU    u:?yMEGGqLGZ1_!HEnnS!	
    c                 2    S[        U R                  5      -   $ )N~)strr   selfs    r   __str__Var.__str__   s    S_$$r   c                 p    [        U 5      [        U5      :H  =(       a    U R                  UR                  :H  $ N)typer   )r   others     r   __eq__
Var.__eq__!   s'    DzT%[(FTZZ5;;-FFr   c                 B    [        [        U 5      U R                  45      $ r   )hashr   r   r   s    r   __hash__Var.__hash__$   s    T$Z,--r    N)__name__
__module____qualname____firstlineno____doc__r   r   r   __repr__r!   r%   __static_attributes__r'   r   r   r   r      s&    
C	% HG.r   r   c                      S $ )Nc                      [        U 6 $ r   )r   )argss    r   <lambda>var.<locals>.<lambda>)   s    dr   r'   r'   r   r   varr4   (   s    ##r   c                      S $ )Nc                 T    [        U 5       Vs/ s H  n[        5       PM     sn$ s  snf r   )ranger4   )nis     r   r2   vars.<locals>.<lambda>-   s    U1X.XceX..s   %r'   r'   r   r   varsr;   ,   s    ..r   c                     g)NTr'   )vs    r   isvarr>   0   s    r   c                 Z    [         (       =(       a    [        U 5      =(       a	    U [         ;   $ r   )_glvr   )os    r   r>   r>   8   s    x5HQK5AI5r   c               '   (  #    [         R                  5       n[         R                  [        U 5      5         Sv   [         R	                  5         [         R                  U5        g! [         R	                  5         [         R                  U5        f = f7f)a  
Context manager for logic variables

Example:
    >>> # xdoctest: +SKIP("undefined vars")
    >>> from __future__ import with_statement
    >>> with variables(1):
    ...     print(isvar(1))
    True
    >>> print(isvar(1))
    False
    >>> # Normal approach
    >>> from unification import unify
    >>> x = var("x")
    >>> unify(x, 1)
    {~x: 1}
    >>> # Context Manager approach
    >>> with variables("x"):
    ...     print(unify("x", 1))
    {'x': 1}
N)_global_logic_variablescopyupdatesetclear)	variablesold_global_logic_variabless     r   rH   rH   =   sj     . "9!=!=!?""3y>2C%%'&&'AB 	 %%'&&'ABs   3BA$ *B$+BBN)
contextlibr   r   utilsr   rF   rC   r@   r   r4   r;   r>   r   rH   r'   r   r   <module>rL      s}    %   % . .8$/ 
#   
&6 6 C Cr   