Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/ftputil/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/ftputil/__pycache__/path.cpython-38.pyc
U

O��g��@sBdZddlZddlZddlZddlZddlZgZGdd�d�ZdS)z3
ftputil.path - simulate `os.path` for FTP servers
�Nc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�_Pathz�
    Support class resembling `os.path`, accessible from the `FTPHost` object,
    e. g. as `FTPHost().path.abspath(path)`.

    Hint: substitute `os` with the `FTPHost` object.
    cCsf||_|j|_t}|j|_|j|_|j|_|j|_|j|_|j|_|j	|_	|j
|_
|j|_|j|_dS)N)
�_host�	_encoding�	posixpath�basename�commonprefix�dirname�isabs�join�normcase�normpath�split�
splitdrive�splitext)�self�host�pp�r�9/opt/cppython/lib/python3.8/site-packages/ftputil/path.py�__init__!sz_Path.__init__cCsP|}tjj||jd�}|�|�s2|�|j��|�}tj�t	�
|�|�|�|j�S)z*
        Return an absolute path.
        ��encoding)�ftputil�tool�as_str_pathrr	r
r�getcwdZsame_string_type_as�os�fspathr)r�pathZ
original_pathrrr�abspath4s
�z
_Path.abspathcCsF|dkrdSz|jj|dd�}|dk	WStjjk
r@YdSXdS)z1
        Return true if the path exists.
        ���F�Z_exception_for_missing_pathNT)r�lstatr�error�RootDirError�rrZlstat_resultrrr�existsBs
z_Path.existscCstj�|�|j�|�jS)z�
        Return the timestamp for the last modification for `path` as a float.

        This will raise `PermanentError` if the path doesn't exist, but maybe
        other exceptions depending on the state of the server (e. g. timeout).
        )rr�raise_for_empty_pathr�stat�st_mtime�rrrrr�getmtimeNsz_Path.getmtimecCstj�|�|j�|�jS)z�
        Return the size of the `path` item as an integer.

        This will raise `PermanentError` if the path doesn't exist, but maybe
        raise other exceptions depending on the state of the server (e. g.
        timeout).
        )rrr)rr*�st_sizer,rrr�getsizeXsz
_Path.getsizecCs�|dkst�|dkr d}tj}n
d}tj}tjj||jd�}|�|�|j	�
�krT|Sz|j	j|dd�}Wn4tjjk
r�YdStjj
k
r�|YSX|dkr�dS||j�SdS)a
        Return `True` if `path` represents the file system entity described by
        `dir_or_file` ("dir" or "file").

        Return `False` if `path` isn't a directory or file, respectively or if
        `path` leads to an infinite chain of links.
        )�dir�filer0TFrr#N)�AssertionErrorr*�S_ISDIR�S_ISREGrrrrrrrr%ZRecursiveLinksErrorr&�st_mode)rrZdir_or_fileZshould_look_for_dirZ
stat_function�stat_resultrrr�_is_file_system_entityms$
z_Path._is_file_system_entitycCs|dkrdS|�|d�S)z�
        Return true if the `path` exists and corresponds to a directory (no
        link).

        A non-existing path does _not_ cause a `PermanentError`, instead return
        `False`.
        r Fr0�r7r,rrr�isdir�sz_Path.isdircCs|dkrdS|�|d�S)z�
        Return true if the `path` exists and corresponds to a regular file (no
        link).

        A non-existing path does _not_ cause a `PermanentError`, instead return
        `False`.
        r Fr1r8r,rrr�isfile�sz_Path.isfilecCsjtjj||jd�}|dkrdSz|jj|dd�}Wntjjk
rLYdSX|dkrZdSt�	|j
�SdS)z�
        Return true if the `path` exists and is a link.

        A non-existing path does _not_ cause a `PermanentError`, instead return
        `False`.
        rr!Fr#N)rrrrrr$r%r&r*�S_ISLNKr5r'rrr�islink�sz_Path.islinkc	Cs�tjj|dd�tjj||jd�}z|j�|�}Wntk
rHYdSX||||�|D]X}|�||�}z|j�	|�}Wntk
r�YqZYnXt
�|t
j�rZ|�
|||�qZdS)a�
        Directory tree walk with callback function.

        For each directory in the directory tree rooted at top
        (including top itself, but excluding "." and ".."), call
        func(arg, dirname, fnames). dirname is the name of the
        directory, and fnames a list of the names of the files and
        subdirectories in dirname (excluding "." and "..").  func may
        modify the fnames list in-place (e.g. via del or slice
        assignment), and walk will only recurse into the
        subdirectories whose names remain in fnames; this can be used
        to implement a filter, or to impose a specific order of
        visiting.  No semantics are defined for, or required of, arg,
        beyond that arg is always passed to func.  It can be used,
        e.g., to pass a filename pattern, or a mutable object designed
        to accumulate statistics.  Passing None for arg is common.
        �top)Zpath_argument_namerN)rrr)rrr�listdir�OSErrorr
r$r*r3�ST_MODE�walk)rr=�func�arg�names�namer6rrrrA�s
z
_Path.walkN)�__name__�
__module__�__qualname__�__doc__rrr(r-r/r7r9r:r<rArrrrrs

#r)	rIrrr*Z
ftputil.errorrZftputil.tool�__all__rrrrr�<module>s

F1le Man4ger