U
    ,-e                     @   s  U d dl Z d dlmZmZmZmZ d dlZd dlmZ e 	e
ZejejejejejejejejejejejejiZeeej eej f ed< ejejejejfZeeeej  dddZdejejeeeeejejf  d
ddZejejeejdddZdS )    N)DictOptionalTupleType)FloorDiv_MIRROR_REL_OP)typereturnc                 C   s   t | d S )N)r   get)r    r   Y/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/torch/utils/_sympy/solve.pymirror_rel_op   s    r      T)exprthingtrialsfloordiv_inequalityr	   c                 C   s  t t| }t| tjr |d kr4tdt|  d S | j|}| j	|}|rf|rftd||  d S g }|rx|
|  |r|
|| j	| j |D ]n}|d krqt|tjstt|D ]"}	t|||d}
|
|kr q|
}qt|tjr|j|kr||j	f  S qd S )Nz$expression with unsupported type: %sz0thing (%s) found in both sides of expression: %s)r   )r   r   
isinstancesympyRellogdebuglhshasrhsappendAssertionErrorrange_try_isolate_lhs)r   r   r   r   ZmirrorZlhs_has_thingZrhs_has_thingZexpressionse_Ztrialr   r   r   	try_solve)   s4    
r!   )r   r   r   r	   c                    sV  | }t | }t|tjrZt|jtjr@t fdd|jjD nd}|| j| | j| }t|tjrt|jtj	r|j\}}tj	 fdd|jD  }t|t
r|jd ks|| }|| }t|t
r|jrt|}|d k	st|||}|rRt|tjrRt|jtrR|jjjrR|jjrRt| tjrh|jj\}	}
tt|	|j|
 t|	|jd |
 S t| tjr|jj\}	}
tt|	|j|
 t|	|jd |
 S t| tjtjfr t| tjr|jn|jd }t|jjd ||jjd  S t| tjtjfrRt| tjr(|jn|jd }t|jjd ||jjd  S |S )Nc                    s   g | ]}|  s|qS r   r   .0ar   r   r   
<listcomp>i   s     
 z$_try_isolate_lhs.<locals>.<listcomp>r   c                    s   g | ]}|  s|qS r   r"   r#   r&   r   r   r'   r   s     
    )r   r   r   r   r   Addsumargsr   ZMulINEQUALITY_TYPESZis_negativer   r   r   ZdivisorZis_positive
is_integerEqAndGeLtNeOrGtLe)r   r   r   r   opZlhs_not_thingr   r   other	numeratordenominatorZquotientr   r&   r   r   `   s^    



	  r   )r   T)loggingtypingr   r   r   r   r   Ztorch.utils._sympy.functionsr   	getLogger__name__r   r.   r2   r0   r5   r4   r1   r   ZBasicr   __annotations__r,   r   intboolr!   r   r   r   r   r   <module>   sD    
       	  8  