%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/filepath.cpython-312.pyc

�

Ϫ�f����&�dZddlmZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZm
Z
mZmZmZmZmZmZddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddl4m5Z5m6Z6m7Z7dd	l#m8Z8dd
l9m:Z:m;Z;ddl<m=Z=ddl>m?Z?dd
l@mAZAmBZBmCZCmDZDmEZEej�ej�zej�zeEzZIe0dd��ZJej�ZLej�ZNGd�de6�ZOGd�deP�ZQGd�deP�ZRGd�deS�ZTd'd�ZUe0deVeW�ZXe8dZYGd�de*e'�ZZGd�de?�Z[Gd �d!e?�Z\d(d)d"�Z]d*d+d#�Z^	d*							d,d$�Z_e;e7eO�Gd%�d&eZe'���Z`y)-z1
Object-oriented filesystem path representation.
�)�annotationsN)�listdir�stat�utime)	�abspath�basename�dirname�exists�isabs�islink�join�normpath�splitext)�S_IMODE�S_IRGRP�S_IROTH�S_IRUSR�S_ISBLK�S_ISDIR�S_ISREG�S_ISSOCK�S_IWGRP�S_IWOTH�S_IWUSR�S_IXGRP�S_IXOTH�S_IXUSR)�IO�
TYPE_CHECKING�Any�AnyStr�Callable�Dict�Generic�Iterable�List�Optional�Sequence�Tuple�TypeVar�Union�cast�overload)�	Attribute�	Interface�implementer)�Literal)�cmp�
comparable)�platform)�FancyEqMixin)�ERROR_DIRECTORY�ERROR_FILE_NOT_FOUND�ERROR_INVALID_NAME�ERROR_PATH_NOT_FOUND�O_BINARY�_SelfzAbstractFilePath[Any]��boundc��eZdZdZed�Zdd�Zddd�Zdd�Zdd�Z	dd�Z
dd�Zdd	�Zdd
�Z
dd�Zdd�Zdd
�Zdd�Zdd�Zdd�Zy)�	IFilePatha�
    File path object.

    A file path represents a location for a file-like-object and can be
    organized into a hierarchy; a file path can can children which are
    themselves file paths.

    A file path has a name which unique identifies it in the context of its
    parent (if it has one); a file path can not have two children with the same
    name.  This name is referred to as the file path's "base name".

    A series of such names can be used to locate nested children of a file
    path; such a series is referred to as the child's "path", relative to the
    parent.  In this case, each name in the path is referred to as a "path
    segment"; the child's base name is the segment in the path.

    When representing a file path as a string, a "path separator" is used to
    delimit the path segments within the string.  For a file system path, that
    would be C{os.sep}.

    Note that the values of child names may be restricted.  For example, a file
    system path will not allow the use of the path separator in a name, and
    certain names (e.g. C{"."} and C{".."}) may be reserved or have special
    meanings.

    @since: 12.1
    z3The path separator to use in string representationsc��y)a�
        Obtain a direct child of this file path.  The child may or may not
        exist.

        @param name: the name of a child of this path. C{name} must be a direct
            child of this path and may not contain a path separator.
        @return: the child of this path with the given C{name}.
        @raise InsecurePath: if C{name} describes a file path that is not a
            direct child of this file path.
        N���names �9/usr/lib/python3/dist-packages/twisted/python/filepath.py�childzIFilePath.childy���c��y)z�
        Opens this file path with the given mode.

        @return: a file-like object.
        @raise Exception: if this file path cannot be opened.
        NrA)�modes rD�openzIFilePath.open�rFrGc��y)zT
        Clear any cached information about the state of this path on disk.
        NrArArGrD�changedzIFilePath.changed�rFrGc��y)z�
        Retrieve the size of this file in bytes.

        @return: the size of the file at this file path in bytes.
        @raise Exception: if the size cannot be obtained.
        NrArArGrD�getsizezIFilePath.getsize�rFrGc��y)��
        Retrieve the time of last access from this file.

        @return: a number of seconds from the epoch.
        @rtype: L{float}
        NrArArGrD�getModificationTimezIFilePath.getModificationTime�rFrGc��y)��
        Retrieve the time of the last status change for this file.

        @return: a number of seconds from the epoch.
        @rtype: L{float}
        NrArArGrD�getStatusChangeTimezIFilePath.getStatusChangeTime�rFrGc��y)��
        Retrieve the time that this file was last accessed.

        @return: a number of seconds from the epoch.
        @rtype: L{float}
        NrArArGrD�
getAccessTimezIFilePath.getAccessTime�rFrGc��y)z�
        Check if this file path exists.

        @return: C{True} if the file at this file path exists, C{False}
            otherwise.
        @rtype: L{bool}
        NrArArGrDr
zIFilePath.exists�rFrGc��y)z�
        Check if this file path refers to a directory.

        @return: C{True} if the file at this file path is a directory, C{False}
            otherwise.
        NrArArGrD�isdirzIFilePath.isdir�rFrGc��y)z�
        Check if this file path refers to a regular file.

        @return: C{True} if the file at this file path is a regular file,
            C{False} otherwise.
        NrArArGrD�isfilezIFilePath.isfile�rFrGc��y)z�
        List the children of this path object.

        @return: a sequence of the children of the directory at this file path.
        @raise Exception: if the file at this file path is not a directory.
        NrArArGrD�childrenzIFilePath.children�rFrGc��y)a�
        Retrieve the final component of the file path's path (everything after
        the final path separator).

        @note: In implementors, the return type should be generic, i.e.
            C{AbstractFilePath[str].basename()} is a C{str}.  However,
            L{Interface} objects cannot be generic as of this writing.

        @return: the base name of this file path.
        NrArArGrDrzIFilePath.basename�rFrGc��y)zV
        A file path for the directory containing the file at this file path.
        NrArArGrD�parentzIFilePath.parent�rFrGc��y)a$
        A file path for the directory containing the file at this file path.

        @param name: the name of a sibling of this path.  C{name} must be a
            direct sibling of this path and may not contain a path separator.

        @return: a sibling file path of this one.
        NrArBs rD�siblingzIFilePath.sibling�rFrGN)rCr!�returnr?��r�rI�FileModerd�	IO[bytes]�rd�None�rd�int�rd�float�rd�bool)rdzIterable[IFilePath])rd�Union[str, bytes])rdr?)�__name__�
__module__�__qualname__�__doc__r.�seprErJrLrNrQrTrWr
rZr\r^rrarcrArGrDr?r?ZsZ���8�I�
J�C�
���
��������
��
rGr?c��eZdZdZy)�InsecurePathzP
    Error that is raised when the path provided to L{FilePath} is invalid.
    N�rsrtrurvrArGrDryry�s��rGryc��eZdZdZy)�	LinkErrorz�
    An error with symlinks - either that there are cyclical symlinks or that
    symlink are not supported on this platform.
    NrzrArGrDr|r|�s��rGr|c��eZdZdZdd�Zy)�UnlistableErrorai
    An exception which is used to distinguish between errors which mean 'this
    is not a directory you can list' and other, more catastrophic errors.

    This error will try to look as much like the original error as possible,
    while still being catchable as an independent type.

    @ivar originalException: the actual original exception instance.
    c�\�|jj|j�||_y)zq
        Create an UnlistableError exception.

        @param originalException: an instance of OSError.
        N)�__dict__�update�originalException)�selfr�s  rD�__init__zUnlistableError.__init__s%��	
