%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/protocols/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/protocols/__pycache__/policies.cpython-312.pyc |
� Ϫ�fzS � � � d Z ddlZddlmZmZ ddlmZmZ ddlm Z m Z ddlmZ ddl mZmZmZ ddlmZ d � Z G d � de� Z G d� d e� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d � d!e� Z G d"� d#� Z y)$z] Resource limiting policies. @seealso: See also L{twisted.protocols.htb} for rate limiting. � N)�Optional�Type)�directlyProvides� providedBy)�error� interfaces)�ILoggingContext)� ClientFactory�Protocol� ServerFactory)�logc � � t j |� r|j � }n|j j }|� d| j j � d�S )zY Compute a log prefix for a wrapper and the object it wraps. @rtype: C{str} z (�))r r � logPrefix� __class__�__name__)�wrapper�wrappedr s �</usr/lib/python3/dist-packages/twisted/protocols/policies.py�_wrappedLogPrefixr sQ � � �!�!�'�*��%�%�'� ��%�%�.�.� ��[��7�,�,�5�5�6�a�8�8� c � � e Zd ZdZdZdddej fd�Zd� Zd� Z d � Z d � Zd� Zd� Z d � Zd� Zd� Zd� Zd� Zd� Zd� Zy)�ProtocolWrappera� Wraps protocol instances and acts as their transport as well. @ivar wrappedProtocol: An L{IProtocol<twisted.internet.interfaces.IProtocol>} provider to which L{IProtocol<twisted.internet.interfaces.IProtocol>} method calls onto this L{ProtocolWrapper} will be proxied. @ivar factory: The L{WrappingFactory} which created this L{ProtocolWrapper}. r �factory�WrappingFactory�wrappedProtocolc � � || _ || _ y �N)r r )�selfr r s r �__init__zProtocolWrapper.__init__5 s � � /�����r c �. � t | | j � S )zo Use a customized log prefix mentioning both the wrapped protocol and the current one. )r r �r s r r zProtocolWrapper.logPrefix; s � � !��t�';�';�<�<r c �� � t | t |� � t j | |� | j j | � | j j | � y)z� When a connection is made, register this wrapper with its factory, save the real transport, and connect the wrapped protocol to this L{ProtocolWrapper} to intercept any transport calls it makes. N)r r r �makeConnectionr �registerProtocolr )r � transports r r$ zProtocolWrapper.makeConnectionB sI � � ��z�)�4�5�����i�0����%�%�d�+����+�+�D�1r c �: � | j j |� y r )r&