%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/json.cpython-39.pyc

a

�)g��@s�ddlmZmZmZeZddlZddlZddlm	Z	ddl
mZddlm
Z
dd�Zdd	�Zd
d�Zdd
�ZGdd�dej�ZdS)�)�absolute_import�division�print_functionN)�to_text)�Mapping)�is_sequencecCst|dd�ot|dd�S)N�
__UNSAFE__F�
__ENCRYPTED__��getattr��value�r�D/usr/lib/python3.9/site-packages/ansible/module_utils/common/json.py�
_is_unsafesrcCst|dd�S)Nr	Fr
rrrr�	_is_vaultsrcCs\t|�r dt|��ddd�i}n8t|�r8dd�|D�}n t|t�rXtdd�|��D��}|S)	z�Recursively preprocess a data structure converting instances of ``AnsibleUnsafe``
    into their JSON dict representations

    Used in ``AnsibleJSONEncoder.iterencode``
    �__ansible_unsafe�surrogate_or_strict�strict��errorsZ	nonstringcSsg|]}t|��qSr��_preprocess_unsafe_encode)�.0�vrrr�
<listcomp>#�z-_preprocess_unsafe_encode.<locals>.<listcomp>css|]\}}|t|�fVqdS�Nr)r�krrrr�	<genexpr>%rz,_preprocess_unsafe_encode.<locals>.<genexpr>)rr�
_strip_unsafer�
isinstancer�dict�itemsrrrrrs
rcCstj|tddd�S)NT�)�clsZ	sort_keys�indent)�json�dumps�AnsibleJSONEncoder)Z	structurerrr�	json_dump*sr*cs:eZdZdZd	�fdd�	Z�fdd�Z�fdd�Z�ZS)
r)zS
    Simple encoder class to deal with JSON encoding of Ansible internal types
    Fcs&||_||_tt|�jfi|��dSr)�_preprocess_unsafe�_vault_to_text�superr)�__init__)�selfZpreprocess_unsafeZ
vault_to_text�kwargs��	__class__rrr.3szAnsibleJSONEncoder.__init__cs�t|dd�r6|jr t|dd�}q�dt|jddd�i}ndt|dd�rZd	t|��ddd�i}n@t|t�rnt|�}n,t|tj	tjf�r�|�
�}ntt|��
|�}|S)
Nr	Fr)rZ__ansible_vaultrrrr)rr,rZ_ciphertextr r!rr"�datetime�dateZ	isoformatr-r)�default)r/�or
r1rrr59s


zAnsibleJSONEncoder.defaultcs&|jrt|�}tt|�j|fi|��S)z�Custom iterencode, primarily design to handle encoding ``AnsibleUnsafe``
        as the ``AnsibleUnsafe`` subclasses inherit from string types and
        ``json.JSONEncoder`` does not support custom encoders for string types
        )r+rr-r)�
iterencode)r/r6r0r1rrr7NszAnsibleJSONEncoder.iterencode)FF)�__name__�
__module__�__qualname__�__doc__r.r5r7�
__classcell__rrr1rr).sr))Z
__future__rrr�typeZ
__metaclass__r'r3Zansible.module_utils._textrZ/ansible.module_utils.common._collections_compatrZ'ansible.module_utils.common.collectionsrrrrr*ZJSONEncoderr)rrrr�<module>s

Zerion Mini Shell 1.0