%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/utils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/utils/__pycache__/plugin_docs.cpython-39.opt-1.pyc

a

�)g�:�@sddlmZmZmZeZddlmZmZm	Z	ddl
mZddlm
ZddlmZddlmZmZmZddlmZddlmZdd	lmZdd
lmZddlmZe�Z dd
�Z!dd�Z"d"dd�Z#d#dd�Z$d$dd�Z%d%dd�Z&dd�Z'dd�Z(dd�Z)d d!�Z*dS)&�)�absolute_import�division�print_function)�MutableMapping�
MutableSet�MutableSequence)�Path)�	constants)�__version__)�AnsibleError�AnsibleParserError�AnsiblePluginNotFound)�string_types)�	to_native)�read_docstring)�
AnsibleLoader)�DisplaycCs�|��D]�\}}||vr�t||t�r6|�||�nNt||t�rT|�||�n0t||t�rxtt|||��}nt	d|��|||<qdS)Nz?Attempt to extend a documentation fragment, invalid type for %s)
�items�
isinstancer�updater�addr�sorted�	frozenset�	Exception)�target�source�key�value�r�=/usr/lib/python3.9/site-packages/ansible/utils/plugin_docs.py�merge_fragmentsr cs�d��fdd�	���fdd�������fdd����fdd	���fd
d�}|sTdS|rd�|�dSd|vrx�|dd
�t|�d�t�r��|ddd�t|�d�t�r��|d�t|�d�t�r�||d�dS)NFcsj|rdnd}t|t�sdS�s"|r6d|vr6�|d|�d|vrJ�|d|��sf|sfd|vrf�|d|�dS)NZremoved_from_collection�collection_nameZ
removed_inZremoved_at_date�version)rr)Zdeprecation�	top_levelr!)�callback�	is_modulerr�process_deprecation's
z8_process_versions_and_dates.<locals>.process_deprecationcsJ|D]@}t|t�sqd|vr(�|dd�t|�d�t�r�|d�qdS)N�
version_added�version_added_collection�
deprecated)rr�get)Z
specifiersZ	specifier)r$r&rr�process_option_specifiers2s
z>_process_versions_and_dates.<locals>.process_option_specifierscs�|��D]�}t|t�sqd|vr,�|dd��s�t|�d�t�rL�|d�t|�d�t�rh�|d�t|�d�t�r��|d�t|�d�t�r��|d�t|�d�t�r�|d�qdS)Nr'r(�envZini�varsr)Z
suboptions)�valuesrrr*�list)�options�option)r$r%r&r+�process_optionsrrr2;s 
z4_process_versions_and_dates.<locals>.process_optionscsN|��D]@}t|t�sqd|vr,�|dd�t|�d�t�r�|d�qdS)Nr'r(�contains)r.rrr*)Z
return_valuesZreturn_value)r$�process_return_valuesrrr4Ms
z:_process_versions_and_dates.<locals>.process_return_valuescs2|��D]$}t|t�sqd|vr�|dd�qdS)Nr'r()r.rr)�
attributesZ	attribute)r$rr�process_attributesVs

z7_process_versions_and_dates.<locals>.process_attributesr'r(r)T)r#r0r5)F)rr*r)�fragmentr%�return_docsr$r6r)r$r%r&r+r2r4r�_process_versions_and_dates&s$		r9Fcs�fdd�}t||||�dS)Ncs||vr�||<dS�Nr�r0r1Zcollection_name_field�r!rrrosz1add_collection_to_versions_and_dates.<locals>.add�r9)r7r!r%r8rrr<r�$add_collection_to_versions_and_datesnsr>cs�fdd�}t||||�dS)Ncs|�|��kr||=dSr:)r*r;r<rr�removewszAremove_current_collection_from_versions_and_dates.<locals>.remover=)r7r!r%r8r?rr<r�1remove_current_collection_from_versions_and_datesvsr@cCs�|�dg�}t|t�r|g}g}|D�]J}|}d}|�|�}	|	durvd|vrv|�dd�}
|
d}|
d��}|�|�}	|	dur�|�|�q$t|	|d�}|dur�|dkr�|�|�q$nd}t||d��	�}t|	d�}
d|
vr�d�
|
�d�dd	��nd
}t|||d�d|v�r>|�d�}|�r>d|v�r0g|d<|d�
|�d
|v�rx|�d
�}|�rxd
|v�rjg|d
<|d
�
|�d|v�r�d|v�r�td||f��dD]�}||v�r�||v�rzt|||�|��Wn>t�y}z$tdt|�|||f��WYd}~n
d}~00n|�|�||<�q�zt||�Wq$t�yn}z"tdt|�||f��WYd}~q$d}~00q$|�r�td�|td�
|�����dS)NZextends_documentation_fragmentZ
DOCUMENTATION�.�rz{})�	file_nameZansible_name���r%�notes�seealsor0r5zJmissing options or attributes in fragment (%s), possibly misformatted?: %s)r0r5z%s %s (%s) of unknown type: %sz%s (%s) of unknown type: %sz(unknown doc_fragment(s) in file {0}: {1}z, )�poprrr*�rsplit�upper�append�getattrrZget_single_data�join�splitr>�extendrr rr�format)�doc�filename�fragment_loaderr%Z	fragmentsZunknown_fragmentsZ
fragment_slugZ
fragment_nameZfragment_varZfragment_classZ	splitnameZ
fragment_yamlr7Zreal_fragment_nameZreal_collection_namerGrHZdoc_key�errr�
add_fragments~sl






