Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /lib64/python3.9/site-packages/setools/diff/__pycache__/
Dosya Yükle :
Şuanki Dosya : //lib64/python3.9/site-packages/setools/diff/__pycache__/difference.cpython-39.pyc

a

q�qep�@s�ddlZddlmZmZddlmZmZmZddlm	Z	m
Z
mZGdd�d�Zede	d	�Z
Gd
d�deee
�Zede
d	�ZGd
d�dee�ZdS)�N)�ABC�abstractmethod)�Generic�Iterable�TypeVar�)�PolicyObject�PolicySymbol�
SELinuxPolicyc@s�eZdZdZeedd�dd�Zedd��Zejdd��Zed	d
��Z	e	jdd
��Z	dd�d
d�Z
eeed�dd��Z
eddd��ZdS)�
Differencez&Base class for all policy differences.N)�left_policy�right_policy�returncCst�t�|_||_||_dS�N)�loggingZ	getLogger�__name__�logrr
)�selfrr
�r�=/usr/lib64/python3.9/site-packages/setools/diff/difference.py�__init__szDifference.__init__cCs|jSr)�_left_policy�rrrrrszDifference.left_policycCs$|j�d�|��||_|��dS)Nz"Policy diff left policy set to {0})r�info�formatr�_reset_diff�rZpolicyrrrrscCs|jSr)�
_right_policyrrrrr
#szDifference.right_policycCs$|j�d�|��||_|��dS)Nz#Policy diff right policy set to {0})rrrrrrrrrr
's)rcCst�dS)z%Reset diff results on policy changes.N)�NotImplementedErrorrrrrr0szDifference._reset_diff)�	rule_listrccs&|D]}|��D]}||�VqqdS)z4Generator that yields a wrapped, expanded rule list.N)�expand)rZ
wrapper_classZunexpanded_ruleZ
expanded_rulerrr�_expand_generator4szDifference._expand_generatorTcCs�t|�}t|�}||}||}t�}t|||d�}	t|||d�}
t|	�t|
�ksnJd�t|	�t|
����t|	|
�D].\}}||ks�Jd�||���|�||f�qx|r�tdd�|D��tdd�|D��tdd�|D��fS|||fSdS)a�
        Standard diff of two sets.

        Parameters:
        left        An iterable
        right       An iterable

        Return:
        tuple       (added, removed, matched)

        added       Set of items in right but not left
        removed     Set of items in left but not right
        matched     Set of items in both left and right.  This is
                    in the form of tuples with the matching item
                    from left and right
        ��keyzDMatched items assertion failure (this is an SETools bug), {0} != {1}css|]}|jVqdSr��origin��.0�irrr�	<genexpr>q�z'Difference._set_diff.<locals>.<genexpr>css|]}|jVqdSrr$r&rrrr)rr*css|]\}}|j|jfVqdSrr$)r'�left�rightrrrr)sr*N)�set�sorted�lenr�zip�add)r+r,r#�unwrapZ
left_itemsZright_itemsZadded_itemsZ
removed_itemsZ
matched_itemsZleft_matched_itemsZright_matched_itemsrrr�	_set_diff>s2��
���zDifference._set_diff)NT)r�
__module__�__qualname__�__doc__r
r�propertyr�setterr
r�staticmethodrr!r3rrrrr
s



	r�T)�boundc@sleZdZUdZeed<eed<dZeedd�dd�Zd	d
�Z	e
dd��Ze
d
d��Ze
dd��Z
dd�ZdS)�Wrapperz/Abstract base class for policy object wrappers.r%r#�r%r#N)r%r#rcCs||_||_dSrr=)rr%r#rrrr�szWrapper.__init__cCsd�|t|j��S)Nz&<{0.__class__.__name__}(Wrapping {1})>)r�reprr%rrrr�__repr__�szWrapper.__repr__cCsdSrrrrrr�__hash__�szWrapper.__hash__cCsdSrr�r�otherrrr�__eq__�szWrapper.__eq__cCsdSrrrArrr�__lt__�szWrapper.__lt__cCs
||kSrrrArrr�__ne__�szWrapper.__ne__)rr4r5r6r:�__annotations__�int�	__slots__rr?rr@rCrDrErrrrr<{s



r<�ScsNeZdZUdZeed<dZedd��fdd�Zdd	�Z	d
d�Z
dd
�Z�ZS)�
SymbolWrapperz�
    General wrapper for policy symbols, e.g. types, roles
    to provide a diff-specific equality operation based
    on its name.
    �name�rKN)�symbolrcs t��|t|j��|j|_dSr)�superr�hashrK)rrM��	__class__rrr�szSymbolWrapper.__init__cCs|jSrr"rrrrr@�szSymbolWrapper.__hash__cCs|j|jkSrrLrArrrrD�szSymbolWrapper.__lt__cCs|j|jkSrrLrArrrrC�szSymbolWrapper.__eq__)
rr4r5r6�strrFrHrIrr@rDrC�
__classcell__rrrPrrJ�s
rJ)r�abcrr�typingrrrZ	policyreprr	r
rr:r<rIrJrrrr�<module>sk!

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4