�
�
���.�7�7�8�!2��rGN)r��OSError)rsrtrurvr�rArGrDr~r~�s���3rGr~c�H�ttd��dd}t||�S)a
    Compute a string usable as a new, temporary filename.

    @param path: The path that the new temporary filename should be able to be
        concatenated with.

    @return: A pseudorandom, 16 byte string for use in secure filenames.
    @rtype: the type of C{path}
    �N)�armor�randomBytes�_coerceToFilesystemEncoding)�path�secureishStrings  rD�_secureEnoughStringr�s&���K��O�,�S�b�1�O�&�t�_�=�=rG�OtherAnyStr)rf�w�azr+zw+za+c���eZdZUdZedd��Zded<dd�Zdd�Zdd	�Z	ddd
�Z
dd�Zd d�Zd!d
�Z
d"d�Zd#d�Zd$d�Zd%d�Zd&d�Z	d'					d(d�Zd)d�Z				d*d�Zd+d�Zd,d�Zd,d�Zd,d�Zd,d�Zy)-�AbstractFilePathaa
    Abstract implementation of an L{IFilePath}; must be completed by a
    subclass.

    This class primarily exists to provide common implementations of certain
    methods in L{IFilePath}. It is *not* a required parent class for
    L{IFilePath} implementations, just a useful starting point.

    @ivar path: Subclasses must set this variable.
    �Selfish�AbstractFilePath[AnyStr]r<r!r�c��t��)zZ
        Subclasses must implement this.

        @see: L{FilePath.getAccessTime}
        ��NotImplementedError�r�s rDrWzAbstractFilePath.getAccessTime3�
