403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.149.239.180
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3.6/site-packages/dnf/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/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

Youez - 2016 - github.com/yon3zu
LinuXploit