o
    èó·i­%  ã                   @   sØ   d Z G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZ	G dd„ deƒZ
G dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS ))ÚPublicationÚSubscriptionÚHandlerÚRegistrationÚEndpointÚPublishRequestÚSubscribeRequestÚUnsubscribeRequestÚCallRequestÚInvocationRequestÚRegisterRequestÚUnregisterRequestc                   @   s$   e Zd ZdZdZdd„ Zdd„ ZdS )r   zw
    Object representing a publication (feedback from publishing an event when doing
    an acknowledged publish).
    ©ÚidÚwas_encryptedc                 C   ó   || _ || _dS )zî

        :param publication_id: The publication ID of the published event.
        :type publication_id: int

        :param was_encrypted: Flag indicating whether the app payload was encrypted.
        :type was_encrypted: bool
        Nr   )ÚselfZpublication_idr   © r   ú[C:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\autobahn/wamp/request.pyÚ__init__4   ó   	
zPublication.__init__c                 C   ó   d  | j| j¡S )Nz&Publication(id={0}, was_encrypted={1}))Úformatr   r   ©r   r   r   r   Ú__str__@   ó   zPublication.__str__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   r   r   r   ,   s
    r   c                   @   ó,   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	S )
r   z5
    Object representing a handler subscription.
    ©r   ÚtopicÚactiveÚsessionÚhandlerc                 C   s"   || _ || _d| _|| _|| _dS )a�  

        :param subscription_id: The subscription ID.
        :type subscription_id: int

        :param topic: The subscription URI or URI pattern.
        :type topic: str

        :param session: The ApplicationSession this subscription is living on.
        :type session: instance of ApplicationSession

        :param handler: The user event callback.
        :type handler: callable
        TNr!   )r   Úsubscription_idr"   r$   r%   r   r   r   r   K   ó
   
zSubscription.__init__c                 C   ó   | j r	| j | ¡S tdƒ‚)z0
        Unsubscribe this subscription.
        zsubscription no longer activeN)r#   r$   Z_unsubscribeÚ	Exceptionr   r   r   r   Úunsubscribe`   s   zSubscription.unsubscribec                 C   r   )Nz#Subscription(id={0}, is_active={1}))r   r   r#   r   r   r   r   r   i   r   zSubscription.__str__N)r   r   r   r   r   r   r*   r   r   r   r   r   r   D   s    	r   c                   @   ó   e Zd ZdZdZddd„ZdS )r   zJ
    Object representing an event handler attached to a subscription.
    ©ÚfnÚobjÚdetails_argNc                 C   ó   || _ || _|| _dS )aS  

        :param fn: The event handler function to be called.
        :type fn: callable

        :param obj: The (optional) object upon which to call the function.
        :type obj: obj or None

        :param details_arg: The keyword argument under which event details should be provided.
        :type details_arg: str or None
        Nr,   ©r   r-   r.   r/   r   r   r   r   t   ó   
zHandler.__init__©NN©r   r   r   r   r   r   r   r   r   r   r   m   ó    r   c                   @   r    )
r   z-
    Object representing a registration.
    ©r   r#   r$   Ú	procedureÚendpointc                 C   s"   || _ d| _|| _|| _|| _dS )a]  

        :param id: The registration ID.
        :type id: int

        :param active: Flag indicating whether this registration is active.
        :type active: bool

        :param procedure: The procedure URI or URI pattern.
        :type procedure: callable

        :param endpoint: The user callback.
        :type endpoint: callable
        TNr6   )r   r$   Úregistration_idr7   r8   r   r   r   r   Œ   r'   zRegistration.__init__c                 C   r(   )ú	
        zregistration no longer activeN)r#   r$   Ú_unregisterr)   r   r   r   r   Ú
