Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/lib/python3.9/site-packages/dnf/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python3.9/site-packages/dnf/__pycache__/match_counter.cpython-39.opt-1.pyc
a

�!cT�@sZddlmZddlmZddlmZddlmZddddd	�Zd
d�ZGdd
�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	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
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?szMatchCounter._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_keysdszMatchCounter.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�

Yohohohohohooho | Sanrei Aya