ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/dnf/__pycache__/match_counter.cpython-36.pyc
3

ft`T@sZddlmZddlmZddlmZddlmZddddd	Zd
dZGdd
d
eZ	dS))absolute_import)print_function)unicode_literals)reduce)nameZsummarydescriptionZurlcCs"t|}dg||t|}|S)z, Ordered sset with empty strings prepended. )lensorted)ZssetZlengthZcurrentlr#/usr/lib/python3.6/match_counter.py_canonize_string_set"src@sfeZdZdZeddZddZddZdd	Zd
dZ	dd
Z
ddZddZdddZ
ddZdS)MatchCounterzMap packages to which of their attributes matched in a search against
    what values.

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

    csfdd}tt||S)Ncs>|d}|d}t|}|dkr6||kr6dt|St|S)Nrr	r
r)getattrWEIGHTS)matchkeyneedleZhaystack)pkgrrweight4s
z*MatchCounter._eval_weights.<locals>.weight)summap)rZmatchesrr)rr
_eval_weights1s	zMatchCounter._eval_weightscsfdd}|S)aGet 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)

        csj|||jfS)N)rr
)r)selfrrget_keyKsz'MatchCounter._key_func.<locals>.get_keyr)rrr)rr	_key_func?szMatchCounter._key_funccsrtfddDSdS)z0Return the max count of needles of all packages.c3s|]}tj|VqdS)N)r
matched_needles).0r)rrr	<genexpr>Wsz,MatchCounter._max_needles.<locals>.<genexpr>r)max)rr)rr_max_needlesTszMatchCounter._max_needlescCs|j|gj||fdS)N)
setdefaultappend)rrrrrrraddZszMatchCounter.addcCs&x |D]}td|||fqWdS)Nz%s	%s)print)rrrrrdump]s
zMatchCounter.dumpcstfdd|DS)Nc3s|]}t|dVqdS)rN)r)r"m)rrrr#bsz1MatchCounter.matched_haystacks.<locals>.<genexpr>)set)rrr)rrmatched_haystacksaszMatchCounter.matched_haystackscCs6g}x,||D] }|d|kr q|j|dqW|S)Nr)r')rrresultirrrmatched_keysdszMatchCounter.matched_keyscCstdd||DS)Ncss|]}|dVqdS)r	Nr)r"r+rrrr#nsz/MatchCounter.matched_needles.<locals>.<genexpr>)r,)rrrrrr!mszMatchCounter.matched_needlesFNcCs |r|n|j}t||jdS)N)r)keysrr )rreverseZlimit_tor1rrrrpszMatchCounter.sortedcstfdddS)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	functoolsrrrdictrrrrr<module>s