��"�#�#rGc��t��)z`
        Subclasses must implement this.

        @see: L{FilePath.getModificationTime}
        r�r�s rDrQz$AbstractFilePath.getModificationTime;r�rGc��t��)z`
        Subclasses must implement this.

        @see: L{FilePath.getStatusChangeTime}
        r�r�s rDrTz$AbstractFilePath.getStatusChangeTimeCr�rGc��t���z1
        Subclasses must implement this.
        r��r�rIs  rDrJzAbstractFilePath.openK�
��"�#�#rGc��t��r�r�r�s rDrZzAbstractFilePath.isdirQr�rGc��t��r�r�r�s rDrzAbstractFilePath.basenameWr�rGc��t��r�r�r�s rDrazAbstractFilePath.parent]r�rGc��t��r�r�r�s rDrzAbstractFilePath.listdircr�rGc��t��r�r��r�r�s  rDrEzAbstractFilePath.childir�rGc�n�|j�5}|j�cddd�S#1swYyxYw)z�
        Retrieve the contents of the file at this path.

        @return: the contents of the file
        @rtype: L{bytes}
        N)rJ�read)r��fps  rD�
getContentzAbstractFilePath.getContentos-���Y�Y�[�	�B��7�7�9�	�	�	�s�+�4c#�tK�|}|j�}||k7r|��|}|j�}||k7r�yy�w)z�
        Retrieve an iterator of all the ancestors of this path.

        @return: an iterator of all the ancestors of this path, from the most
        recent (its immediate parent) to the root of its filesystem.
        N)ra)r�r�ras   rD�parentszAbstractFilePath.parentsys=������������f�n��L��D��]�]�_�F��f�n�s�38�8c�l�	|j�}g}|D]$}|j|�}|j|��&|S#t$rk}t|dd�ttt
tfvrt|��|jtjtjfvrt|���d}~wwxYw)a�
        List the children of this path object.

        @raise OSError: If an error occurs while listing the directory.  If the
        error is 'serious', meaning that the operation failed due to an access
        violation, exhaustion of some kind of resource (file descriptors or
        memory), OSError or a platform-specific variant will be raised.

        @raise UnlistableError: If the inability to list the directory is due
        to this path not existing or not being a directory, the more specific
        OSError subclass L{UnlistableError} is raised instead.

        @return: an iterable of all currently-existing children of this object.
        �winerrorN)
rr��getattrr9r7r8r6r~�errno�ENOENT�ENOTDIRrE�append)r��subnames�ose�resultrCrEs      rDr^zAbstractFilePath.children�s���	�%)�\�\�^�H�2���	!�D� �:�:�d�+�E��M�M�%� �	!��
��?�	��s�J��-�$�$�"��	2��&�c�*�*��y�y�U�\�\�5�=�=�9�9�%�c�*�*�
��/	�s�?�	B3�A&B.�.B3Nc#�K�|��|j�r�|j�D]�}|�||�r�|j|�D]p}tjj|j�j
tjj|j��rtd��|���r��|����yy�w)a�
        Yield myself, then each of my children, and each of those children's
        children in turn.

        The optional argument C{descend} is a predicate that takes a FilePath,
        and determines whether or not that FilePath is traversed/descended
        into.  It will be called with each path for which C{isdir} returns
        C{True}.  If C{descend} is not specified, all directories will be
        traversed (including symbolic links which refer to directories).

        @param descend: A one-argument callable that will return True for
            FilePaths that should be traversed, False otherwise.

        @return: a generator yielding FilePath-like objects.
        NzCycle in file graph.)rZr^�walk�osr��realpath�
startswithr|)r��descend�c�subcs    rDr�zAbstractFilePath.walk�s�����&�
��:�:�<��]�]�_�
���?�g�a�j� !���w��#���7�7�+�+�D�I�I�6�A�A��G�G�,�,�T�Y�Y�7��#,�,B�"C�C�"�
�#��G�
��s�B?Cc�@�|j�j|�S)a�
        Return a L{FilePath} with the same directory as this instance but with
        a basename of C{path}.

        @note: for type-checking, subclasses should override this signature to
            make it clear that it returns the subclass and not
            L{AbstractFilePath}.

        @param path: The basename of the L{FilePath} to return.
        @type path: L{str}

        @return: The sibling path.
        @rtype: L{FilePath}
        )rarEr�s  rDrczAbstractFilePath.sibling�s���{�{�}�"�"�4�(�(rGc�:�|}|D]}|j|�}�|S)a�
        Retrieve a child or child's child of this path.

        @note: for type-checking, subclasses should override this signature to
            make it clear that it returns the subclass and not
            L{AbstractFilePath}.

        @param segments: A sequence of path segments as L{str} instances.

        @return: A L{FilePath} constructed by looking up the C{segments[0]}
            child of this path, the C{segments[1]} child of that path, and so
            on.

        @since: 10.2
        )rE)r��segmentsr�rCs    rD�
descendantzAbstractFilePath.descendant�s+��$/3���	$�D��:�:�d�#�D�	$��rGc���|}|j�}g}||k7r6||k7r1|j�g|dd|}|j�}||k7r||k7r�1||k(r|r|St|�d|����)a
        Return a list of segments between a child and its ancestor.

        For example, in the case of a path X representing /a/b/c/d and a path Y
        representing /a/b, C{Y.segmentsFrom(X)} will return C{['c',
        'd']}.

        @param ancestor: an instance of the same class as self, ostensibly an
        ancestor of self.

        @raise ValueError: If the C{ancestor} parameter is not actually an
        ancestor, i.e. a path for /x/y/z is passed as an ancestor for /a/b/c/d.

        @return: a list of strs
        rz not parent of )rar�
ValueError)r��ancestor�f�pr�s     rD�segmentsFromzAbstractFilePath.segmentsFroms~��&
���8�8�:��!#���8�m��Q���Z�Z�\�N�H�Q�q�M��A����
�A��8�m��Q��
��=�X��O��H�<��t�h�?�@�@rGc�D�t|j|jf�S)zZ
        Hash the same as another L{AbstractFilePath} with the same path as mine.
        )�hash�	__class__r�r�s rD�__hash__zAbstractFilePath.__hash__#s���T�^�^�T�Y�Y�/�0�0rGc�4�t|j��S)z?
        Deprecated.  Use getModificationTime instead.
        )rmrQr�s rD�getmtimezAbstractFilePath.getmtime*����4�+�+�-�.�.rGc�4�t|j��S)z9
        Deprecated.  Use getAccessTime instead.
        )rmrWr�s rD�getatimezAbstractFilePath.getatime0s���4�%�%�'�(�(rGc�4�t|j��S)z?
        Deprecated.  Use getStatusChangeTime instead.
        )rmrTr�s rD�getctimezAbstractFilePath.getctime6r�rGrnrergrp�rdr!)rdr��rd�List[AnyStr])r�r�rd�AbstractFilePath[OtherAnyStr])rd�bytes)rdz"Iterable[AbstractFilePath[AnyStr]])r�r;rd�Iterable[_Self]�N)r�r;r�z!Optional[Callable[[_Self], bool]]rdr�)r�r;r�r�rdr�)r��Sequence[OtherAnyStr]rdr�)r�r;r�r;rdr�rl)rsrtrurvr*r��__annotations__rWrQrTrJrZrrarrEr�r�r^r�rcr�r�r�r�r�r�rArGrDr�r�#s���	��i�'A�B�G�
�L�$�$�$�$�$�$�$�$�$��
%�0�h6:� �� �2� �
� �D)�"�-��	&��.A�>1�/�)�/rGr�c�,�eZdZdZdZdd�Zdd�Zdd�Zy)	�RWXa�
    A class representing read/write/execute permissions for a single user
    category (i.e. user/owner, group, or other/world).  Instantiate with
    three boolean values: readable? writable? executable?.

    @type read: C{bool}
    @ivar read: Whether permission to read is given

    @type write: C{bool}
    @ivar write: Whether permission to write is given

    @type execute: C{bool}
    @ivar execute: Whether permission to execute is given

    @since: 11.1
    �r��write�executec�.�||_||_||_yr�r�)r��readable�writable�
executables    rDr�zRWX.__init__Qs����	���
�!��rGc�d�dj|j|j|j�S)Nz"RWX(read={}, write={}, execute={}))�formatr�r�r�r�s rD�__repr__zRWX.__repr__Vs*��3�:�:��I�I��J�J��L�L�
�	
rGc��gd�}d}|j|j|jfD]}|sd||<|dz
}�dj|�S)z�
        Returns a short string representing the permission bits.  Looks like
        part of what is printed by command line utilities such as 'ls -l'
        (e.g. 'rwx')

        @return: The shorthand string.
        @rtype: L{str}
        )rfr��xr�-��)r�r�r�r
)r��	returnval�i�vals    rD�	shorthandz
RWX.shorthand]sV��$�	�
���I�I�t�z�z�4�<�<�8�	�C��"�	�!��
��F�A�	��w�w�y�!�!rGN)r�rqr�rqr�rqrdrk�rd�str�rsrtrurv�compareAttributesr�r�r�rArGrDr�r�=s���"5��"�

�"rGr�c�,�eZdZdZdZdd�Zdd�Zdd�Zy)	�Permissionsae
    A class representing read/write/execute permissions.  Instantiate with any
    portion of the file's mode that includes the permission bits.

    @type user: L{RWX}
    @ivar user: User/Owner permissions

    @type group: L{RWX}
    @ivar group: Group permissions

    @type other: L{RWX}
    @ivar other: Other/World permissions

    @since: 11.1
    )�user�group�otherc����fd�tttgttt
gtttgfD�\|_	|_
|_y)Nc3�@�K�|]}t�fd�|D�����y�w)c3�.�K�|]}�|zdkD���y�w)rNrA)�.0�bit�statModeInts  �rD�	<genexpr>z1Permissions.__init__.<locals>.<genexpr>.<genexpr>�s�����<�C�+��#�a�'�<�s�N)r�)r��bitGroupr�s  �rDrz'Permissions.__init__.<locals>.<genexpr>�s$�����-
��
�<�8�<�=�-
�s�)rrrrrrrrrr�r�r�)r�r�s `rDr�zPermissions.__init__�sA���-
��'�7�+��'�7�+��'�7�+��-
�)��	�4�:�t�zrGc��dt|j��dt|j��dt|j��d�S)N�[z | �])r�r�r�r�r�s rDr�zPermissions.__repr__�s8���3�t�y�y�>�"�#�c�$�*�*�o�%6�c�#�d�j�j�/�9J�!�L�LrGc��dj|j|j|jfD�cgc]}|j	���c}�Scc}w)z�
        Returns a short string representing the permission bits.  Looks like
        what is printed by command line utilities such as 'ls -l'
        (e.g. 'rwx-wx--x')

        @return: The shorthand string.
        @rtype: L{str}
        r�)r
r�r�r�r�)r�r�s  rDr�zPermissions.shorthand�s:���w�w��	�	�4�:�:�t�z�z�/R�S�!����
�S�T�T��Ss�AN)r�rmrdrkr�r�rArGrDr�r�os ��� 3��
�M�	UrGr�c�x�t|t�r|S|stj�}|j	|d��S)aR
    Return C{path} as a string of L{bytes} suitable for use on this system's
    filesystem.

    @param path: The path to be made suitable.
    @type path: L{bytes} or L{unicode}
    @param encoding: The encoding to use if coercing to L{bytes}. If none is
        given, L{sys.getfilesystemencoding} is used.

    @return: L{bytes}
    �surrogateescape��errors)�
isinstancer��sys�getfilesystemencoding�encode�r��encodings  rD�_asFilesystemBytesr�s8���$�������0�0�2�H��{�{�8�,=�{�>�>rGc�x�t|t�r|S|�tj�}|j	|d��S)aY
    Return C{path} as a string of L{unicode} suitable for use on this system's
    filesystem.

    @param path: The path to be made suitable.
    @type path: L{bytes} or L{unicode}

    @param encoding: The encoding to use if coercing to L{unicode}. If none
        is given, L{sys.getfilesystemencoding} is used.

    @return: L{unicode}
    rr)r
