3 �^' � @ sh d dl mZ ddlmZ ddlmZ ddlmZmZ edddd g�Z G d d� de�Z G dd � d e�ZdS )� )� namedtuple� )�ContextWrapper)�DiffResultDescriptor)� Difference�WrapperZmodified_ibpkeyconZruleZ added_contextZremoved_contextc @ s8 e Zd ZdZed�Zed�Zed�Zdd� Zdd� Z dS )�IbpkeyconsDifferencez<Determine the difference in ibpkeycons between two policies.�diff_ibpkeyconsc C s� | j jdj| �� | jdd� | jj� D �dd� | jj� D ��\| _| _}g | _ x<|D ]4\}}t |j�t |j�krT| j jt ||j|j�� qTW dS )z;Generate the difference in ibpkeycons between the policies.zIGenerating ibpkeycon differences from {0.left_policy} to {0.right_policy}c s s | ]}t |�V qd S )N)�IbpkeyconWrapper)�.0�n� r �!/usr/lib64/python3.6/ibpkeycon.py� <genexpr>0 s z7IbpkeyconsDifference.diff_ibpkeycons.<locals>.<genexpr>c s s | ]}t |�V qd S )N)r )r r r r r r 1 s N)�log�info�formatZ _set_diffZleft_policyZ ibpkeyconsZright_policy�added_ibpkeycons�removed_ibpkeycons�modified_ibpkeyconsr �context�append�modified_ibpkeycon_record)�selfZmatched_ibpkeyconsZleft_ibpkeyZright_ibpkeyr r r r '