%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/ |
| Current File : //lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/collections.cpython-39.pyc |
a
�)g � @ s~ d Z ddlmZmZmZ eZddlmZm Z ddl
mZmZm
Z
mZ G dd� dee�Zdd� Zdd
d�Zddd
�Zdd� ZdS )z*Collection of low-level utility functions.� )�absolute_import�division�print_function)�binary_type� text_type)�Hashable�Mapping�MutableMapping�Sequencec @ sX e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� ZdS )�
ImmutableDictz!Dictionary that cannot be updatedc O s t |i |��| _d S �N)�dict�_store)�self�args�kwargs� r �K/usr/lib/python3.9/site-packages/ansible/module_utils/common/collections.py�__init__ s zImmutableDict.__init__c C s
| j | S r �r )r �keyr r r �__getitem__ s zImmutableDict.__getitem__c C s
| j �� S r )r �__iter__�r r r r r s zImmutableDict.__iter__c C s
| j �� S r )r �__len__r r r r r s zImmutableDict.__len__c C s t t| �� ��S r )�hash� frozenset�itemsr r r r �__hash__ s zImmutableDict.__hash__c C s2 z| � � t|�krW dS W n ty, Y n0 dS )NTF)r r � TypeError)r �otherr r r �__eq__ s
zImmutableDict.__eq__c C s d� t| j��S )NzImmutableDict({0}))�format�reprr r r r r �__repr__( s zImmutableDict.__repr__c C s t | jfi |��S )a�
Create an ImmutableDict as a combination of the original and overriding_mapping
:arg overriding_mapping: A Mapping of replacement and additional items
:return: A copy of the ImmutableDict with key-value pairs from the overriding_mapping added
If any of the keys in overriding_mapping are already present in the original ImmutableDict,
the overriding_mapping item replaces the one in the original ImmutableDict.
)r r )r Zoverriding_mappingr r r �union+ s
zImmutableDict.unionc s6 t |�� � fdd��j�� D �}t�fdd�|D ��S )aK
Create an ImmutableDict as a combination of the original minus keys in subtractive_iterable
:arg subtractive_iterable: Any iterable containing keys that should not be present in the
new ImmutableDict
:return: A copy of the ImmutableDict with keys from the subtractive_iterable removed
c 3 s | ]}|� vr|V qd S r r ��.0�k)�remove_keysr r � <genexpr>@ � z+ImmutableDict.difference.<locals>.<genexpr>c 3 s | ]}|� j | fV qd S r r r&