r�rr�decoders  rD�_asFilesystemTextr�s;���$��������0�0�2�H��{�{�8�,=�{�>�>rGc�V�t|t�r
t||��St||��S)a
    Return a C{newpath} that is suitable for joining to C{path}.

    @param path: The path that it should be suitable for joining to.
    @param newpath: The new portion of the path to be coerced if needed.
    @param encoding: If coerced, the encoding that will be used.
    �r)r
r�rr)r��newpathrs   rDr�r��s(���$���!�'�H�=�=� ��8�<�<rGc��eZdZUdZdZded<dHdId�Zer$dJd�ZdKd�Z	dLd�Z
dMd	�ZdMd
�ZdMd�Z
dMd�ZdMd
�ZdMd�Z	dH					dNd�ZdOd�ZedPd��ZdQdRd�ZdQdSd�ZdQdTd�ZdQdUd�ZdVd�ZdWd�ZdWd�Z				dXd�Z				dYd�ZdZd�Zd[d�Zd\d�Z d]d^d�Z!d_d`d�Z"dad �Z#dbd!�Z$dcd"�Z%ddd#�Z&ddd$�Z'ddd%�Z(dcd&�Z)dcd'�Z*dcd(�Z+dcd)�Z,dcd*�Z-ded+�Z.dfd,�Z/dfd-�Z0dfd.�Z1dfd/�Z2dfd0�Z3dfd1�Z4dfd2�Z5dgd3�Z6dhd4�Z7did5�Z8dad6�Z9dad7�Z:dHdjd8�Z;dkd9�Z<dPd:�Z=dPd;�Z>dZd<�Z?dldmd=�Z@dnd>�ZAdad?�ZBd_dod@�ZCdpdA�ZDeEdZdB��ZFeE				dqdC��ZF	dQ			dqdD�ZFdEZG	d_					drdF�ZH	d_					drdG�ZIy)s�FilePatha�
    I am a path on the filesystem that only permits 'downwards' access.

    Instantiate me with a pathname (for example,
    FilePath('/home/myuser/public_html')) and I will attempt to only provide
    access to files which reside inside that path.  I may be a path to a file,
    a directory, or a file which does not exist.

    The correct way to use me is to instantiate me, and then do ALL filesystem
    access through me.  In other words, do not import the 'os' module; if you
    need to open a file, call my 'open' method.  If you need to list a
    directory, call my 'path' method.

    Even if you pass me a relative path, I will convert that to an absolute
    path internally.

    The type of C{path} when instantiating decides the mode of the L{FilePath}.
    That is, C{FilePath(b"/")} will return a L{bytes} mode L{FilePath}, and
    C{FilePath(u"/")} will return a L{unicode} mode L{FilePath}.
    C{FilePath("/")} will return a L{bytes} mode L{FilePath} on Python 2, and a
    L{unicode} mode L{FilePath} on Python 3.

    Methods that return a new L{FilePath} use the type of the given subpath to
    decide its mode. For example, C{FilePath(b"/").child(u"tmp")} will return a
    L{unicode} mode L{FilePath}.

    @type alwaysCreate: L{bool}
    @ivar alwaysCreate: When opening this file, only succeed if the file does
        not already exist.

    @ivar path: The path from which 'downward' traversal is permitted.
    Nr!r�c�2�t|�|_||_y)z�
        Convert a path string to an absolute path if necessary and initialize
        the L{FilePath} with the result.
        N)rr��alwaysCreate�r�r�rs   rDr�zFilePath.__init__�s��
�D�M��	�(��rGc��yr�rAr�s  rDrczFilePath.sibling���rGc��yr�rA)r�r�s  rDr�zFilePath.descendantrrGc��yr�rAr�s rDr�zFilePath.parentsrrGc��yr�rA�r�r�s  rD�__gt__zFilePath.__gt__rrGc��yr�rAr!s  rD�__ge__zFilePath.__ge__rrGc��yr�rAr!s  rD�__lt__zFilePath.__lt__rrGc��yr�rAr!s  rD�__le__zFilePath.__le__rrGc��yr�rAr!s  rD�__eq__zFilePath.__eq__rrGc��yr�rAr!s  rD�__ne__zFilePath.__ne__rrGc��t|�S)ze
        Make an object of the same type as this FilePath, but with path of
        C{path}.
        )rrs   rD�	clonePathzFilePath.clonePath!s����~�rGc�H�|jj�}d|vr|d=|S)zv
        Support serialization by discarding cached L{os.stat} results and
        returning everything else.
        �	_statinfo)r��copy)r��ds  rD�__getstate__zFilePath.__getstate__*s*��

�M�M��� ���!���+���rGc�J�t|jtj�S)z�
        Return a filesystem separator.

        @return: The native filesystem separator.
        @returntype: The same type as C{self.path}.
        )r�r�r�rwr�s rDrwzFilePath.sep4s��+�4�9�9�b�f�f�=�=rGc�0�t|j|��S)z�
        Return the path of this L{FilePath} as bytes.

        @param encoding: The encoding to use if coercing to L{bytes}. If none is
            given, L{sys.getfilesystemencoding} is used.

        @return: L{bytes}
        r)rr��r�rs  rD�_asBytesPathzFilePath._asBytesPath>s��"�$�)�)�h�?�?rGc�0�t|j|��S)z�
        Return the path of this L{FilePath} as text.

        @param encoding: The encoding to use if coercing to L{unicode}. If none
            is given, L{sys.getfilesystemencoding} is used.

        @return: L{unicode}
        r)rr�r6s  rD�_asTextPathzFilePath._asTextPathIs��!����X�>�>rGc�|�t|jt�r!|j|j	|���S|S)z�
        Return this L{FilePath} in L{bytes}-mode.

        @param encoding: The encoding to use if coercing to L{bytes}. If none is
            given, L{sys.getfilesystemencoding} is used.

        @return: L{bytes} mode L{FilePath}
        r)r
r�r�r.r7r6s  rD�asBytesModezFilePath.asBytesModeTs4���d�i�i��%��>�>�$�"3�"3�X�"3�"F�G�G��rGc�|�t|jt�r!|j|j	|���S|S)z�
        Return this L{FilePath} in L{unicode}-mode.

        @param encoding: The encoding to use if coercing to L{unicode}. If none
            is given, L{sys.getfilesystemencoding} is used.

        @return: L{unicode} mode L{FilePath}
        r)r
r�r�r.r9r6s  rD�
asTextModezFilePath.asTextModeas4���d�i�i��'��>�>�$�"2�"2�H�"2�"E�F�F��rGc�b�t|t�r|j�S|j�S)a
        If C{pattern} is C{bytes}, return L{FilePath.path} as L{bytes}.
        Otherwise, return L{FilePath.path} as L{unicode}.

        @param pattern: The new element of the path that L{FilePath.path} may
            need to be coerced to match.
        )r
r�r7r9)r��patterns  rD�_getPathAsSameTypeAszFilePath._getPathAsSameTypeAsns,���g�u�%��$�$�&�&��#�#�%�%rGc��t|d�}t|tj�}|j|�}t	j
�r|j
|�rt|�d���t|�}||vrt|�d���tt||��}|j|�st|�d|����|j|�S)a0
        Create and return a new L{FilePath} representing a path contained by
        C{self}.

        @param path: The base name of the new L{FilePath}.  If this contains
            directory separators or parent references it will be rejected.
        @type path: L{bytes} or L{unicode}

        @raise InsecurePath: If the result of combining this path with C{path}
            would result in a path which is not a direct child of this path.

        @return: The child path.
        @rtype: L{FilePath} with a mode equal to the type of C{path}.
        �:z contains a colon.z* contains one or more directory separators� is not a child of )
r�r�rwr@r4�	isWindows�countryrr�joinpathr�r.)r�r��colonrw�ourPath�normrs       rDrEzFilePath.child{s���,�D�#�6��)�$����7���+�+�D�1������D�J�J�u�$5��$��);�<�=�=���~���$�;��$��)S�T�U�U��(�7�D�1�2���!�!�'�*��'��,?��{�K�L�L��~�~�g�&�&rGc���|j|�}tt|t|���}|j	|�st|�d|����|j
|�S)a�
        Use me if C{path} might have slashes in it, but you know they're safe.

        @param path: A relative path (ie, a path not starting with C{"/"})
            which will be interpreted as a child or descendant of this path.
        @type path: L{bytes} or L{unicode}

        @return: The child path.
        @rtype: L{FilePath} with a mode equal to the type of C{path}.
        rC)r@rrFrr�ryr.)r�r�rHrs    rD�preauthChildzFilePath.preauthChild�s]���+�+�D�1���(�7�H�T�N�;�<���!�!�'�*��'��,?��{�K�L�L��~�~�g�&�&rGc��|D]=}|j|�}t||�}t|�s�,|j|�cSy)a�
        Return my first existing child with a name in C{paths}.

        C{paths} is expected to be a list of *pre-secured* path fragments;
        in most cases this will be specified by a system administrator and not
        an arbitrary user.

        If no appropriately-named children exist, this will return L{None}.

        @return: L{None} or the child path.
        @rtype: L{None} or L{FilePath}
        N)r@rFr
r.)r��pathsrEr��jps     rD�childSearchPreauthzFilePath.childSearchPreauth�sJ���	*�E��)�)�%�0�A��!�U�#�B��b�z��~�~�b�)�)�		*�
rGc	���|D]�}|s2|j�r"|j|j|��cS|j|�}t|d�}t|d�}||k(r`t	|�|z}tt
|��D];}|j|�s�|jtt
|�|��ccS||z}t|�s��|j|�cSy)a�
        Attempt to return a path with my name, given multiple possible
        extensions.

        Each extension in C{exts} will be tested and the first path which
        exists will be returned.  If no path exists, L{None} will be returned.
        If C{''} is in C{exts}, then if the file referred to by this path
        exists, C{self} will be returned.

        The extension '*' has a magic meaning, which means "any path that
        begins with C{self.path + '.'} is acceptable".
        �*�.N)	r
