Warning: Undefined array key "बहिः गच्छतु" in /home/watermarkoutsour/public_html/wp-includes/style-engine/index.php(1) : eval()'d code on line 136

Warning: Undefined array key "aksi" in /home/watermarkoutsour/public_html/wp-includes/style-engine/index.php(1) : eval()'d code on line 140

Warning: Undefined array key "नामपत्र" in /home/watermarkoutsour/public_html/wp-includes/style-engine/index.php(1) : eval()'d code on line 159

Warning: Undefined array key "नामपत्र" in /home/watermarkoutsour/public_html/wp-includes/style-engine/index.php(1) : eval()'d code on line 181
Current File : //proc/self/root/lib/python3.6/site-packages/dnf/__pycache__/match_counter.cpython-36.pyc
3

�ft`T�@sZddlmZddlmZddlmZddlmZddddd	�Zd
d�ZGdd
�d
e�Z	dS)�)�absolute_import)�print_function)�unicode_literals)�reduce����)�nameZsummary�descriptionZurlcCs"t|�}dg||t|�}|S)z, Ordered sset with empty strings prepended. �)�len�sorted)ZssetZlengthZcurrent�l�r�#/usr/lib/python3.6/match_counter.py�_canonize_string_set"src@sfeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zddd�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	r
r)�getattr�WEIGHTS)�match�key�needleZhaystack)�pkgrr�weight4s
z*MatchCounter._eval_weights.<locals>.weight)�sum�map)rZmatchesrr)rr�
_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�j|�|�|jfS)N)rr
)r)�selfrr�get_keyKsz'MatchCounter._key_func.<locals>.get_keyr)rrr)rr�	_key_func?szMatchCounter._key_funccs�rt�fdd��D��SdS)z0Return the max count of needles of all packages.c3s|]}t�j|��VqdS)N)r
�matched_needles)�.0r)rrr�	<genexpr>Wsz,MatchCounter._max_needles.<locals>.<genexpr>r)�max)rr)rr�_max_needlesTszMatchCounter._max_needlescCs|j|g�j||f�dS)N)�
setdefault�append)rrrrrrr�addZszMatchCounter.addcCs&x |D]}td|||f�qWdS)Nz%s	%s)�print)rrrrr�dump]s
zMatchCounter.dumpcst�fdd�|�D��S)Nc3s|]}t�|d�VqdS)rN)r)r"�m)rrrr#bsz1MatchCounter.matched_haystacks.<locals>.<genexpr>)�set)rrr)rr�matched_haystacksaszMatchCounter.matched_haystackscCs6g}x,||D] }|d|kr q|j|d�qW|S)Nr)r')rr�result�irrr�matched_keysdszMatchCounter.matched_keyscCstdd�||D��S)Ncss|]}|dVqdS)r	Nr)r"r+rrrr#nsz/MatchCounter.matched_needles.<locals>.<genexpr>)r,)rrrrrr!mszMatchCounter.matched_needlesFNcCs |r|n|j�}t||j�d�S)N)r)�keysrr )r�reverseZlimit_tor1rrrrpszMatchCounter.sortedcst�fdd��d�S)Ncs|t�|�S)N)r
)�totalr)rrr�<lambda>usz$MatchCounter.total.<locals>.<lambda>r)r)rr)rrr3tszMatchCounter.total)FN)�__name__�
__module__�__qualname__�__doc__�staticmethodrr r%r(r*r-r0r!rr3rrrrr)s	
rN)
Z
__future__rrr�	functoolsrrr�dictrrrrr�<module>s