Your IP : 3.148.178.125
3
�<�e��@s(ddlZddlmZGdd�de�ZdS)�N)�reducec@s(eZdZdZdd�Zdd�Zdd�ZdS) �Mergerz0
Tool for merging multiple profiles into one.
cCsdS)N�)�selfrr�/usr/lib/python3.6/merger.py�__init__ szMerger.__init__cCst|j|�}|S)z�
Merge multiple configurations into one. If there are multiple units of the same type, option 'devices'
is set for each unit with respect to eliminating any duplicate devices.
)r�
_merge_two)rZconfigsZ
merged_configrrr�mergeszMerger.mergecCs�|jj|j��x�t|jj��D�]~\}}|js:||jkrF||j|<q |j|j|_|j|j|_|j|j|_|j dk r�|j |j|_ |j
dk r�|j
|j|_
|jdk r�|j|j|_|jdk r�|j|j|_|j
dk r�|j
|j|_
|jdk �rx"|jD]}|j|jj|d�q�Wd|_|dk�r�|j|jjdd�dk �r�|j|jjdd�}|j|jj|j�||j|jd|j|jd<q |j|jj|j�q W|S)z�
Merge two profiles. The configuration of units with matching names are updated with options
from the newer profile. If the 'replace' options of the newer unit is 'True', all options from the
older unit are dropped.
N�script)Zoptions�update�listZunits�items�replace�typeZenabledZdevicesZdevices_udev_regexZ
cpuinfo_regexZuname_regexZ
script_preZscript_postZdrop�pop�get)rZ profile_aZ profile_bZ unit_nameZunitZoptionr
rrrrs6
$"zMerger._merge_twoN)�__name__�
__module__�__qualname__�__doc__rr rrrrrrsr)�collections� functoolsr�objectrrrrr�<module>s
?>