uawdijnntqw1x1x1
IP : 18.119.19.219
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib
/
games
/
..
/
python3.6
/
site-packages
/
.
/
dnf
/
__pycache__
/
match_counter.cpython-36.opt-1.pyc
/
/
3 �ft`T�@sZddlmZddlmZddlmZddlmZddddd �Zd d�ZGdd �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 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 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?szMatchCounter._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_keysdszMatchCounter.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
/home/../lib/games/../python3.6/site-packages/./dnf/__pycache__/match_counter.cpython-36.opt-1.pyc