0x1949 Team - FAZEMRX - MANAGER
Edit File: _buffer.cpython-310.pyc
o �b� � @ sZ d Z ddlmZ ddlmZmZ ddlmZ ddlm Z m Z dZee �G dd � d ��Zd S )z' Log observer that maintains a buffer. � )�deque)�Deque�Optional)�implementer� )�ILogObserver�LogEventi c @ sN e Zd ZdZefdee ddfdd�Zdeddfdd �Z d e ddfdd�ZdS ) �LimitedHistoryLogObservera� L{ILogObserver} that stores events in a buffer of a fixed size:: >>> from twisted.logger import LimitedHistoryLogObserver >>> history = LimitedHistoryLogObserver(5) >>> for n in range(10): history({'n': n}) ... >>> repeats = [] >>> history.replayTo(repeats.append) >>> len(repeats) 5 >>> repeats [{'n': 5}, {'n': 6}, {'n': 7}, {'n': 8}, {'n': 9}] >>> �size�returnNc C s t |d�| _dS )zx @param size: The maximum number of events to buffer. If L{None}, the buffer is unbounded. )�maxlenN)r �_buffer)�selfr � r �8/usr/lib/python3/dist-packages/twisted/logger/_buffer.py�__init__% s z"LimitedHistoryLogObserver.__init__�eventc C s | j �|� d S )N)r �append)r r r r r �__call__, s z"LimitedHistoryLogObserver.__call__� otherObserverc C s | j D ]}||� qdS )z� Re-play the buffered events to another log observer. @param otherObserver: An observer to replay events to. N)r )r r r r r r �replayTo/ s �z"LimitedHistoryLogObserver.replayTo)�__name__� __module__�__qualname__�__doc__�_DEFAULT_BUFFER_MAXIMUMr �intr r r r r r r r r r s r N) r �collectionsr �typingr r �zope.interfacer �_interfacesr r r r r r r r �<module> s