U
    •uÄc­%  ã                   @   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   s   || _ || _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   úV/var/www/html/HOTSTAR/school/venv/lib/python3.8/site-packages/autobahn/wamp/request.pyÚ__init__4   s    	zPublication.__init__c                 C   s   d  | j| j¡S )Nz&Publication(id={0}, was_encrypted={1}))Úformatr   r   ©r   r   r   r   Ú__str__@   s    zPublication.__str__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   r   r   r   ,   s   r   c                   @   s,   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   s
    zSubscription.__init__c                 C   s   | j r| j | ¡S tdƒ‚dS )z0
        Unsubscribe this subscription.
        zsubscription no longer activeN)r   r   Z_unsubscribeÚ	Exceptionr   r   r   r   Úunsubscribe`   s    zSubscription.unsubscribec                 C   s   d  | j| j¡S )Nz#Subscription(id={0}, is_active={1}))r   r   r   r   r   r   r   r   i   s    zSubscription.__str__N)r   r   r   r   r   r   r#   r   r   r   r   r   r   D   s
   	r   c                   @   s   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   s   || _ || _|| _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   s    zHandler.__init__)NN©r   r   r   r   r   r   r   r   r   r   r   m   s   r   c                   @   s,   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	S )
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
        TNr*   )r   r   Úregistration_idr+   r,   r   r   r   r   Œ   s
    zRegistration.__init__c                 C   s   | j r| j | ¡S tdƒ‚dS )ú	
        zregistration no longer activeN)r   r   Z_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   r+   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                   @   s   e Zd ZdZdZddd„ZdS )r   zO
    Object representing an procedure endpoint attached to a registration.
    r$   Nc                 C   s   || _ || _|| _dS )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$   r(   r   r   r   r   ´   s    zEndpoint.__init__)NNr)   r   r   r   r   r   ­   s   r   c                   @   s   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   s   || _ || _dS )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
        Nr1   )r   r2   r3   r   r   r   r   Í   s    	zRequest.__init__Nr)   r   r   r   r   r0   Å   s   r0   c                   @   s   e Zd ZdZdZdd„ ZdS )r   zX
    Object representing an outstanding request to publish (acknowledged) an event.
    r   c                 C   s   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)r0   r   r   )r   r2   r3   r   r   r   r   r   á   s    zPublishRequest.__init__Nr)   r   r   r   r   r   Ú   s   r   c                   @   s   e Zd ZdZdZdd„ ZdS )r   zM
    Object representing an outstanding request to subscribe to a topic.
    )r    r   c                 C   s   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)r0   r   r   r    )r   r2   r   r3   r    r   r   r   r   ø   s    zSubscribeRequest.__init__Nr)   r   r   r   r   r   ñ   s   r   c                   @   s   e Zd ZdZdZdd„ ZdS )r   zS
    Object representing an outstanding request to unsubscribe a subscription.
    )r!   c                 C   s   t  | ||¡ || _dS ©r.   N)r0   r   r!   )r   r2   r3   r!   r   r   r   r     s    zUnsubscribeRequest.__init__Nr)   r   r   r   r   r     s   r   c                   @   s   e Zd ZdZdZdd„ ZdS )r	   zI
    Object representing an outstanding request to call a procedure.
    )r+   Úoptionsc                 C   s   t  | ||¡ || _|| _dS )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)r0   r   r+   r5   )r   r2   r+   r3   r5   r   r   r   r   !  s    zCallRequest.__init__Nr)   r   r   r   r   r	     s   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                   @   s   e Zd ZdZdZdd„ ZdS )r   zM
    Object representing an outstanding request to register a procedure.
    )r+   r,   c                 C   s   t  | ||¡ || _|| _dS r4   )r0   r   r+   r,   )r   r2   r3   r+   r,   r   r   r   r   ?  s    zRegisterRequest.__init__Nr)   r   r   r   r   r   8  s   r   c                   @   s   e Zd ZdZdZdd„ ZdS )r   zR
    Object representing an outstanding request to unregister a registration.
    )r-   c                 C   s   t  | ||¡ || _dS r4   )r0   r   r-   )r   r2   r3   r-   r   r   r   r   N  s    zUnregisterRequest.__init__Nr)   r   r   r   r   r   G  s   r   N)Ú__all__Úobjectr   r   r   r   r   r0   r   r   r   r	   r
   r   r   r   r   r   r   Ú<module>   s   )(