JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/dnf/__pycache__/match_counter.cpython-39.pyc

a

�!cT�@sZddlmZddlmZddlmZddlmZddddd	�Zd
d�ZGdd
�d
e�Z	dS)�)�absolute_import)�print_function)�unicode_literals��reduce����)�nameZsummary�description�urlcCs"t|�}dg||t|�}|S)z, Ordered sset with empty strings prepended. �)�len�sorted)Zsset�length�current�l�r�5/usr/lib/python3.9/site-packages/dnf/match_counter.py�_canonize_string_set"src@sfeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zddd�Z
dd�ZdS)�MatchCounterz�Map packages to which of their attributes matched in a search against
    what values.

    The mapping is: ``package -> [(key, needle), ... ]``.

    cs�fdd�}tt||��S)Ncs>|d}|d}t�|�}|dkr6||kr6dt|St|S)Nrr
rr	)�getattr�WEIGHTS)�match�key�needleZhaystack��pkgrr�weight4s
z*MatchCounter._eval_weights.<locals>.weight)�sum�map)r�matchesrrrr�
_eval_weights1s	zMatchCounter._eval_weightscs�fdd�}|S)a�Get the key function used for sorting matches.

        It is not enough to only look at the matches and order them by the sum
        of their weighted hits. In case this number is the same we have to
        ensure that the same matched needles are next to each other in the
        result.

        Returned function is:
        pkg -> (weights_sum, canonized_needles_set, -distance)

        cs��|�|�|jfS�N)r#rr��selfrr�get_keyKs�z'MatchCounter._key_func.<locals>.get_keyr)r&r'rr%r�	_key_func?szMatchCounter._key_funccs�rt�fdd��D��SdS)z0Return the max count of needles of all packages.c3s|]}t��|��VqdSr$)r�matched_needles)�.0rr%rr�	<genexpr>W�z,MatchCounter._max_needles.<locals>.<genexpr>r)�maxr%rr%r�_max_needlesTszMatchCounter._max_needlescCs|�|g��||f�dSr$)�
setdefault�append)r&rrrrrr�addZszMatchCounter.addcCs"|D]}td|||f�qdS)Nz%s	%s)�print�r&rrrr�dump]szMatchCounter.dumpcst�fdd�|�D��S)Nc3s|]}t�|d�VqdS)rN)r�r*�mrrrr+br,z1MatchCounter.matched_haystacks.<locals>.<genexpr>��setr3rrr�matched_haystacksaszMatchCounter.matched_haystackscCs2g}||D] }|d|vrq|�|d�q|S)Nr)r0)r&r�result�irrr�matched_keysdszMatchCounter.matched_keyscCstdd�||D��S)Ncss|]}|dVqdS)r
Nrr5rrrr+nr,z/MatchCounter.matched_needles.<locals>.<genexpr>r7r3rrrr)mszMatchCounter.matched_needlesFNcCs |r|n|��}t||��d�S)N)r)�keysrr()r&�reverseZlimit_tor=rrrrpszMatchCounter.sortedcst�fdd��d�S)Ncs|t�|�Sr$)r)�totalrr%rr�<lambda>ur,z$MatchCounter.total.<locals>.<lambda>rrr%rr%rr?tszMatchCounter.total)FN)�__name__�
__module__�__qualname__�__doc__�staticmethodr#r(r.r1r4r9r<r)rr?rrrrr)s

	
rN)
Z
__future__rrr�	functoolsrrr�dictrrrrr�<module>s�
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Raq02Br#SCTb ?Ζ"]mH5WR7k.ۛ!}Q~+yԏz|@T20S~Kek *zFf^2X*(@8r?CIuI|֓>^ExLgNUY+{.R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