509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
í«„^!  ã               @   sh   d dl mZ 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
G dd„ deƒZdS )é    )Ú
namedtupleé   )ÚContextWrapper)ÚDiffResultDescriptor)Ú
DifferenceÚWrapperZmodified_ibendportconZruleZadded_contextZremoved_contextc               @   s8   e Zd ZdZedƒZedƒZedƒZdd„ Zdd„ Z	dS )ÚIbendportconsDifferencez?Determine the difference in ibendportcons between two policies.Údiff_ibendportconsc             C   s�   | j jdj| ƒƒ | jdd„ | jjƒ D ƒdd„ | jjƒ D ƒƒ\| _| _}g | _	x<|D ]4\}}t
|jƒt
|jƒkrT| j	jt||j|jƒƒ qTW dS )z>Generate the difference in ibendportcons between the policies.zLGenerating ibendportcon differences from {0.left_policy} to {0.right_policy}c             s   s   | ]}t |ƒV  qd S )N)ÚIbendportconWrapper)Ú.0Ún© r   ú$/usr/lib64/python3.6/ibendportcon.pyú	<genexpr>0   s    z=IbendportconsDifference.diff_ibendportcons.<locals>.<genexpr>c             s   s   | ]}t |ƒV  qd S )N)r
   )r   r   r   r   r   r   1   s    N)ÚlogÚinfoÚformatZ	_set_diffZleft_policyZibendportconsZright_policyÚadded_ibendportconsÚremoved_ibendportconsÚmodified_ibendportconsr   ÚcontextÚappendÚmodified_ibendportcon_record)ÚselfZmatched_ibendportconsZ	left_ibepZ
right_ibepr   r   r   r	   '   s     z*IbendportconsDifference.diff_ibendportconsc             C   s"   | j jdƒ d| _d| _d| _dS )z%Reset diff results on policy changes.z"Resetting ibendportcon differencesN)r   Údebugr   r   r   )r   r   r   r   Ú_reset_diffA   s    z#IbendportconsDifference._reset_diffN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r	   r   r   r   r   r   r      s   r   c               @   s4   e Zd ZdZdZdd„ Zdd„ Zdd	„ Zd
d„ ZdS )r
   z/Wrap ibendportcon statements for diff purposes.ÚnameÚportc             C   s$   || _ |j| _|j| _t|ƒ| _d S )N)Úoriginr    r!   ÚhashÚkey)r   Zoconr   r   r   Ú__init__O   s    zIbendportconWrapper.__init__c             C   s   | j S )N)r$   )r   r   r   r   Ú__hash__U   s    zIbendportconWrapper.__hash__c             C   s   | j |j k S )N)r"   )r   Úotherr   r   r   Ú__lt__X   s    zIbendportconWrapper.__lt__c             C   s   | j |j ko| j|jkS )N)r    r!   )r   r'   r   r   r   Ú__eq__[   s    zIbendportconWrapper.__eq__N)r    r!   )	r   r   r   r   Ú	__slots__r%   r&   r(   r)   r   r   r   r   r
   I   s   r
   N)Úcollectionsr   r   r   Zdescriptorsr   Ú
differencer   r   r   r   r
   r   r   r   r   Ú<module>   s   *