
    EdE                     `    d dl mZmZ  G d de          Zd Zd Zd Zd Zd Z	e
fd	Zd
 ZdS )   )	_toposortgroupbyc                       e Zd ZdS )AmbiguityWarningN)__name__
__module____qualname__     ?lib/python3.11/site-packages/sympy/multipledispatch/conflict.pyr   r      s        Dr   r   c                     t          |           t          |          k    o"t          t          t          | |                    S )z3 A is consistent and strictly more specific than B )lenallmap
issubclassabs     r   
supercedesr      s2    q66SVV:C
Aq$9$9 : ::r   c                     t          |           t          |          k    o&t          d t          | |          D                       S )z= It is possible for an argument list to satisfy both A and B c              3   \   K   | ]'\  }}t          ||          pt          ||          V  (d S N)r   ).0aabbs      r   	<genexpr>zconsistent.<locals>.<genexpr>   sS       4 4%r2 2r""8jR&8&8 4 4 4 4 4 4r   )r   r   zipr   s     r   
consistentr      sQ    FFc!ff 4 4 4),Q4 4 4 4 45r   c                 d    t          | |          o t          | |          pt          ||            S )z> A is consistent with B but neither is strictly more specific )r   r   r   s     r   	ambiguousr       s3    aJZ1%5%5%IAq9I9I JJr   c                 d     t          t          t                                 fd D             S )z5 All signature pairs such that A is ambiguous with B c                     h | ]WD ]Rt                    t                    k     "t                    2t          fd D                       NfSXS )c              3   X   K   | ]$}t          |          ot          |          V  %d S r   r   )r   cr   r   s     r   r   z(ambiguities.<locals>.<setcomp>.<genexpr>   sP       #9 #9() $.a#3#3#H
1a8H8H #9 #9 #9 #9 #9 #9r   )hashr    anyr   r   r   
signaturess    @@r   	<setcomp>zambiguities.<locals>.<setcomp>   s     : : :q
 : :1q''DGG+:$Q??:  # #9 #9 #9 #9 #9-7#9 #9 #9  9  9:QF : : : :r   )listr   tuple)r)   s   `r   ambiguitiesr-      sD    c%,,--J: : : :J : : : :r   c                      t           d                   t          fd D                       sJ  fdt                    D             S )z* A signature that would break ambiguities     c              3   >   K   | ]}t          |          k    V  d S r   )r   )r   sns     r   r   z"super_signature.<locals>.<genexpr>%   s-      //qs1vv{//////r   c                 b    g | ]*t          fd D             t                    d         +S )c                 P    g | ]"}t                               |                   #S r
   )typemro)r   sigis     r   
<listcomp>z.super_signature.<locals>.<listcomp>.<listcomp>'   s)    888c#a&!!888r   )keyr/   )maxr   )r   r8   r)   s    @r   r9   z#super_signature.<locals>.<listcomp>'   sQ     " " " 8888Z888cBBB1E " " "r   )r   r   range)r)   r2   s   `@r   super_signaturer=   "   so    JqMA////J////////" " " "a" " " "r   c                 z    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_breakers      r   edger@   +   sM    
 !Q a 	;q>>KKNN2245r   c                      t          t          t                                 fd D             }t          d |          } D ]}||vrg ||<   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                 B    g | ]}D ]}t          ||          ||fS r
   )r@   r(   s      r   r9   zordering.<locals>.<listcomp>>   s7    JJJJJAtAqzzJaVJJJJr   c                     | d         S )Nr/   r
   )xs    r   <lambda>zordering.<locals>.<lambda>?   s
    ad r   c                 .    i | ]\  }}|d  |D             S )c                     g | ]\  }}|S r
   r
   )r   r   r   s      r   r9   z'ordering.<locals>.<dictcomp>.<listcomp>C   s    !!!tq!!!!r   r
   )r   kvs      r   
<dictcomp>zordering.<locals>.<dictcomp>C   s-    <<<daQ!!q!!!<<<r   )r+   r   r,   r   itemsr   )r)   edgesr1   s   `  r   orderingrM   8   s    
 c%,,--JJJJJZJJJENNE**E  E> 	E!H<<ekkmm<<<EUr   N)utilsr   r   Warningr   r   r   r    r-   r=   r&   r@   rM   r
   r   r   <module>rP      s    % % % % % % % %	 	 	 	 	w 	 	 	; ; ;
5 5 5K K K
: : :" " "   
 
 
 
    r   