
    Dh                     0    d dl mZ d dlmZ  G d d      Zy)    )accepts_kwargs)InvalidSubscriberMethodErrorc                   L     e Zd ZdZg dZ fdZed        Zd Zd Z	d Z
 xZS )BaseSubscriberzThe base subscriber class

    It is recommended that all subscriber implementations subclass and then
    override the subscription methods (i.e. on_{subsribe_type}() methods).
    )queuedprogressdonec                 B    | j                          t        | 	  |       S )N)_validate_subscriber_methodssuper__new__)clsargskwargs	__class__s      x/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/s3transfer/subscribers.pyr   zBaseSubscriber.__new__   s    ((*ws##    c                     | j                   D ]C  }t        | d|z         }t        |      st        d|z        t	        |      r7t        d|z         y )Non_z&Subscriber method %s must be callable.z=Subscriber method %s must accept keyword arguments (**kwargs))VALID_SUBSCRIBER_TYPESgetattrcallabler   r   )r   subscriber_typesubscriber_methods      r   r   z+BaseSubscriber._validate_subscriber_methods   so    "99 	O 'U_-D E-.2<'( 
 ""342+->? 	r   c                      y)a  Callback to be invoked when transfer request gets queued

        This callback can be useful for:

            * Keeping track of how many transfers have been requested
            * Providing the expected transfer size through
              future.meta.provide_transfer_size() so a HeadObject would not
              need to be made for copies and downloads.

        :type future: s3transfer.futures.TransferFuture
        :param future: The TransferFuture representing the requested transfer.
        N selffuturer   s      r   	on_queuedzBaseSubscriber.on_queued.        	r   c                      y)aj  Callback to be invoked when progress is made on transfer

        This callback can be useful for:

            * Recording and displaying progress

        :type future: s3transfer.futures.TransferFuture
        :param future: The TransferFuture representing the requested transfer.

        :type bytes_transferred: int
        :param bytes_transferred: The number of bytes transferred for that
            invocation of the callback. Note that a negative amount can be
            provided, which usually indicates that an in-progress request
            needed to be retried and thus progress was rewound.
        Nr   )r   r   bytes_transferredr   s       r   on_progresszBaseSubscriber.on_progress=   s      	r   c                      y)a  Callback to be invoked once a transfer is done

        This callback can be useful for:

            * Recording and displaying whether the transfer succeeded or
              failed using future.result()
            * Running some task after the transfer completed like changing
              the last modified time of a downloaded file.

        :type future: s3transfer.futures.TransferFuture
        :param future: The TransferFuture representing the requested transfer.
        Nr   r   s      r   on_donezBaseSubscriber.on_doneO   r!   r   )__name__
__module____qualname____doc__r   r   classmethodr   r    r$   r&   __classcell__)r   s   @r   r   r      s8     <$  $r   r   N)s3transfer.compatr   s3transfer.exceptionsr   r   r   r   r   <module>r/      s    - >K Kr   