r.r@r�rrr	r�rF)	r��exts�extr��star�dot�basedot�fn�p2s	         rD�siblingExtensionSearchzFilePath.siblingExtensionSearch�s����	*�C��4�;�;�=��~�~�d�&?�&?��&D�E�E��)�)�#�.�A�.�s�C�8�D�-�c�3�7�C��d�{�"�1�+��+��!�'�!�*�-�H�B��}�}�W�-�#�~�~�h�w�q�z�2�.F�G�G�H��S��B��b�z��~�~�b�)�)�	*� rGc���|j�rTtjj|j�}||jk(rt	d��|j|�S|S)a�
        Returns the absolute target as a L{FilePath} if self is a link, self
        otherwise.

        The absolute link is the ultimate file or directory the
        link refers to (for instance, if the link refers to another link, and
        another...).  If the filesystem does not support symlinks, or
        if the link is cyclical, raises a L{LinkError}.

        Behaves like L{os.path.realpath} in that it does not resolve link
        names in the middle (ex. /x/y/z, y is a link to w - realpath on z
        will return /x/y/z, not /x/w/z).

        @return: L{FilePath} of the target path.
        @rtype: L{FilePath}
        @raises LinkError: if links are not supported or links are cyclical.
        z!Cyclical link - will loop forever)rr�r�r�r|r.)r�r�s  rDr�zFilePath.realpath�sQ��$�;�;�=��W�W�%�%�d�i�i�0�F�����"�� C�D�D��>�>�&�)�)��rGc�L�|j|�}|j||z�S)a
        Attempt to return a path with my name, given the extension at C{ext}.

        @param ext: File-extension to search for.
        @type ext: L{bytes} or L{unicode}

        @return: The sibling path.
        @rtype: L{FilePath} with the same mode as the type of C{ext}.
        )r@r.)r�rTrHs   rD�siblingExtensionzFilePath.siblingExtension�s'���+�+�C�0���~�~�g��m�,�,rGc�X�tj|j|j�y)a�
        Creates a symlink to self to at the path in the L{FilePath}
        C{linkFilePath}.

        Only works on posix systems due to its dependence on
        L{os.symlink}.  Propagates L{OSError}s up from L{os.symlink} if
        C{linkFilePath.parent()} does not exist, or C{linkFilePath} already
        exists.

        @param linkFilePath: a FilePath representing the link to be created.
        @type linkFilePath: L{FilePath}
        N)r��symlinkr�)r��linkFilePaths  rD�linkTozFilePath.linkTo
s��	�
�
�4�9�9�l�/�/�0rGc��|jrd|vsJd��|j�St|j|j	dd�dz�S)a�
        Open this file using C{mode} or for writing if C{alwaysCreate} is
        C{True}.

        In all cases the file is opened in binary mode, so it is not necessary
        to include C{"b"} in C{mode}.

        @param mode: The mode to open the file in.  Default is C{"r"}.
        @raises AssertionError: If C{"a"} is included in the mode and
            C{alwaysCreate} is C{True}.
        @return: An open file-like object.
        r�z1Appending not supported when alwaysCreate == True�br�)r�createrJr��replacer�s  rDrJz
FilePath.opensR������d�?�
�F�
�?��;�;�=� ��D�I�I�t�|�|�C��4�s�:�;�;rGc�l�	t|j�|_y#t$r
d|_|r�YywxYw)a�
        Re-calculate cached effects of 'stat'.  To refresh information on this
        path after you know the filesystem may have changed, call this method.

        @param reraise: a boolean.  If true, re-raise exceptions from
            L{os.stat}; otherwise, mark this path as not existing, and remove
            any cached stat information.

        @raise Exception: If C{reraise} is C{True} and an exception occurs
            while reloading metadata.
        N)rr�r0r�)r��reraises  rD�restatzFilePath.restat0s7��	�!�$�)�)�_�D�N���	�!�D�N����	�s��3�3c��d|_y)zl
        Clear any cached information about the state of this path on disk.

        @since: 10.1.0
        N)r0r�s rDrLzFilePath.changedCs����rGc�D�tj|j|�y)z�
        Changes the permissions on self, if possible.  Propagates errors from
        L{os.chmod} up.

        @param mode: integer representing the new permissions desired (same as
            the command line chmod)
        @type mode: L{int}
        N)r��chmodr�r�s  rDrkzFilePath.chmodKs��	������D�!rGc�v�|j}|s|j�|j}|�J�|jS)z�
        Retrieve the size of this file in bytes.

        @return: The size of the file at this file path in bytes.
        @raise Exception: if the size cannot be obtained.
        @rtype: L{int}
        )r0rh�st_size�r��sts  rDrNzFilePath.getsizeVs6���^�^����K�K�M����B��~��~��z�z�rGc��|j}|s|j�|j}|�J�t|j�S)rP)r0rhro�st_mtimerns  rDrQzFilePath.getModificationTimee�;���^�^����K�K�M����B��~��~��R�[�[�!�!rGc��|j}|s|j�|j}|�J�t|j�S)rS)r0rhro�st_ctimerns  rDrTzFilePath.getStatusChangeTimesrrrGc��|j}|s|j�|j}|�J�t|j�S)rV)r0rhro�st_atimerns  rDrWzFilePath.getAccessTime�rrrGc��tj�rt�|j}|s|j	�|j}|�J�|j
