3 �^� � @ sd d dl mZ ddlmZ ddlmZmZmZ eddddd d g�ZG dd� de�Z G d d� de�Z dS )� )� namedtuple� )�DiffResultDescriptor)� Difference� SymbolWrapper�WrapperZmodified_defaultZrule� added_default�removed_default�added_default_range�removed_default_rangec @ s8 e Zd ZdZed�Zed�Zed�Zdd� Zdd� Z dS )�DefaultsDifferencez;Determine the difference in default_* between two policies.� diff_defaultsc C s� | j jdj| �� | jdd� | jj� D �dd� | jj� D ��\| _| _}g | _ x�|D ]�\}}|j |j krv|j }|j }nd}d}y&|j|jkr�|j}|j}nd}d}W n tk r� d}d}Y nX |s�|rT| j j t|||||�� qTW dS )z>Generate the difference in type defaults between the policies.zIGenerating default_* differences from {0.left_policy} to {0.right_policy}c s s | ]}t |�V qd S )N)�DefaultWrapper)�.0�d� r �/usr/lib64/python3.6/default.py� <genexpr>0 s z3DefaultsDifference.diff_defaults.<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_policyZdefaultsZright_policy�added_defaults�removed_defaults�modified_defaults�defaultZ default_range�AttributeError�append�modified_default_record)�selfZmatched_defaultsZleft_defaultZ right_defaultr r r r r r r r ( s: z DefaultsDifference.diff_defaultsc C s"