403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/dictupdate.cpython-310.pyc
o

;jH-�@sdZddlZddlZddlmZddlmZddlZddl	m
Z
ddlmZddl
mZe�e�Zd$d
d�Zdd
�Zd%dd�Zdd�Zd%dd�Zd&dd�Ze
d	fdd�Ze
d	fdd�Zed�e
d	fdd��Zed�e
d	fdd��Zed �e
d	fd!d ��Zed"�e
d	fd#d"��ZdS)'z]
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
�N)�OrderedDict)�Mapping)�DEFAULT_TARGET_DELIM)�SaltInvocationError)�jinja_filterTFc
	s*t|t�r
t|t�std��t|���}tt|����t|�@s"d}|r�|D]_}||}z|�|d�}Wnty?d}Ynwt|t�rVt|t�rVt|||d�}|||<q&t|t�rt|t�r|rxt	�
|�����fdd�|D���||<q&||||<q&||||<q&|S|D]}	||	||	<q�|S)a�
    Recursive version of the default dict.update

    Merges upd recursively into dest

    If recursive_update=False, will use the classic dict.update, or fall back
    on a manual merge (helpful for non-dict types like FunctionWrapper)

    If merge_lists=True, will aggregate list object types instead of replace.
    The list in ``upd`` is added to the list in ``dest``, so the resulting list
    is ``dest[key] + upd[key]``. This behavior is only activated when
    recursive_update=True. By default merge_lists=False.

    .. versionchanged:: 2016.11.6
        When merging lists, duplicate values are removed. Values already
        present in the ``dest`` list are not added from the ``upd`` list.
    z9Cannot update using non-dict types in dictupdate.update()FN��merge_listscsg|]}|�vr|�qS�r	)�.0�x��mergedr	�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/dictupdate.py�
<listcomp>7szupdate.<locals>.<listcomp>)�
isinstancer�	TypeError�list�keys�set�get�AttributeError�update�copy�deepcopy�extend)
�destZupdZrecursive_updaterZupdkeys�key�valZdest_subkey�ret�kr	rrrs6�


rcCs<i}|��D]\}}||vr|||g||<q|||<q|S)N)�items)�obj_a�obj_brrrr	r	r�
merge_listCs
r#cCst�|�}t|||d�S�Nr)rrr)r!r"rZcopiedr	r	r�
merge_recurseMs
r%cCsddlm}|||dd�S)Nr)�merge_recursive�)�level)Zsalt.serializers.yamlexr&)r!r"Z_yamlex_merge_recursiver	r	r�merge_aggregateRsr)cCs,|D]}||vr||||<qt|||d�Sr$)r%)r!r"r�objr	r	r�merge_overwriteXs
�r+�smart�yamlcCs�|dkr|�d�ddks|�d�rd}nd}|dkr"t||�}|S|dkr.t|||�}|S|dkr9t||�}|S|d	krEt|||�}|S|d
krPt||�}|St�d|�t||�}|S)Nr,�|���ZyamlexZyamlex_Z	aggregateZrecurserZ	overwrite�nonez2Unknown merging strategy '%s', fallback to recurse)�split�
startswithr#r%r)r+�log�warning)r!r"ZstrategyZrendererrr
r	r	r�merge_s,
��
�	�
�
r5cCsd||vr
|�|�}n|g}|}|r0|�d�}||vs!t||t�s*|r&t�ni||<||}|s|S)a�
    Ensures that in_dict contains the series of recursive keys defined in keys.

    :param dict in_dict: The dict to work with.
    :param str keys: The delimited string with one or more keys.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: dict
    :return: Returns the modified in-place `in_dict`.
    r)r1�popr�dictr)�in_dictr�	delimiter�ordered_dictZa_keys�dict_pointerZcurrent_keyr	r	r�ensure_dict_keyzs

��r<cCsV||vr#|�|�\}}}t||||d�tjjj||d|d�}||fS|}|}||fS)aC
    Helper function to:
    - Ensure all but the last key in `keys` exist recursively in `in_dict`.
    - Return the dict at the one-to-last key, and the last key

    :param dict in_dict: The dict to work with.
    :param str keys: The delimited string with one or more keys.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: tuple(dict, str)
    :return: (The dict at the one-to-last key, the last key)
    �r9r:N)�defaultr9)�
rpartitionr<�salt�utils�dataZ
traverse_dict)r8rr9r:Zall_but_last_keys�_�last_keyr;r	r	r�_dict_rpartition�s���rE�set_dict_key_valuecCs t||||d�\}}|||<|S)ax
    Ensures that in_dict contains the series of recursive keys defined in keys.
    Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.

    :param dict in_dict: The dictionary to work with
    :param str keys: The delimited string with one or more keys.
    :param any value: The value to assign to the nested dict-key.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: dict
    :return: Returns the modified in-place `in_dict`.
    r=)rE�r8r�valuer9r:r;rDr	r	rrF�s

��update_dict_key_valuec	Cs�t||||d�\}}||vs||dur|rt�ni||<z
||�|�W|Sty9td�t||����ttfyOtd�t||�t|����w)a�
    Ensures that in_dict contains the series of recursive keys defined in keys.
    Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
    with `value`.

    :param dict in_dict: The dictionary to work with
    :param str keys: The delimited string with one or more keys.
    :param any value: The value to update the nested dict-key with.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: dict
    :return: Returns the modified in-place `in_dict`.
    r=Nz0The last key contains a {}, which cannot update.zCannot update {} with a {}.)	rErrrr�format�type�
ValueErrorrrGr	r	rrI�s*
�
�
������append_dict_key_valuec	Csjt||||d�\}}||vs||durg||<z
||�|�W|Sty4td�t||����w)a�
    Ensures that in_dict contains the series of recursive keys defined in keys.
    Also appends `value` to the list that is at the end of `in_dict` traversed
    with `keys`.

    :param dict in_dict: The dictionary to work with
    :param str keys: The delimited string with one or more keys.
    :param any value: The value to append to the nested dict-key.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: dict
    :return: Returns the modified in-place `in_dict`.
    r=Nz0The last key contains a {}, which cannot append.)rE�appendrrrJrKrGr	r	rrM�s
��
����extend_dict_key_valuec	Cs�t||||d�\}}||vs||durg||<z
||�|�W|Sty4td�t||����tyHtd�t||�t|����w)a�
    Ensures that in_dict contains the series of recursive keys defined in keys.
    Also extends the list, that is at the end of `in_dict` traversed with `keys`,
    with `value`.

    :param dict in_dict: The dictionary to work with
    :param str keys: The delimited string with one or more keys.
    :param any value: The value to extend the nested dict-key with.
    :param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
    :param bool ordered_dict: Create OrderedDicts if keys are missing.
                              Default: create regular dicts.
    :rtype: dict
    :return: Returns the modified in-place `in_dict`.
    r=Nz0The last key contains a {}, which cannot extend.zCannot extend {} with a {}.)rErrrrJrKrrGr	r	rrOs*
�
�
�����)TF)F)r,r-F)�__doc__r�logging�collectionsr�collections.abcrZsalt.utils.datar@Z
salt.defaultsrZsalt.exceptionsrZsalt.utils.decorators.jinjar�	getLogger�__name__r3rr#r%r)r+r5r<rErFrIrMrOr	r	r	r�<module>s<

0



��'�!�

Youez - 2016 - github.com/yon3zu
LinuXploit