S)a�
        Retrieve the file serial number, also called inode number, which
        distinguishes this file from all other files on the same device.

        @raise NotImplementedError: if the platform is Windows, since the
            inode number would be a dummy value for all files in Windows
        @return: a number representing the file serial number
        @rtype: L{int}
        @since: 11.0
        )r4rDr�r0rh�st_inorns  rD�getInodeNumberzFilePath.getInodeNumber�sH������%�%�
�^�^����K�K�M����B��~��~��y�y�rGc��tj�rt�|j}|s|j	�|j}|�J�|j
S)a�
        Retrieves the device containing the file.  The inode number and device
        number together uniquely identify the file, but the device number is
        not necessarily consistent across reboots or system crashes.

        @raise NotImplementedError: if the platform is Windows, since the
            device number would be 0 for all partitions on a Windows platform

        @return: a number representing the device
        @rtype: L{int}

        @since: 11.0
        )r4rDr�r0rh�st_devrns  rD�	getDevicezFilePath.getDevice�sH������%�%�
�^�^����K�K�M����B��~��~��y�y�rGc��tj�rt�|j}|s|j	�|j}|�J�|j
S)a�
        Retrieves the number of hard links to the file.

        This count keeps track of how many directories have entries for this
        file. If the count is ever decremented to zero then the file itself is
        discarded as soon as no process still holds it open.  Symbolic links
        are not counted in the total.

        @raise NotImplementedError: if the platform is Windows, since Windows
            doesn't maintain a link count for directories, and L{os.stat} does
            not set C{st_nlink} on Windows anyway.
        @return: the number of hard links to the file
        @rtype: L{int}
        @since: 11.0
        )r4rDr�r0rh�st_nlinkrns  rD�getNumberOfHardLinkszFilePath.getNumberOfHardLinks�sH�� ����%�%�
�^�^����K�K�M����B��~��~��{�{�rGc��tj�rt�|j}|s|j	�|j}|�J�|j
S)a	
        Returns the user ID of the file's owner.

        @raise NotImplementedError: if the platform is Windows, since the UID
            is always 0 on Windows
        @return: the user ID of the file's owner
        @rtype: L{int}
        @since: 11.0
        )r4rDr�r0rh�st_uidrns  rD�	getUserIDzFilePath.getUserID��H������%�%�
�^�^����K�K�M����B��~��~��y�y�rGc��tj�rt�|j}|s|j	�|j}|�J�|j
S)z�
        Returns the group ID of the file.

        @raise NotImplementedError: if the platform is Windows, since the GID
            is always 0 on windows
        @return: the group ID of the file
        @rtype: L{int}
        @since: 11.0
        )r4rDr�r0rh�st_gidrns  rD�
getGroupIDzFilePath.getGroupID�r�rGc��|j}|s|j�|j}|�J�tt|j��S)a
        Returns the permissions of the file.  Should also work on Windows,
        however, those permissions may not be what is expected in Windows.

        @return: the permissions for the file
        @rtype: L{Permissions}
        @since: 11.1
        )r0rhr�r�st_moderns  rD�getPermissionszFilePath.getPermissions�s@���^�^����K�K�M����B��~��~��7�2�:�:�.�/�/rGc�Z�|jry|jd�|jryy)z�
        Check if this L{FilePath} exists.

        @return: C{True} if the stats of C{path} can be retrieved successfully,
            C{False} in the other cases.
        @rtype: L{bool}
        TF)r0rhr�s rDr
zFilePath.existss'���>�>���K�K����~�~��rGc��|j}|s |jd�|j}|syt|j�S)z�
        Check if this L{FilePath} refers to a directory.

        @return: C{True} if this L{FilePath} refers to a directory, C{False}
            otherwise.
        @rtype: L{bool}
        F)r0rhrr�rns  rDrZzFilePath.isdir�:���^�^����K�K������B����r�z�z�"�"rGc��|j}|s |jd�|j}|syt|j�S)z�
        Check if this file path refers to a regular file.

        @return: C{True} if this L{FilePath} points to a regular file (not a
            directory, socket, named pipe, etc), C{False} otherwise.
        @rtype: L{bool}
        F)r0rhrr�rns  rDr\zFilePath.isfile/r�rGc��|j}|s |jd�|j}|syt|j�S)z�
        Returns whether the underlying path is a block device.

        @return: C{True} if it is a block device, C{False} otherwise
        @rtype: L{bool}
        @since: 11.1
        F)r0rhrr�rns  rD�
isBlockDevicezFilePath.isBlockDevice?r�rGc��|j}|s |jd�|j}|syt|j�S)z�
        Returns whether the underlying path is a socket.

        @return: C{True} if it is a socket, C{False} otherwise
        @rtype: L{bool}
        @since: 11.1
        F)r0rhrr�rns  rD�isSocketzFilePath.isSocketOs:���^�^����K�K������B�����
�
�#�#rGc�,�t|j�S)z�
        Check if this L{FilePath} points to a symbolic link.

        @return: C{True} if this L{FilePath} points to a symbolic link,
            C{False} otherwise.
        @rtype: L{bool}
        )rr�r�s rDrzFilePath.islink_s���d�i�i� � rGc�,�t|j�S)z�
        Check if this L{FilePath} refers to an absolute path.

        This always returns C{True}.

        @return: C{True}, always.
        @rtype: L{bool}
        )rr�r�s rDrzFilePath.isabsms���T�Y�Y��rGc�,�t|j�S)a�
        List the base names of the direct children of this L{FilePath}.

        @return: A L{list} of L{bytes}/L{unicode} giving the names of the
            contents of the directory this L{FilePath} refers to. These names
            are relative to this L{FilePath}.
        @rtype: L{list}

        @raise OSError: Any exception the platform L{os.listdir} implementation
            may raise.
        )rr�r�s rDrzFilePath.listdirxs���t�y�y�!�!rGc�,�t|j�S)a
        Split the file path into a pair C{(root, ext)} such that
        C{root + ext == path}.

        @return: Tuple where the first item is the filename and second item is
            the file extension. See Python docs for L{os.path.splitext}.
        @rtype: L{tuple}
        )rr�r�s rDrzFilePath.splitext������	�	�"�"rGc�"�d|j�d�S)Nz	FilePath(�))r�r�s rDr�zFilePath.__repr__�s���4�9�9�-�q�)�)rGc��	|jd�j�t|jd�y#t$rY�"wxYw)a$
        Updates the access and last modification times of the file at this
        file path to the current time. Also creates the file if it does not
        already exist.

        @raise Exception: if unable to create or modify the last modification
            time of the file.
        r�N)rJ�closer�rr�r�s rD�touchzFilePath.touch�s?��	��I�I�c�N� � �"�	�d�i�i�����	��	�s�8�	A�Ac�,�|j�rU|j�sE|j�D]}|j��t	j
