
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
^C                 @   sL   d dl mZ ddlmZ ddlmZmZ eddddgZG d	d
 d
eZdS )    )
namedtuple   )DiffResultDescriptor)
DifferenceSymbolWrapperZmodified_commonadded_permsremoved_permsmatched_permsc               @   s8   e Zd ZdZedZedZedZdd Zdd Z	dS )CommonDifferencezV
    Determine the difference in common permission sets
    between two policies.
    diff_commonsc             C   s   | j jdj|  | jdd | jj D dd | jj D \| _| _}t	 | _
xD|D ]<\}}| j|j|jdd\}}}|s|rVt|||| j
|< qVW dS )z8Generate the difference in commons between the policies.zFGenerating common differences from {0.left_policy} to {0.right_policy}c             s   s   | ]}t |V  qd S )N)r   ).0c r   /usr/lib64/python3.6/commons.py	<genexpr>0   s    z0CommonDifference.diff_commons.<locals>.<genexpr>c             s   s   | ]}t |V  qd S )N)r   )r   r   r   r   r   r   1   s    F)ZunwrapN)loginfoformatZ	_set_diffZleft_policyZcommonsZright_policyadded_commonsremoved_commonsdictmodified_commonsZpermsmodified_commons_record)selfZmatched_commonsZleft_commonZright_commonr   r   r	   r   r   r   r   )   s     zCommonDifference.diff_commonsc             C   s"   | j jd d| _d| _d| _dS )z%Reset diff results on policy changes.zResetting common differencesN)r   debugr   r   r   )r   r   r   r   _reset_diffD   s    zCommonDifference._reset_diffN)
__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r
      s   r
   N)	collectionsr   Zdescriptorsr   
differencer   r   r   r
   r   r   r   r   <module>   s   