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/path.pyc

�
�Udac@`s=ddlmZmZmZeZddlZddlZddlm	Z	m
Z
ddlmZddl
mZmZmZdddd	d
gZejje�s�edje���nejjej��Zedd�Zdd
�Zd�Zed�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%dS(i(tabsolute_importtdivisiontprint_functionN(tEEXISTtENOENT(tAnsibleError(tto_bytest	to_nativetto_texttunfrackpatht
makedirs_safet	cs_existstcs_isdirt	cs_isfilesDunable to determine filesystem case-sensitivity ({0} does not exist)cC`s�t|dddd�}|dkr?ttj�dd�}n'tjj|�rftjj|�}ntjjtjjt|dd���}tjj	|�s�tjj
||�}n|r�tjj|�}nttjj
|�dd�S(s�
    Returns a path that is free of symlinks (if follow=True), environment variables, relative path traversals and symbols (~)

    :arg path: A byte or text string representing a path to be canonicalized
    :arg follow: A boolean to indicate of symlinks should be resolved or not
    :raises UnicodeDecodeError: If the canonicalized version of the path
        contains non-utf8 byte sequences.
    :rtype: A text string (unicode on pyyhon2, str on python3).
    :returns: An absolute path with symlinks, environment variables, and tilde
        expanded.  Note that this does not check whether a path exists.

    example::
        '$HOME/../../var/mail' becomes '/var/spool/mail'
    terrorstsurrogate_or_strictt	nonstringtpassthruN(RtNonetostgetcwdtpathtisfiletdirnamet
expandusert
expandvarstisabstjointrealpathRtnormpath(Rtfollowtbasedirt	b_basedirtb_final_path((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyR	$s*cC`s�t|�}t|�}tjj|�s�y*|rFtj||�n
tj|�Wq�tk
r�}|jtkr�t	dt
|�t
|�f��q�q�XndS(s�
    A *potentially insecure* way to ensure the existence of a directory chain. The "safe" in this function's name
    refers only to its ability to ignore `EEXIST` in the case of multiple callers operating on the same part of
    the directory chain. This function is not safe to use under world-writable locations when the first level of the
    path to be created contains a predictable component. Always create a randomly-named element first if there is any
    chance the parent directory might be world-writable (eg, /tmp) to prevent symlink hijacking and potential
    disclosure or modification of sensitive file contents.

    :arg path: A byte or text string representing a directory chain to be created
    :kwarg mode: If given, the mode to set the directory to
    :raises AnsibleError: If the directory cannot be created and does not already exist.
    :raises UnicodeDecodeError: if the path is not decodable in the utf-8 encoding.
    s*Unable to create local directories(%s): %sN(R	RRRtexiststmakedirstOSErrorterrnoRRR(Rtmodetrpathtb_rpathte((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyR
FscC`s�t|dd�}d}tjj|�r3|}nB|dkrNtj�}n'tjj|�rutjj|�}n|r�tjj|�}nt	|dd�S(s- returns directory for inventory or playbook RRtt.N(NR*R+(
RRRRtisdirRRRtabspathR(tsourcetdname((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyRbs	cC`s�y�tjj|�r�yHtjj|�r:tj|�n"tjj|�r\tj|�nWq�tk
r�}|r�ddl	m
}|�}|jdjt
|���q�q�XnWntk
r�nXdS(s
    Removes temporary file or directory. Optionally display a warning if unable
    to remove the file or directory.

    :arg path: Path to file or directory to be removed
    :kwarg warn: Whether or not to display a warning when the file or directory
        cannot be removed
    i(tDisplayu#Unable to remove temporary file {0}N(RRR"R,tshutiltrmtreeRtunlinkt	Exceptiontansible.utils.displayR0tdisplaytformatR(RtwarnR)R0R6((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pytcleanup_tmp_filets		*
cC`s�t}t|dt�}t|dt�}|jtjj�}|jtjj�}y|t|� |k}Wntk
r�nX|S(s�
    Compares paths to check if one is contained in the other
    :arg: child: Path to test
    :arg parent; Path to test against
     R(tFalseR	tsplitRRtseptlent
IndexError(tchildtparentttestt	abs_childt
abs_parenttctp((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyt
is_subpath�s
c`sQtjj|�\}��s"tSt�fd�tj|�D��oPt|�S(s?
    Standalone case-sensitive existence check for case-insensitive filesystems. This assumes the parent
    dir exists and is otherwise accessible by the caller.
    :param path: a bytes or text path string to check for existence
    :return: True if the path exists and the paths pass a case-sensitive comparison
    c3`s!|]}|�kr|VqdS(N((t.0RE(tleaf(s6/usr/lib/python2.7/site-packages/ansible/utils/path.pys	<genexpr>�s(RRR;tTruetanytlistdirR(RR@((RHs6/usr/lib/python2.7/site-packages/ansible/utils/path.pyt_explicit_case_sensitive_exists�scO`s�t|||�}yYtrjt|�rjy
t}Wntk
rKt}nX|ttjt�|��nWnt	k
r�|j
��nX|S(s+
    A replacement for open that behaves case-sensitively on case-insensitive filesystems (passes through all args to underlying platform open)
    :param file: a bytes or text path string to open
    :return: a file descriptor if the file exists and the path passes a case-sensitive comparison
    (topent_is_case_insensitive_fsRLtFileNotFoundErrort	NameErrortIOErrorRRtstrerrorR4tclose(tfiletargstkwargstfdtextype((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pytcs_open�s


"

cC`s.tjj|�}ts |r$|St|�S(s�
    A replacement for os.path.exists that behaves case-sensitive on case-insensitive filesystems
    :param path: a bytes or text path string to check for existence
    :return: True if the path exists and the paths pass a case-sensitive comparison
    (RRR"RNRL(Rt
raw_exists((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyR�scC`s#tjj|�o"tp"t|�S(s
    A replacement for os.path.isdir that behaves case-sensitive on case-insensitive filesystems
    :param path: a bytes or text path string to check if isdir
    :return: True if the path is a dir (or resolves to one) and the paths pass a case-sensitive comparison
    (RRR,RNRL(R((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyR�scC`s#tjj|�o"tp"t|�S(s
    A replacement for os.path.isfile that behaves case-sensitive on case-insensitive filesystems
    :param path: a bytes or text path string to check if isfile
    :return: True if the path is a file (or resolves to one) and the paths pass a case-sensitive comparison
    (RRRRNRL(R((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyR
�s(&t
__future__RRRttypet
__metaclass__RR1R%RRtansible.errorsRtansible.module_utils._textRRRt__all__RR"t__file__R4R7tupperRNRIRR	R
RR:R9RFRLRYRRR
(((s6/usr/lib/python2.7/site-packages/ansible/utils/path.pyt<module>s("							

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