o
    @BiW%                     @   s   d dl mZ 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 )    )absolute_import)PublicationSubscriptionHandlerRegistrationEndpointPublishRequestSubscribeRequestUnsubscribeRequestCallRequestInvocationRequestRegisterRequestUnregisterRequestc                   @   $   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   )selfpublication_idr    r   U/var/www/html/Trade-python/venv/lib/python3.10/site-packages/autobahn/wamp/request.py__init__6      	
zPublication.__init__c                 C      d | j| jS )Nz&Publication(id={0}, was_encrypted={1}))formatr   r   r   r   r   r   __str__B      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   M   
   
zSubscription.__init__c                 C      | j r	| j| S td)z0
        Unsubscribe this subscription.
        zsubscription no longer active)r&   r'   _unsubscribe	Exceptionr   r   r   r   unsubscribeb   s   zSubscription.unsubscribec                 C   r   )Nz#Subscription(id={0}, is_active={1}))r   r   r&   r   r   r   r   r   k   r   zSubscription.__str__N)r   r    r!   r"   r#   r   r.   r   r   r   r   r   r   F   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
        Nr0   r   r1   r2   r3   r   r   r   r   v      
zHandler.__init__NNr   r    r!   r"   r#   r   r   r   r   r   r   o       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
        TNr:   )r   r'   registration_idr;   r<   r   r   r   r      r*   zRegistration.__init__c                 C   r+   )	
        zregistration no longer active)r&   r'   _unregisterr-   r   r   r   r   
unregister   s   zRegistration.unregisterN)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.
    r0   Nc                 C   r4   )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
        Nr0   r5   r   r   r   r      r6   zEndpoint.__init__r7   r8   r   r   r   r   r      r9   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
        NrC   )r   rD   rE   r   r   r   r      r   zRequest.__init__Nr8   r   r   r   r   rB      s    rB   c                   @   rA   )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)rB   r   r   )r   rD   rE   r   r   r   r   r      s   
zPublishRequest.__init__Nr8   r   r   r   r   r          r   c                   @   rA   )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)rB   r   r%   r(   )r   rD   r%   rE   r(   r   r   r   r      s   
zSubscribeRequest.__init__Nr8   r   r   r   r   r	      rG   r	   c                   @   rA   )r
   zS
    Object representing an outstanding request to unsubscribe a subscription.
    )r)   c                 C   rF   r>   N)rB   r   r)   )r   rD   rE   r)   r   r   r   r        
zUnsubscribeRequest.__init__Nr8   r   r   r   r   r
     rG   r
   c                   @   rA   )r   zI
    Object representing an outstanding request to call a procedure.
    )r;   optionsc                 C   rH   )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)rB   r   r;   rK   )r   rD   r;   rE   rK   r   r   r   r      s   
zCallRequest.__init__Nr8   r   r   r   r   r     rG   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   1  s    r   c                   @   rA   )r   zM
    Object representing an outstanding request to register a procedure.
    )r;   r<   c                 C   s   t | || || _|| _dS rI   )rB   r   r;   r<   )r   rD   rE   r;   r<   r   r   r   r   >  s   
zRegisterRequest.__init__Nr8   r   r   r   r   r   7  rG   r   c                   @   rA   )r   zR
    Object representing an outstanding request to unregister a registration.
    )r=   c                 C   rF   rI   )rB   r   r=   )r   rD   rE   r=   r   r   r   r   M  rJ   zUnregisterRequest.__init__Nr8   r   r   r   r   r   F  rG   r   N)
__future__r   __all__objectr   r   r   r   r   rB   r   r	   r
   r   r   r   r   r   r   r   r   <module>   s   )%