Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/paramiko/__pycache__/buffered_pipe.cpython-39.pyc
Ðазад
a s�h9 � @ sJ d Z ddlZddlZddlZddlmZ G dd� de�ZG dd� d�ZdS )z� Attempt to generalize the "feeder" part of a `.Channel`: an object which can be read from and closed, but is reading from a buffer fed by another thread. The read operations are blocking and can have a timeout set. � N)�bc @ s e Zd ZdZdS )�PipeTimeoutzP Indicates that a timeout was reached on a read from a `.BufferedPipe`. N)�__name__� __module__�__qualname__�__doc__� r r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/paramiko/buffered_pipe.pyr s r c @ sd e Zd ZdZdd� Zdd� Zddd�Zd d � Zdd� Zd d� Z ddd�Z dd� Zdd� Zdd� Z dS )�BufferedPipez� A buffer that obeys normal read (with timeout) & close semantics for a file or socket, but is fed data from another thread. This is used by `.Channel`. c C s4 t �� | _t �| j�| _d | _t�d�| _d| _d S )N�BF) � threading�Lock�_lock� Condition�_cv�_event�array�_buffer�_closed��selfr r r �__init__. s zBufferedPipe.__init__c C s | j �|� d S �N)r � frombytes�r �datar r r �_buffer_frombytes5 s zBufferedPipe._buffer_frombytesNc C s | j d |� �� S r )r �tobytes)r �limitr r r �_buffer_tobytes8 s zBufferedPipe._buffer_tobytesc C sV | j �� z:|| _| js&t| j�dkr0|�� n|�� W | j �� n| j �� 0 dS )a Set an event on this buffer. When data is ready to be read (or the buffer has been closed), the event will be set. When no data is ready, the event will be cleared. :param threading.Event event: the event to set/clear r N) r �acquirer r �lenr �set�clear�release)r �eventr r r � set_event; s zBufferedPipe.set_eventc C sV | j �� z:| jdur | j�� | �t|�� | j�� W | j �� n| j �� 0 dS )z� Feed new data into this pipe. This method is assumed to be called from a separate thread, so synchronization is done. :param data: the data to add, as a ``str`` or ``bytes`` N) r r r r"