Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/utils/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/utils/collection_loader.pyc

�
�Udac@`s�ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZddlmZddlmZmZmZddlmZddlmZied	d
de�d6ed	d
de�d
6ed	d
�d6ed	ddd�d6ed	dddde�d6ed	dddde�d6Zdeee�fd��YZdefd��YZdd"d��YZ dd�Z"ej#d�Z$d �Z%d!�Z&dS(#i(tabsolute_importtdivisiontprint_functionN(t
ModuleType(tto_bytest	to_nativetto_text(t
import_module(t	iteritemststring_typestwith_metaclass(tcs_open(t	Singletonttypetpkg_onlytallow_external_subpackagestansible_collectionssansible_collections.ansibles#ansible_collections.ansible.builtintmapsansible.pluginss+ansible_collections.ansible.builtin.pluginssansible.module_utilstgrafts8ansible_collections.ansible.builtin.plugins.module_utilstflatmapsansible.moduless3ansible_collections.ansible.builtin.plugins.modulestAnsibleCollectionLoadercB`s�eZdd�Zed��Zd�Zd�Zd�Zed��Z	dd�Z
d�Zd�Ze
d	��Zd
�ZRS(cC`sk|r|jd�|_n$tjjdd�jtj�|_t|jt�rc|jg|_n|jdkr~g|_ng|jD]$}t
tjj|�dd�^q�|_g|_
d|_x�d�tt�D�D]�}|d}|d}t|�}||_d	|_|jd
�}|dkrMtt|d��|_ng|_|tj|<q�WdS(NtCOLLECTIONS_PATHStANSIBLE_COLLECTIONS_PATHStterrorstsurrogate_or_strictcs`s(|]}|djd�r|VqdS(iRN(tget(t.0tp((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>3siis&<ansible_synthetic_collection_package>R
R(tget_config_valuet_n_configured_pathstostenvironRtsplittpathsept
isinstanceR	tNoneRtpatht
expandusert_n_playbook_pathst_default_collectionRt_SYNTHETIC_PACKAGESRt__package__t__file__tAnsibleFlatMapLoaderRt
__loader__t__path__tsystmodules(tselftconfigRtsyn_pkg_deftpkg_nametpkg_deftnewmodtpkg_type((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt__init__"s*$7		

			cC`s|j|jS(N(R'R(R1((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytn_collection_pathsDscC`sItj|�s-tdjt|����ntdj|��}|jS(Ns"{0} is not a valid collection namesansible_collections.{0}(tAnsibleCollectionReftis_valid_collection_namet
ValueErrortformatRRR+(R1tcollection_nametm((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytget_collection_pathHscC`stt|t�r|g}nt�}g|D]<}||kpI|j|�s+tjjt|�d�^q+|_dS(Ntcollections(	R#R	tsettaddRR%tjoinRR'(R1tb_playbook_pathstadded_pathsR((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytset_playbook_pathsPs	cC`s
||_dS(N(R((R1R>((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytset_default_collection]scC`s|jS(N(R((R1((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytdefault_collection`scC`s$|j||dt�dr |SdS(Ntloadi(t_find_moduletFalseR$(R1tfullnameR%((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytfind_moduledscC`s>|j|ddt�d}|s:tdj|���n|S(NRJismodule {0} not found(RKR$tTruetImportErrorR=(R1RMtmod((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytload_modulejscB`sm|jd�r&|dkr&edfSejj|�rY|sHedfSeej|fSd}dj|jd�d �}ejj|�}|r�|r�e	dj
|���n|jd�dk}ej|�}d}	|s)ej|�}
|
r)|
jd�r)|
}d|j
d�d	}	q)n|rJ|jd
�}|sSed��n|dkr�|jd�}|s�ed
��n|s�edfSe||	�}
|
ej|<e|
fS|dkr�e��qJ|dkrJ|s�edfSe|�}||_d|_||_g|_|jd�sG|ej|<e|fSqJn|s{g|jD]}|j||�^qZ}n(g|jD]}|j||�^q�}x�|D]�}d}e}d}ejje|��r�ejj|d�}n�x�ejj|d�|dgD]�}ejje|��s6qn|sFedfSee|�d��}|j�}WdQXed|d|ddddde�}|}|j d�}PqW|s�q�ne|�}||_||_|r|r�|g|_n	||_||_n	||_|ej|<|r;||j!fdUne|fSW|rc|ej|<e|fSedfS(Nsansible_collections.Rt.i����sparent package {0} not foundiRRiR
s<invalid synthetic package type (no package "type" specified)RsBinvalid synthetic map package definition (no target "map" defined)RRs&<ansible_synthetic_collection_package>Rt
__synthetic__s__init__.pys.pytrbtsourcetfilenametmodetexectflagsitdont_inherit("t
startswithRLR$R/R0RRORDR!RPR=tcountR)t
rpartitiontKeyErrorRtNotImplementedErrorRR*R+R-R.R9t_extend_path_with_nsRR%tisdirRtisfiletopentreadtcompiletendswitht__dict__(R1RMR%RJR6tparent_pkg_namet
parent_pkgtsub_collectiont
synpkg_deftsynpkg_remaindertparent_synpkg_defR7tmap_packageRQRt
package_pathstcandidate_child_pathtcode_objectt
is_packagetlocationtsource_pathtfdRV((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyRKrs�






				
+(

'				


cC`s)|jdd�d}tjj||�S(NRSii����(trsplitRR%RD(R%tnstns_path_add((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyRascC`s&t|d��}|j�SWdQXdS(NRU(RRe(R1RWRv((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytget_data
sN(t__name__t
__module__R$R8tpropertyR9R@RGRHRIRNRRRKtstaticmethodRaRz(((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR!s"		
			�R,cB`s8eZddgZd�Zd�Zd�Zd�ZRS(s.pycs.pyocC`s||_d|_dS(N(t
_root_packageR$t_dirtree(R1troot_package((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR8s	c`s�tjj�jj�}g}x@tj|�D]/\�}}|j��fd�|D��q.W|jdd��|�_dS(Nc3`s:|]0�t�fd��jD��s��fVqdS(c3`s|]}�j|�VqdS(N(Rg(Rtext(tf(sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>sN(tanyt_extension_blacklist(R(trootR1(R�sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>stkeycS`s|djd�S(Nis/windows(Rg(R((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt<lambda>(s(	RR%tdirnameRR+twalktextendtsortR�(R1t	root_patht
flat_filestdirstfiles((R�R1sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt
_init_dirtrees$	c`s�|js|j�nd�kr�tjdjtj�����y#t�fd�|jD��}Wq�tk
r�tdj����q�XnLy#t�fd�|jD��}Wn&tk
r�tdj����nX|S(NRSs^{0}(\..+)?$c3`s9|]/\}}�j|�rtjj||�VqdS(N(tmatchRR%RD(RtrR�(textensionless_re(sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>5sscouldn't find {0}c3`s6|],\}}|�krtjj||�VqdS(N(RR%RD(RR�R�(RW(sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>;s(	R�R�treRfR=tescapetnextt
StopIterationtIOError(R1RWtfilepath((R�RWsC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt	find_file+s	
!#
#
cC`s5|j|�}t|d��}|j�SWdQXdS(NRU(R�RdRe(R1RWt
found_fileRv((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyRzAs(R{R|R�R8R�R�Rz(((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR,s
			R:cB`s�eZed�ddddddddd	d
ddd
dddddddgD��Zejed��Zejed��Zejed��Z	d�Z
ed��Zed��Z
ed��Zedd��Zed��ZRS(cc`s|]}t|�VqdS(N(R(RR�((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pys	<genexpr>Pstactiontbecometcachetcallbacktcliconft
connectiont
doc_fragmentstfilterthttpapit	inventorytlookuptmodule_utilsR0tnetconftroletshelltstrategytterminalttesttvarss^(\w+)\.(\w+)$s
^\w+(\.\w+)*$s^\w+\.\w+\.\w+(\.\w+)*$cC`s�t|dd�}|dk	r3t|dd�}nt|dd�}t|dd�}|j|�s�tdjt|����n||jkr�tdj|���n||_|r�tj	|j
|�s�tdjt|����n||_n	d|_||_||_
d|jg}|j
dkrB|jd	�n|d
|j
g7}|jrq|j|j�n|j
dkr�|j|j�ntdj|��|_dS(
s�
        Create an AnsibleCollectionRef from components
        :param collection_name: a collection name of the form 'namespace.collectionname'
        :param subdirs: optional subdir segments to be appended below the plugin type (eg, 'subdir1.subdir2')
        :param resource: the name of the resource being references (eg, 'mymodule', 'someaction', 'a_role')
        :param ref_type: the type of the reference, eg 'module', 'role', 'doc_fragment'
        RtstrictsGinvalid collection name (must be of the form namespace.collection): {0}s invalid collection ref_type: {0}sNinvalid subdirs entry: {0} (must be empty/None or of the form subdir1.subdir2)uuansible_collectionsuroleurolesupluginsRSN(RR$R;R<R=RtVALID_REF_TYPESt
collectionR�R�tVALID_SUBDIRS_REtsubdirstresourcetref_typetappendRDtn_python_package_name(R1R>R�R�R�tpackage_components((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR8Zs4					cC`s�tj|�s-tdjt|����nt|dd�}t|dd�}|jdd�}|d}|d}|jdd�}t|�dkr�|d}nd	}dj	|dd!�}t||||�S(
s�
        Parse a string as a fully-qualified collection reference, raises ValueError if invalid
        :param ref: collection reference to parse (a valid ref is of the form 'ns.coll.resource' or 'ns.coll.subdir1.subdir2.resource')
        :param ref_type: the type of the reference, eg 'module', 'role', 'doc_fragment'
        :return: a populated AnsibleCollectionRef object
        s'{0} is not a valid collection referenceRR�u.iiiiu(
R:t
is_valid_fqcrR<R=RRRwR!tlenRD(trefR�tresource_splitnametpackage_remnantR�tpackage_splitnameR�R>((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt	from_fqcr�s


cC`s,ytj||�SWntk
r'nXdS(s�
        Attempt to parse a string as a fully-qualified collection reference, returning None on failure (instead of raising an error)
        :param ref: collection reference to parse (a valid ref is of the form 'ns.coll.resource' or 'ns.coll.subdir1.subdir2.resource')
        :param ref_type: the type of the reference, eg 'module', 'role', 'doc_fragment'
        :return: a populated AnsibleCollectionRef object on successful parsing, else None
        N(R:R�R<(R�R�((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyttry_parse_fqcr�s
cC`sdt|�}|jdd�}|dkr3d}n|tjkr`tdjt|����n|S(s
        Utility method to convert from a PluginLoader dir name to a plugin ref_type
        :param legacy_plugin_dir_name: PluginLoader dir name (eg, 'action_plugins', 'library')
        :return: the corresponding plugin ref_type (eg, 'action', 'role')
        u_pluginsuulibraryumoduless3{0} cannot be mapped to a valid collection ref type(RtreplaceR:R�R<R=R(tlegacy_plugin_dir_nametplugin_type((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt legacy_plugin_dir_to_plugin_type�s	cC`sAt|�}|s+ttjtj|��Sttj||��S(s�
        Validates if is string is a well-formed fully-qualified collection reference (does not look up the collection itself)
        :param ref: candidate collection reference to validate (a valid ref is of the form 'ns.coll.resource' or 'ns.coll.subdir1.subdir2.resource')
        :param ref_type: optional reference type to enable deeper validation, eg 'module', 'role', 'doc_fragment'
        :return: True if the collection ref passed is well-formed, False otherwise
        (RtboolR�R�R:t
VALID_FQCR_RER�(R�R�((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR��s	cC`s%t|�}ttjtj|��S(s?
        Validates if the given string is a well-formed collection name (does not look up the collection itself)
        :param collection_name: candidate collection name to validate (a valid name is of the form 'ns.collname')
        :return: True if the collection name passed is well-formed, False otherwise
        (RR�R�R�R:tVALID_COLLECTION_NAME_RE(R>((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR;�sN(R{R|t	frozensetR�R�RfRR�R�R�R8R~R�R�R�R$R�R;(((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyR:Ns	0$
c

C`stj|d�}|rB|j}|jg}|j}|j}n|sLdS|}d}x�|D]�}y�td|d|d|dd�}t|j�}|dk	r�tj	j
ttj
|jjdd��}|t|dd�|fSWq_tk
r�q_q_tk
r}	q_q_Xq_WdS(	NR�RR>R�R�R�RR(R:R�R�R�R�R$RR�RR%R�RR/R0R+RR�t	Exception(
t	role_nametcollection_listtacrR�R�R�R>tpkgR%tex((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytget_collection_role_path�s,		
!+
s$/ansible_collections/([^/]+)/([^/]+)cC`sigt�jD]$}ttjjt|���^q
}tjjt|��}t|�}x|D]�}ttjj|t|�g��}||krb|t|�}|r�|ddkr�d|}nt	j
|�}|s�qbndj|j��}	t�j
|	�}
|
sdStjjtjjt|
���}tjj||g�|kr]|	SdSqbWdS(s~
    Return the containing collection name for a given path, or None if the path is not below a configured collection, or
    the collection cannot be loaded (eg, the collection is masked by another of the same name higher in the configured
    collection roots).
    :param n_path: native-string path to evaluate for collection containment
    :return: collection name or None
    it/s{0}.{1}N(RR9RRR%trealpathRtcommonprefixR�t_N_COLLECTION_PATH_REtsearchR=tgroupsR@R$R�(R%RR9tb_pathtn_patht	coll_patht
common_prefixtcollection_remnanttfound_collectiontn_collection_nametloaded_collection_pathtb_loaded_collection_path((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytget_collection_name_from_paths(7
$
$cC`st�j|�dS(N(RRG(RE((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pytset_collection_playbook_paths=s(('t
__future__RRRR
t
__metaclass__Rtos.pathR�R/ttypesRtansible.module_utils._textRRRt%ansible.module_utils.compat.importlibRtansible.module_utils.sixRR	R
tansible.utils.pathRtansible.utils.singletonRtdictROR)tobjectRR,R:R$R�RfR�R�R�(((sC/usr/lib/python2.7/site-packages/ansible/utils/collection_loader.pyt<module>s2�?�%	*

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]