3 �^4 � @ s� d dl mZmZ ddlmZ ddlmZ ddlmZm Z ddl mZ ddlm Z dd lmZ ed ddd g�ZG dd� de�ZG dd� de �ZdS )� )�defaultdict� namedtuple� )�MLSRuletype� )�DiffResultDescriptor)� Difference�Wrapper)�RangeWrapper)�class_wrapper_factory)�type_or_attr_wrapper_factoryZmodified_mlsrule�ruleZ added_defaultZremoved_defaultc @ sP e Zd ZdZed�Zed�Zed�Zee �Z ee �Zdd� Zdd� Z dd� Zd S ) �MLSRulesDifferencez;Determine the difference in MLS rules between two policies.�diff_range_transitionsc C s� | j jdj| �� | j s"| j r*| j� | j| j| jtj t �| j| jtj t ��\}}}g }x:|D ]2\}}t|j�t|j�krf|j t||j|j�� qfW || _|| _|| _dS )zGGenerate the difference in range_transition rules between the policies.zPGenerating range_transition differences from {0.left_policy} to {0.right_policy}N)�log�info�format�_left_mls_rules�_right_mls_rules�_create_mls_rule_listsZ _set_diffZ_expand_generatorr Zrange_transition�MLSRuleWrapperr �default�append�modified_mlsrule_record�added_range_transitions�removed_range_transitions�modified_range_transitions)�selfZaddedZremovedZmatchedZmodifiedZ left_ruleZ right_rule� r � /usr/lib64/python3.6/mlsrules.pyr / s&