|
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__/ |
U
O��g� � @ sB d Z ddlZddlZddlZddlZddlZg ZG dd� d�ZdS )z3
ftputil.path - simulate `os.path` for FTP servers
� Nc @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� 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.
c C sf || _ |j| _t}|j| _|j| _|j| _|j| _|j| _|j| _|j | _ |j
| _
|j| _|j| _d S )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__! s z_Path.__init__c C sP |}t jj|| jd�}| �|�s2| �| j�� |�}t j�t �
|�| �|�| j�S )z*
Return an absolute path.
��encoding)�ftputil�tool�as_str_pathr r r
r �getcwdZsame_string_type_as�os�fspathr )r �pathZ
original_pathr r r �abspath4 s
�z
_Path.abspathc C sF |dkrdS z| j j|dd�}|dk W S tjjk
r@ Y dS X dS )z1
Return true if the path exists.
�� � F�Z_exception_for_missing_pathNT)r �lstatr �error�RootDirError�r r Zlstat_resultr r r �existsB s
z_Path.existsc C s t j�|� | 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).
)r r �raise_for_empty_pathr �stat�st_mtime�r r r r r �getmtimeN s z_Path.getmtimec C s t j�|� | 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).
)r r r) r r* �st_sizer, r r r �getsizeX s z
_Path.getsizec C s� |dkst �|dkr d}tj}n
d}tj}tjj|| jd�}| �|�| j �
� krT|S z| j j|dd�}W n4 tjjk
r� Y dS tjj
k
r� | Y S X |dkr�dS ||j�S dS )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�filer0 TFr r# N)�AssertionErrorr* �S_ISDIR�S_ISREGr r r r r r r r% ZRecursiveLinksErrorr&