unregister¡   s   zRegistration.unregisterc                 C   s   d  | j| j| j¡S )Nz4Registration(id={0}, is_active={1}, procedure="{2}"))r   r   r#   r7   r   r   r   r   r   ©   s   zRegistration.__str__N)r   r   r   r   r   r   r<   r   r   r   r   r   r   …   s    r   c                   @   r+   )r   zO
    Object representing an procedure endpoint attached to a registration.
    r,   Nc                 C   r0   )aN  

        :param fn: The endpoint procedure to be called.
        :type fn: callable

        :param obj: The (optional) object upon which to call the function.
        :type obj: obj or None

        :param details_arg: The keyword argument under which call details should be provided.
        :type details_arg: str or None
        Nr,   r1   r   r   r   r   ´   r2   zEndpoint.__init__r3   r4   r   r   r   r   r   ­   r5   r   c                   @   ó   e Zd ZdZdZdd„ ZdS )ÚRequestz�
    Object representing an outstanding request, such as for subscribe/unsubscribe,
    register/unregister or call/publish.
    ©Ú
request_idÚon_replyc                 C   r   )zÔ

        :param request_id: The WAMP request ID.
        :type request_id: int

        :param on_reply: The Deferred/Future to be fired when the request returns.
        :type on_reply: Deferred/Future
        Nr?   )r   r@   rA   r   r   r   r   Í   r   zRequest.__init__Nr4   r   r   r   r   r>   Å   s    r>   c                   @   r=   )r   zX
    Object representing an outstanding request to publish (acknowledged) an event.
    r   c                 C   ó   t  | ||¡ || _dS )aL  

        :param request_id: The WAMP request ID.
        :type request_id: int

        :param on_reply: The Deferred/Future to be fired when the request returns.
        :type on_reply: Deferred/Future

        :param was_encrypted: Flag indicating whether the app payload was encrypted.
        :type was_encrypted: bool
        N)r>   r   r   )r   r@   rA   r   r   r   r   r   á   s   
zPublishRequest.__init__Nr4   r   r   r   r   r   Ú   ó    r   c                   @   r=   )r   zM
    Object representing an outstanding request to subscribe to a topic.
    )r%   r"   c                 C   ó   t  | ||¡ || _|| _dS )a•  

        :param request_id: The WAMP request ID.
        :type request_id: int

        :param topic: The topic URI being subscribed to.
        :type topic: unicode

        :param on_reply: The Deferred/Future to be fired when the request returns.
        :type on_reply: Deferred/Future

        :param handler: WAMP call options that are in use for this call.
        :type handler: callable
        N)r>   r   r"   r%   )r   r@   r"   rA   r%   r   r   r   r   ø   s   
zSubscribeRequest.__init__Nr4   r   r   r   r   r   ñ   rC   r   c                   @   r=   )r   zS
    Object representing an outstanding request to unsubscribe a subscription.
    )r&   c                 C   rB   ©r:   N)r>   r   r&   )r   r@   rA   r&   r   r   r   r     ó   
zUnsubscribeRequest.__init__Nr4   r   r   r   r   r     rC   r   c                   @   r=   )r	   zI
    Object representing an outstanding request to call a procedure.
    )r7   Úoptionsc                 C   rD   )a:  

        :param request_id: The WAMP request ID.
        :type request_id: int

        :param on_reply: The Deferred/Future to be fired when the request returns.
        :type on_reply: Deferred/Future

        :param options: WAMP call options that are in use for this call.
        :type options: dict
        N)r>   r   r7   rG   )r   r@   r7   rA   rG   r   r   r   r   !  s   
zCallRequest.__init__Nr4   r   r   r   r   r	     rC   r	   c                   @   s   e Zd ZdZdS )r
   zK
    Object representing an outstanding request to invoke an endpoint.
    N)r   r   r   r   r   r   r   r   r
   2  s    r
   c                   @   r=   )r   zM
    Object representing an outstanding request to register a procedure.
    )r7   r8   c                 C   s   t  | ||¡ || _|| _dS rE   )r>   r   r7   r8   )r   r@   rA   r7   r8   r   r   r   r   ?  s   
zRegisterRequest.__init__Nr4   r   r   r   r   r   8  rC   r   c                   @   r=   )r   zR
    Object representing an outstanding request to unregister a registration.
    )r9   c                 C   rB   rE   )r>   r   r9   )r   r@   rA   r9   r   r   r   r   N  rF   zUnregisterRequest.__init__Nr4   r   r   r   r   r   G  rC   r   N)Ú__all__Úobjectr   r   r   r   r   r>   r   r   r   r	   r
   r   r   r   r   r   r   Ú<module>   s   )(