%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/abstract.cpython-312.pyc |
� Ϫ�fYK � � � d Z ddlmZmZmZ ddlmZmZmZ ddl m Z ddlmZm Z ddlmZmZ ddlmZ d� Zd � Z G d � d� Z e ej, � G d� d � � Z e ej0 ej2 ej4 ej6 ej8 � G d� dee� � Zefdedede fd�Z!dede fd�Z"g d�Z#y)z+ Support for generic select()able objects. � )�AF_INET�AF_INET6� inet_pton)�Iterable�List�Optional)�implementer)� interfaces�main)�failure�reflect)� lazyByteSlicec �: � t | t � st d� �y )NzData must be bytes)� isinstance�bytes� TypeError)�objs �;/usr/lib/python3/dist-packages/twisted/internet/abstract.py�_dataMustBeBytesr s � ��c�5�!��,�-�-� "� c �D � dj t | � |d g|z � S )Nr )�join� memoryview)�bObj�offset�bArrays r �_concatenater s% � ��8�8�Z��%�f�g�.�/�&�8�9�9r c �. � e Zd ZdZdZdZdZd� Zd� Zd� Z y)�_ConsumerMixina� L{IConsumer} implementations can mix this in to get C{registerProducer} and C{unregisterProducer} methods which take care of keeping track of a producer's state. Subclasses must provide three attributes which L{_ConsumerMixin} will read but not write: - connected: A C{bool} which is C{True} as long as the consumer has someplace to send bytes (for example, a TCP connection), and then C{False} when it no longer does. - disconnecting: A C{bool} which is C{False} until something like L{ITransport.loseConnection} is called, indicating that the send buffer should be flushed and the connection lost afterwards. Afterwards, C{True}. - disconnected: A C{bool} which is C{False} until the consumer no longer has a place to send bytes, then C{True}. Subclasses must also override the C{startWriting} method. @ivar producer: L{None} if no producer is registered, otherwise the registered producer. @ivar producerPaused: A flag indicating whether the producer is currently paused. @type producerPaused: L{bool} @ivar streamingProducer: A flag indicating whether the producer was registered as a streaming (ie push) producer or not (ie a pull producer). This will determine whether the consumer may ever need to pause and resume it, or if it can merely call C{resumeProducing} on it when buffer space is available. @ivar streamingProducer: C{bool} or C{int} NFc � � t d� �)a Override in a subclass to cause the reactor to monitor this selectable for write events. This will be called once in C{unregisterProducer} if C{loseConnection} has previously been called, so that the connection can actually close. z!%r did not implement startWriting��NotImplementedError��selfs r �startWritingz_ConsumerMixin.startWritingL s � � "�"E�F�Fr c �� � | j �t d|�d| j �d�� �| j r|j � y|| _ || _ |s|j � yy)a" Register to receive data from a producer. This sets this selectable to be a consumer for a producer. When this selectable runs out of data on a write() call, it will ask the producer to resumeProducing(). When the FileDescriptor's internal data buffer is filled, it will ask the producer to pauseProducing(). If the connection is lost, FileDescriptor calls producer's stopProducing() method. If streaming is true, the producer should provide the IPushProducer interface. Otherwise, it is assumed that producer provides the IPullProducer interface. In this case, the producer won't be asked to pauseProducing(), but it has to be careful to write() data only when its resumeProducing() method is called. NzCannot register producer z, because producer z was never unregistered.)�producer�RuntimeError�disconnected� stopProducing�streamingProducer�resumeProducing)r$ r'