a
    !fS                     @   s\   d dl mZ d dlZd dlmZmZmZ d dlmZ ejrFd dl	m
Z
 G dd dejZdS )    )absolute_importN)AnyCallableUnion)futures)	pubsub_v1c                       sl   e Zd ZdZedddZedddZdeee	f e
d fd	d
Zedgef dd fddZ  ZS )FuturezThis future object is returned from asychronous Pub/Sub publishing
    calls.

    Calling :meth:`result` will resolve the future by returning the message
    ID, unless an error occurs.
    )returnc                 C   s   dS ziActions in Pub/Sub generally may not be canceled.

        This method always returns ``False``.
        F selfr   r   i/var/www/html/python-backend/venv/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/futures.pycancel"   s    zFuture.cancelc                 C   s   dS r
   r   r   r   r   r   	cancelled)   s    zFuture.cancelledN)timeoutr	   c                    s   t  j|dS )a$  Return the message ID or raise an exception.

        This blocks until the message has been published successfully and
        returns the message ID unless an exception is raised.

        Args:
            timeout: The number of seconds before this call
                times out and raises TimeoutError.

        Returns:
            The message ID.

        Raises:
            concurrent.futures.TimeoutError: If the request times out.
            Exception: For undefined exceptions in the underlying
                call execution.
        )r   )superresult)r   r   	__class__r   r   r   0   s    zFuture.resultz"pubsub_v1.publisher.futures.Future)callbackr	   c                    s   t  |S )a9  Attach a callable that will be called when the future finishes.

        Args:
            callback:
                A callable that will be called with this future as its only
                argument when the future completes or is cancelled. The callable
                will always be called by a thread in the same process in which
                it was added. If the future has already completed or been
                cancelled then the callable will be called immediately. These
                callables are called in the order that they were added.
        )r   add_done_callback)r   r   r   r   r   r   E   s    zFuture.add_done_callback)N)__name__
__module____qualname____doc__boolr   r   r   intfloatstrr   r   r   r   __classcell__r   r   r   r   r      s   r   )
__future__r   typingr   r   r   Zgoogle.cloud.pubsub_v1r   TYPE_CHECKINGZgoogle.cloudr   r   r   r   r   r   <module>   s   