|j�nt	j|j�|j�y)z�
        Removes the file or directory that is represented by self.  If
        C{self.path} is a directory, recursively remove all its children
        before removing the directory. If it's a file or link, just delete it.
        N)rZrr^�remover��rmdirr�rL)r�rEs  rDr�zFilePath.remove�s\���:�:�<����
�����
������
��H�H�T�Y�Y���I�I�d�i�i� ����rGc���	tj|j�y#t$r:}|jtj
k(r|r|j
�s�Yd}~yd}~wwxYw)a
        Create all directories not yet existing in C{path} segments, using
        L{os.makedirs}.

        @param ignoreExistingDirectory: Don't raise L{OSError} if directory
            already exists.
        @type ignoreExistingDirectory: L{bool}

        @return: L{None}
        N)r��makedirsr�r�r��EEXISTrZ)r��ignoreExistingDirectory�es   rDr�zFilePath.makedirs�sL��	��K�K��	�	�"���	����5�<�<�'�,C��
�
���IU��	�s�"�	A%�0A � A%c��t|tj�}|j|�}ddl}|d|k(xr||zxs|j||g�}|j	|�D�cgc]}|j
|���c}Scc}w)a�
        Assuming I am representing a directory, return a list of FilePaths
        representing my children that match the given pattern.

        @param pattern: A glob pattern to use to match child paths.
        @type pattern: L{unicode} or L{bytes}

        @return: A L{list} of matching children.
        @rtype: L{list} of L{FilePath}, with the mode of C{pattern}'s type
        rN���)r�r�rwr@�globr
r.)r�r?rwrHr�r�r�s       rD�globChildrenzFilePath.globChildren�sw��*�'�2�6�6�:���+�+�G�4����r�{�c�!�7�g��&7�W�3�8�8�W�g�DV�;W��+/�9�9�T�?�;�a����q�!�;�;��;s�'Bc�,�t|j�S)a:
        Retrieve the final component of the file path's path (everything
        after the final path separator).

        @return: The final component of the L{FilePath}'s path (Everything
            after the final path separator).
        @rtype: the same type as this L{FilePath}'s C{path} attribute
        )rr�r�s rDrzFilePath.basename�r�rGc�,�t|j�S)ah
        Retrieve all of the components of the L{FilePath}'s path except the
        last one (everything up to the final path separator).

        @return: All of the components of the L{FilePath}'s path except the
            last one (everything up to the final path separator).
        @rtype: the same type as this L{FilePath}'s C{path} attribute
        )r	r�r�s rDr	zFilePath.dirname�s���t�y�y�!�!rGc�@�|j|j��S)z�
        A file path for the directory containing the file at this file path.

        @return: A L{FilePath} representing the path which directly contains
            this L{FilePath}.
        @rtype: L{FilePath}
        )r.r	r�s rDrazFilePath.parent�s���~�~�d�l�l�n�-�-rGc��|j|�}|jd�5}|j|�ddd�tj�r4t|j�rtj|j�tj|j|j�j�y#1swY��xYw)a�
        Replace the file at this path with a new file that contains the given
        bytes, trying to avoid data-loss in the meanwhile.

        On UNIX-like platforms, this method does its best to ensure that by the
        time this method returns, either the old contents I{or} the new
        contents of the file will be present at this path for subsequent
        readers regardless of premature device removal, program crash, or power
        loss, making the following assumptions:

            - your filesystem is journaled (i.e. your filesystem will not
              I{itself} lose data due to power loss)

            - your filesystem's C{rename()} is atomic

            - your filesystem will not discard new data while preserving new
              metadata (see U{http://mjg59.livejournal.com/108257.html} for
              more detail)

        On most versions of Windows there is no atomic C{rename()} (see
        U{http://bit.ly/win32-overwrite} for more information), so this method
        is slightly less helpful.  There is a small window where the file at
        this path may be deleted before the new file is moved to replace it:
        however, the new file will be fully written and flushed beforehand so
        in the unlikely event that there is a crash at that point, it should be
        possible for the user to manually recover the new version of their
        data.  In the future, Twisted will support atomic file moves on those
        versions of Windows which I{do} support them: see U{Twisted ticket
        3004<http://twistedmatrix.com/trac/ticket/3004>}.

        This method should be safe for use by multiple concurrent processes,
        but note that it is not easy to predict which process's contents will
        ultimately end up on disk if they invoke this method at close to the
        same time.

        @param content: The desired contents of the file at this path.
        @type content: L{bytes}

        @param ext: An extension to append to the temporary filename used to
            store the bytes while they are being written.  This can be used to
            make sure that temporary files can be identified by their suffix,
            for cleanup in case of crashes.
        @type ext: L{bytes}
        r�N)�temporarySiblingrJr�r4rDr
r�r��unlink�renamer;)r��contentrT�sibr�s     rD�
setContentzFilePath.setContent�s���Z�#�#�C�(��
�X�X�c�]�	�a�
�G�G�G��	�����F�4�9�9�$5��I�I�d�i�i� �
�	�	�#�(�(�D�,�,�.�3�3�4�		�	�s�B>�>Cc�n�t|t�stSt|j|j�Sr�)r
r�NotImplementedr2r�r!s  rD�__cmp__zFilePath.__cmp__+s'���%��*�!�!��4�9�9�e�j�j�)�)rGc�B�tj|j�y)z�
        Create the directory the L{FilePath} refers to.

        @see: L{makedirs}

        @raise OSError: If the directory cannot be created.
        N)r��mkdirr�r�s rD�createDirectoryzFilePath.createDirectory0s��	������rGc��||_y)z�
        Sets the C{alwaysCreate} variable.

        @param val: C{True} or C{False}, indicating whether opening this path
            will be required to create the file or not.
        @type val: L{bool}

        @return: L{None}
        N)r)r�r�s  rD�
requireCreatezFilePath.requireCreate:s�� ��rGc��tj|jt�}t	t
ttj|d��S)z�
        Exclusively create a file, only if this file previously did not exist.

        @return: A file-like object opened from this path.
        zw+b)r�rJr��
