o
    oĒhE  ć                   @   s`   d dl mZmZ G dd deZdd Zdd Zdd	 Zd
d Zdd Z	e
fddZdd ZdS )é   )Ś	_toposortŚgroupbyc                   @   s   e Zd ZdS )ŚAmbiguityWarningN)Ś__name__Ś
__module__Ś__qualname__© r   r   śs/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/multipledispatch/conflict.pyr      s    r   c                 C   s    t | t |kottt| |S )z3 A is consistent and strictly more specific than B )ŚlenŚallŚmapŚ
issubclass©ŚaŚbr   r   r	   Ś
supercedes   ó    r   c                 C   s(   t | t |kotdd t| |D S )z= It is possible for an argument list to satisfy both A and B c                 s   s(    | ]\}}t ||pt ||V  qd S ©N)r   )Ś.0ŚaaŚbbr   r   r	   Ś	<genexpr>   s    ’zconsistent.<locals>.<genexpr>)r
   r   Śzipr   r   r   r	   Ś
consistent   s
   ’’r   c                 C   s    t | |ot| |pt||  S )z> A is consistent with B but neither is strictly more specific )r   r   r   r   r   r	   Ś	ambiguous   r   r   c                    s    t tt   fdd D S )z5 All signature pairs such that A is ambiguous with B c                    sP   h | ]$ D ]t  t k rt rt fd dD s fqqS )c                 3   s$    | ]}t | ot |V  qd S r   ©r   )r   Ścr   r   r	   r      s    ’z(ambiguities.<locals>.<setcomp>.<genexpr>)Śhashr   Śany©r   ©Ś
signaturesr   r	   Ś	<setcomp>   s    ’’ž’zambiguities.<locals>.<setcomp>)Ślistr   Śtupler    r   r    r	   Śambiguities   s   r%   c                    s<   t d  t fddD sJ fddt D S )z* A signature that would break ambiguities é    c                 3   s    | ]	}t | kV  qd S r   )r
   )r   Śs)Śnr   r	   r   %   s    z"super_signature.<locals>.<genexpr>c                    s*   g | ] t  fd dD tdd qS )c                    s   g | ]	}t  |  ”qS r   )ŚtypeŚmro)r   Śsig©Śir   r	   Ś
<listcomp>'   s    z.super_signature.<locals>.<listcomp>.<listcomp>)Śkeyr&   )Śmaxr
   r   r    r,   r	   r.   '   s    "’z#super_signature.<locals>.<listcomp>)r
   r   Śranger    r   )r(   r!   r	   Śsuper_signature"   s
   
’r2   c                 C   s,   t | |rt || r|| ||kS dS dS )zW A should be checked before B

    Tie broken by tie_breaker, defaults to ``hash``
    TFr   )r   r   Śtie_breakerr   r   r	   Śedge+   s
   

r4   c                    sb   t tt   fdd D }tdd |} D ]
}||vr#g ||< qdd | ” D }t|S )z A sane ordering of signatures to check, first to last

    Topoological sort of edges as given by ``edge`` and ``supercedes``
    c                    s(   g | ]} D ]}t ||r||fqqS r   )r4   ©r   r   r   r    r   r	   r.   >   s   ( zordering.<locals>.<listcomp>c                 S   s   | d S )Nr&   r   )Śxr   r   r	   Ś<lambda>?   s    zordering.<locals>.<lambda>c                 S   s    i | ]\}}|d d |D qS )c                 S   s   g | ]\}}|qS r   r   r5   r   r   r	   r.   C   s    z'ordering.<locals>.<dictcomp>.<listcomp>r   )r   ŚkŚvr   r   r	   Ś
<dictcomp>C   s     zordering.<locals>.<dictcomp>)r#   r   r$   r   Śitemsr   )r!   Śedgesr'   r   r    r	   Śordering8   s   r=   N)Śutilsr   r   ŚWarningr   r   r   r   r%   r2   r   r4   r=   r   r   r   r	   Ś<module>   s    
	