<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
À<×eˆ  ã               @   s(   d dl Z d dlmZ G dd„ deƒZdS )é    N)Úreducec               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚMergerz0
	Tool for merging multiple profiles into one.
	c             C   s   d S )N© )Úselfr   r   ú/usr/lib/python3.6/merger.pyÚ__init__	   s    zMerger.__init__c             C   s   t | 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)r   ZconfigsZmerged_configr   r   r   Úmerge   s    zMerger.mergec             C   s¨  |j j|j ƒ x’t|jjƒ ƒD ]~\}}|js:||jkrF||j|< q |j|j| _|j|j| _|j|j| _|j	dk	rˆ|j	|j| _	|j
dk	r |j
|j| _
|jdk	r¸|j|j| _|jdk	rÐ|j|j| _|jdk	rè|j|j| _|jdk	rx"|jD ]}|j| j j|dƒ qüW d|_|dkrŒ|j| j jddƒdk	rŒ|j| j jddƒ}|j| j j|j ƒ ||j| j d  |j| j d< q |j| j j|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)ZoptionsÚupdateÚlistZunitsÚitemsÚreplaceÚtypeZenabledZdevicesZdevices_udev_regexZcpuinfo_regexZuname_regexZ
script_preZscript_postZdropÚpopÚget)r   Z	profile_aZ	profile_bZ	unit_nameZunitZoptionr
   r   r   r   r      s6    




$"zMerger._merge_twoN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r	   r   r   r   r   r   r      s   r   )ÚcollectionsÚ	functoolsr   Úobjectr   r   r   r   r   Ú<module>   s   