_CREATE_FLAGSr,rr��fdopen)r��fdints  rDrdzFilePath.createFs6������	�	�=�1���B�u�I�r�y�y���6�7�7rGc��yr�rAr�s rDr�zFilePath.temporarySiblingTs��rGc��yr�rA)r��	extensions  rDr�zFilePath.temporarySiblingXs��	rGc���|�|jdd}n|}|j|�}|jt|�|j	|�j�z|z�}|j
�|S)a�
        Construct a path referring to a sibling of this path.

        The resulting path will be unpredictable, so that other subprocesses
        should neither accidentally attempt to refer to the same path before it
        is created, nor they should other processes be able to guess its name
        in advance.

        @param extension: A suffix to append to the created filename.  (Note
            that if you want an extension with a '.' you must include the '.'
            yourself.)
        @type extension: L{bytes} or L{unicode}

        @return: a path object with the given extension suffix, C{alwaysCreate}
            set to True.
        @rtype: L{FilePath} with a mode equal to the type of C{extension}
        r)r�r@rcr�r.rr�)r�r�rTrHr�s     rDr�zFilePath.temporarySibling^sv��*���)�)�A�a�.�C��C��+�+�C�0���l�l���(�4�>�>�'�+B�+K�+K�+M�M�PS�S�
��	�����
rGic�B�|j�r@|s>tjtj|j�|j�y|j�rg|j
�s|j�|j�D]3}|j|j��}|j||��5y|j�r||jd�5}|j�5}	|j|j�}|j!|�t#|�|jkrn�F	ddd�ddd�y|j
�st%t&j(d��t+d��#1swY�GxYw#1swYyxYw)a�
        Copies self to destination.

        If self doesn't exist, an OSError is raised.

        If self is a directory, this method copies its children (but not
        itself) recursively to destination - if destination does not exist as a
        directory, this method creates it.  If destination is a file, an
        IOError will be raised.

        If self is a file, this method copies it to destination.  If
        destination is a file, this method overwrites it.  If destination is a
        directory, an IOError will be raised.

        If self is a link (and followLinks is False), self will be copied
        over as a new symlink with the same target as returned by os.readlink.
        That means that if it is absolute, both the old and new symlink will
        link to the same thing.  If it's relative, then perhaps not (and
        it's also possible that this relative link will be broken).

        File/directory permissions and ownership will NOT be copied over.

        If followLinks is True, symlinks are followed so that they're treated
        as their targets.  In other words, if self is a link, the link's target
        will be copied.  If destination is a link, self will be copied to the
        destination's target (the actual destination will be destination's
        target).  Symlinks under self (if self is a directory) will be
        followed and its target's children be copied recursively.

        If followLinks is False, symlinks will be copied over as symlinks.

        @param destination: the destination (a FilePath) to which self
            should be copied
        @param followLinks: whether symlinks in self should be treated as links
            or as their targets
        Nr�zNo such file or directoryz/Only copying of files and directories supported)rr�r_�readlinkr�rZr
r�r^rEr�copyTor\rJr��
_chunkSizer��lenr�r�r�r�)r��destination�followLinksrE�	destChild�	writefile�readfile�chunks        rDr�zFilePath.copyTo�sP��N�;�;�=���J�J�r�{�{�4�9�9�-�{�/?�/?�@��
�:�:�<��%�%�'��+�+�-�����
5��'�-�-�e�n�n�.>�?�	����Y��4�
5��[�[�]��!�!�#�&�

�)�T�Y�Y�[�

�H��%�M�M�$�/�/�:�E��O�O�E�*��5�z�D�O�O�3����

�

�

������%�,�,�(C�D�D�&�&W�X�X�%

�

��

�

�s%�)F�:AF	�F�	F	�F�Fc���	tj|j|j�|j�|j	�|j	�y#t
$r�}|jtjk(rg|j�}|j||�|j||�|j�}|j||�|j�n�Yd}~yd}~wwxYw)a�
        Move self to destination - basically renaming self to whatever
        destination is named.

        If destination is an already-existing directory,
        moves all children to destination if destination is empty.  If
        destination is a non-empty directory, or destination is a file, an
        OSError will be raised.

        If moving between filesystems, self needs to be copied, and everything
        that applies to copyTo applies to moveTo.

        @param destination: the destination (a FilePath) to which self
            should be copied
        @param followLinks: whether symlinks in self should be treated as links
            or as their targets (only applicable when moving between
            filesystems)
        N)r�r�r@r�rLr�r��EXDEVr�r��moveTor�)r�r�r�r��secsib�mysecsibs      rDr�zFilePath.moveTo�s���*	"��I�I�d�/�/��0@�0@�A�;�CS�CS�T�,
�L�L�N����!��-�	��y�y�E�K�K�'�%�5�5�7�����F�K�0��
�
�k�;�7� �0�0�2�����H�k�2����!��"��#	�s�9A�	C4�%BC/�/C4)F)r�r!rrqrdrk)r�r;r�r�rd�FilePath[OtherAnyStr])r�r�rdr�)rdzIterable[FilePath[AnyStr]])r��objectrdrq)r�r�rrqrdr�)rdzDict[str, object]r�r�)r�
Optional[str]rdr�)rr�rdr�)rr�rdzFilePath[bytes])rr�rdz
FilePath[str])r?r�rdr�)r�r�rdr�)rMr�rd�Optional[FilePath[OtherAnyStr]])rSr�rdr�)rd�FilePath[AnyStr])rTr�rdr�)r`r�rdrkrerg)T)rgrqrdrkrj)rIrmrdrkrlrn)rdr�rpr�)rdzTuple[AnyStr, AnyStr]r�)r�rqrdrk)r?r�rdzList[FilePath[OtherAnyStr]])z.new)r�r�rTrrrdrk)r�r�rdrm)r�rqrdrk)rdri)r�zOptional[OtherAnyStr]rdr�)r�r�r�rqrdrk)Jrsrtrurvr0r�r�rrcr�r�r"r$r&r(r*r,r.r3�propertyrwr7r9r;r=r@rErKrOrZr�r]rarJrhrLrkrNrQrTrWryr|rr�r�r�r
rZr\r�r�rrrrr�r�r�r�r�rr	rar�r�r�r�rdr-r�r�r�r�rArGrDrr�sE���B�I�
�L�)��	�	�	�	�	�	�	�	�	�7<����/3��	����>��>�	@�	?���&�'�@'�$�!��	(��,� ��	(��B�2-�
1�<�.�&�	"�
�"�"�"��*�0�4�(�(0� �"#� #� #� $� !�	 �"�	#�*�
���&<�&	#�	"�.�25�h*�
�
 �8�������.��	����26� �.� �	� �D�J�GK�GY�0�GY�?C�GY�	
�GY�TGK�-"�0�-"�?C�-"�	
�-"rGr)r�r!rdr!)r�)r��Union[bytes, str]rr�rdr�r�)r�r�rr�rdr�)r�r!rr�rr�rdr!)arv�
__future__r�base64r�r�rrrr�os.pathrrr	r
rrr
rFrrrrrrrrrrrrrrrr�typingrrr r!r"r#r$r%r&r'r(r)r*r+r,r-�zope.interfacer.r/r0r1�twisted.python.compatr2r3�twisted.python.runtimer4�twisted.python.utilr5�twisted.python.win32r6r7r8r9r:�O_EXCL�O_CREAT�O_RDWRr�r;�urandomr��urlsafe_b64encoder�r?�	Exceptionryr|r�r~r�r�r�r�rhr�r�r�rrr�rrArGrD�<module>r�s���
�#�
��	�
�#�#�
�
�
����� �����&=�<��1�+�,����	�	�B�J�J�&����2�X�=�
���6�7���j�j��� � ��R�	�R�j�9���	��3�g�3�*>��m�S�%�0���2�3��W/�w�v��W/�t/"�,�/"�d)U�,�)U�X?�(?�,IM�
=�
�
=�,�
=�8E�
=��
=� ��Y��b"���'�b"���b"rG

Zerion Mini Shell 1.0