File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/paramiko/__pycache__/file.cpython-310.pyc
Back
o �hwJ � @ sL d dl mZ d dlmZmZmZmZmZ d dlm Z m Z G dd� de �ZdS )� )�BytesIO)�linefeed_byte_value�crlf�cr_byte� linefeed_byte� cr_byte_value)�ClosingContextManager�uc @ s e Zd ZdZdZdZdZdZdZdZ dZ dZdZd Z d Zdd� Zd d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd@d d!�Zd@d"d#�Zd@d$d%�ZdAd&d'�Zd(d)� Zd*d+� Zd,d-� Zd.d/� Z e!d0d1� �Z"d2d3� Z#d4d5� Z$d6d7� Z%dBd:d;�Z&d<d=� Z'd>d?� Z(dS )C�BufferedFilezc Reusable base class to implement Python-style file buffering around a simpler stream. i r � � � � � �@ � c C sF d | _ d| _| j| _t� | _t� | _d| _d| _ d | _ | _d| _d S )Nr F) �newlines�_flags�_DEFAULT_BUFSIZE�_bufsizer �_wbuffer�bytes�_rbuffer�_at_trailing_cr�_closed�_pos�_realpos�_size��self� r �C/usr/local/CyberPanel/lib/python3.10/site-packages/paramiko/file.py�__init__3 s zBufferedFile.__init__c C s | � � d S �N)�closer r r r! �__del__B s zBufferedFile.__del__c C s | j rtd��| S )z� Returns an iterator that can be used to iterate over the lines in this file. This iterator happens to return the file itself, since a file is its own iterator. :raises: ``ValueError`` -- if the file is closed. zI/O operation on closed file)r � ValueErrorr r r r! �__iter__E s zBufferedFile.__iter__c C s | � � d| _dS )zN Close the file. Future read and write operations will fail. TN)�flushr r r r r! r$ Q s zBufferedFile.closec C s | � | j�� � t� | _dS )z{ Write out any data in the write buffer. This may do nothing if write buffering is not turned on. N)� _write_allr �getvaluer r r r r! r( X s zBufferedFile.flushc C s | � � }|st�|S )a� Returns the next line from the input, or raises ``StopIteration`` when EOF is hit. Unlike python file objects, it's okay to mix calls to `.next` and `.readline`. :raises: ``StopIteration`` -- when the end of the file is reached. :returns: a line (`str`, or `bytes` if the file was opened in binary mode) read from the file. )�readline� StopIteration)r �liner r r! �__next__a s zBufferedFile.__next__c C � | j | j@ | jkS )z� Check if the file can be read from. :returns: `True` if the file can be read from. If `False`, `read` will raise an exception. )r � FLAG_READr r r r! �readabler � zBufferedFile.readablec C r/ )z� Check if the file can be written to. :returns: `True` if the file can be written to. If `False`, `write` will raise an exception. )r � FLAG_WRITEr r r r! �writable| r2 zBufferedFile.writablec C � dS )z� Check if the file supports random access. :returns: `True` if the file supports random access. If `False`, `seek` will raise an exception. Fr r r r r! �seekable� s zBufferedFile.seekablec C s&