3 �^p � @ 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_fsuse�ruleZ added_contextZremoved_contextc @ s8 e Zd ZdZed�Zed�Zed�Zdd� Zdd� Z dS )�FSUsesDifferencez@Determine the difference in fs_use_* rules between two policies.�diff_fs_usesc 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 fs_use rules between the policies.zHGenerating fs_use_* differences from {0.left_policy} to {0.right_policy}c s s | ]}t |�V qd S )N)�FSUseWrapper)�.0�fs� r �/usr/lib64/python3.6/fsuse.py� <genexpr>/ s z0FSUsesDifference.diff_fs_uses.<locals>.<genexpr>c s s | ]}t |�V qd S )N)r )r r r r r r 0 s N)�log�info�formatZ _set_diffZleft_policyZfs_usesZright_policy� added_fs_uses�removed_fs_uses�modified_fs_usesr �context�append�modified_fsuse_record)�selfZmatchedZ left_ruleZ right_ruler r r r '