%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/utils/ |
Current File : //lib/python2.7/site-packages/salt/utils/listdiffer.pyc |
� ���^c @@ s_ d Z d d l m Z m Z d d l m Z d d l m Z d � Z d e f d � � YZ d S( u� Compare lists of dictionaries by a specified key. The following can be retrieved: (1) List of added, removed, intersect elements (2) List of diffs having the following format: <key_val>: {<elem_key: {'old': <old_value>, 'new': <new_value>}} A recursive diff is done between the the values (dicts) with the same key (3) List with the new values for each key (4) List with the old values for each key (5) List of changed items in the format ('<key_val>.<elem_key>', {'old': <old_value>, 'new': <new_value>}) (5) String representations of the list diff Note: All dictionaries keys are expected to be strings i ( t absolute_importt unicode_literals( t recursive_diff( t sixc C@ s t | | | � S( N( t ListDictDiffer( t list_at list_bt key( ( s9 /usr/lib/python2.7/site-packages/salt/utils/listdiffer.pyt list_diff s R c B@ s� e Z d Z d � Z d � Z e d � � Z e d � � Z e d � � Z d d d � Z e d � � Z e d � � Z e d d � � Z e d � � Z e d � � Z d d � Z e d � � Z e d � � Z RS( u� Calculates the differences between two lists of dictionaries. It matches the items based on a given key and uses the recursive_diff to diff the two values. c C@ sW g | _ g | _ g | _ | | _ | | _ | | _ x� | D]� } | | k rp t d j | | j � � � � n x� | D]z } | | k r� t d j | | j � � � � n | | | | k rw i | | | 6| d 6| d 6} | j j | � Pqw qw W| j j | � q= WxG | D]? } x6 | D] } | | | | k rPqqW| j j | � qWd S( NuJ The supplied key '{0}' does not exist in item, the available keys are: {1}u oldu new( t _intersectt _removedt _addedt _newt _currentt _keyt ValueErrort formatt keyst append( t selft current_listt next_listR t current_itemt next_itemt item( ( s9 /usr/lib/python2.7/site-packages/salt/utils/listdiffer.pyt __init__$ s4 c C@ sS | d k r7 g | j D] } t | d | d � ^ q S| d k rf g | j D] } t i | � ^ qM S| d k r� g | j D] } t | i d t �^ q| S| d k rCg } | j g | j D] } t | d | d � ^ q� � | j g | j D] } t i | � ^ q� � | j g | j D] } t | i d t �^ q� | St d � � d S( u. Returns the recursive diff between dict valuesu intersectu oldu newu addedu removedt ignore_missing_keysu allu<