$







0.rVNcCs�|dur |durd}q |dk}nt|||d�}|�dd�rh|durTt|d||d�t|d|||d�|�dd�r�|dur�t|d||d	d
�|d|d|d|dfS)
z�
    DOCUMENTATION can be extended using documentation fragments loaded by the PluginLoader from the doc_fragments plugins.
    NF�module)�verbose�
ignore_errorsrRrF)rTr%Z
returndocsT)r%r8Z
plainexamples�metadata)rr*r>rV)rSrTrXrYr!r%�plugin_type�datarrr�
get_docstring�s
r]c
st|�}z�tj�d�}|�d�s(|d7}|�d�r>|dd�}t�d��t��dkrbt	d�
t���d�
�d	�d�}�d
�d�r�t�fdd
�dD��s�t��dkr�d�dvr�d}d�
|||�WSt�y�}zd�
|t|��WYd}~Sd}~00dS)a�
    returns a versioned documentation link for the current Ansible major.minor version; used to generate
    in-product warning/error links to the configured DOCSITE_ROOT_URL
    (eg, https://docs.ansible.com/ansible/2.8/somepath/doc.html)

    :param path: relative path to a document under docs/docsite/rst;
    :return: absolute URL to the specified doc for the current version of Ansible
    ZDOCSITE_ROOT_URL�/rBNrA�zinvalid version ({0})z{0}.{1}rrD�0c3s|]}|�dvVqdS)rDNr)�.0Zpre�Z	split_verrr�	<genexpr>
�z(get_versioned_doclink.<locals>.<genexpr>)�a�b�devZdevelz
{0}{1}/{2}z7(unable to create versioned doc link for path {0}: {1}))
r�CZconfigZget_config_value�endswith�
startswith�ansible_versionrO�len�RuntimeErrorrQ�anyr)�pathZbase_urlZdoc_version�exrrbr�get_versioned_doclink�s"	


.rqcCsft|�}|�d�d}|j|kr*|�|�}g}|D].}|�|�}||krJq2|��r2|�t|��q2|S)NrA���)rrO�stem�	with_name�with_suffix�existsrLr)ro�plugin�
extensionsZadjacentZplugin_base_name�paths�ext�	candidaterrr�_find_adjacents


r|cCs�|j|ddd�}|r|js0|dvr0|�|�\}}|r:|jsJtd||d��t|j�}|jtjvr�t	||tj�}|rz|dnd}nt
|�}|dur�td	|��||jfS)
zn  if the plugin lives in a non-python file (eg, win_X.ps1), require the corresponding 'sidecar' file for docs FT)Zignore_deprecatedZ
check_aliases)�filter�testz%s was not found)Zplugin_load_contextrNzO%s cannot contain DOCUMENTATION nor does it have a companion documentation file)
Zfind_plugin_with_contextZresolvedZget_with_contextr
rZplugin_resolved_path�suffixrh�DOC_EXTENSIONSr|rrZplugin_resolved_collection)rwr[�loader�contextZ
plugin_objZdocfile�	filenamesrSrrr�find_plugin_docfile's

r�c
Cs"g}t|||�\}}zt|||||d�}Wn8tyb}z td||f|d��WYd}~n
d}~00|ds�t||tj�D]j}	z,t|	||||d�}|	}|ddur�Wq�Wqzty�}z td||f|d��WYd}~qzd}~00qz|ddu�rtd||f��n||dd<||dd<|S)	N)rXr!r[z1%s did not contain a DOCUMENTATION attribute (%s))Zorig_excrz?Adjacent file %s did not contain a DOCUMENTATION attribute (%s)z&No documentation available for %s (%s)rSZ
collection)r�r]rrr|rhr�)
rwr[r�rTrXZdocsrSr!rUZnewfilerrr�get_plugin_docs@s(*
,r�)F)F)F)FFNNN)+Z
__future__rrr�typeZ
__metaclass__�collections.abcrrr�pathlibrZansibler	rhZansible.releaser
rkZansible.errorsrrr
Zansible.module_utils.sixrZansible.module_utils._textrZansible.parsing.plugin_docsrZansible.parsing.yaml.loaderrZansible.utils.displayrZdisplayr r9r>r@rVr]rqr|r�r�rrrr�<module>s,H


R
 "

Zerion Mini Shell 1.0