o
    
Jh	                     @   s6   d dl mZ d dlmZ d dlmZ G dd dZdS )    )	lru_cache)accepts_kwargs)InvalidSubscriberMethodErrorc                       sP   e Zd ZdZg dZ fddZeedd Zdd Z	d	d
 Z
dd Z  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                    s   |    t | S )N)_validate_subscriber_methodssuper__new__)clsargskwargs	__class__ v/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/s3transfer/subscribers.pyr      s   zBaseSubscriber.__new__c                 C   sN   | j D ]!}t| d| }t|std| dt|s$td| dqd S )Non_zSubscriber method z must be callable.z) must accept keyword arguments (**kwargs))VALID_SUBSCRIBER_TYPESgetattrcallabler   r   )r   subscriber_typesubscriber_methodr   r   r   r	       s   


z+BaseSubscriber._validate_subscriber_methodsc                 K      dS )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.
        Nr   selffuturer   r   r   r   	on_queued0      zBaseSubscriber.on_queuedc                 K   r   )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   r   r   r   on_progress?   s   zBaseSubscriber.on_progressc                 K   r   )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   r   r   r   on_doneQ   r   zBaseSubscriber.on_done)__name__
__module____qualname____doc__r   r   classmethodr   r	   r   r    r!   __classcell__r   r   r   r   r      s    r   N)	functoolsr   s3transfer.compatr   s3transfer.exceptionsr   r   r   r   r   r   <module>   s   