|
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 � @ sN d Z ddlZg ZzddlZW n ek
r4 dZY nX ejZG dd� d�ZdS )z=
ftputil.file - support for file-like objects on FTP servers
� Nc @ sd e Zd ZdZdZdd� Zddd�dd�Zd d
� Zdd� Zd
d� Z dd� Z
dd� Zdd� Zdd� Z
dS )�FTPFilez�
Represents a file-like object associated with an FTP host. File and socket
are closed appropriately if the `close` method is called.
� c C s$ || _ |j| _d| _d| _d| _dS )z!Construct the file(-like) object.TN)Z_host�_session�closed�_conn�_fobj)�self�host� r
�9/opt/cppython/lib/python3.8/site-packages/ftputil/file.py�__init__! s
zFTPFile.__init__N)�restc
C s
|dkrt d��d|kr$tj�d��|dkr>tj�d�|���d|krVd|krVtd ��d|k}d
|k} |s~|dk r~tj�d��d}
d
�|
�}tjj� | j� |� W 5 Q R X | r�dnd}d�||�}tjj� | j�
||�| _W 5 Q R X | jj|||||d�| _
d| _dS )z�
Open the remote file with given path name and mode.
Contrary to the `open` builtin, this method returns `None`, instead
this file object is modified in-place.
Nz'open() argument 2 must be str, not None�azappend mode not supported)�r�rb�rt�w�wbZwtzinvalid mode '{}'�b�tz'can't have text and binary mode at oncer z,`rest` argument can't be used for text files�IzTYPE {}ZRETRZSTORz{} {})� buffering�encoding�errors�newlineF)� TypeError�ftputil�error�
FTPIOError�format�
ValueErrorZCommandNotImplementedError�ftplib_error_to_ftp_io_errorr �voidcmdZtransfercmdr �makefiler r )
r �path�moder r r r r
Zis_binary_modeZis_read_modeZ
transfer_type�commandZcommand_typer
r
r �_open+ s<