
    /Jf#                     D    d dl mZ d dlmZ d dlmZ  G d d          ZdS )    )	lru_cache)accepts_kwargs)InvalidSubscriberMethodErrorc                   r     e Zd ZdZg dZ fdZe 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                 n    |                                   t                                          |           S )N)_validate_subscriber_methodssuper__new__)clsargskwargs	__class__s      Y/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/s3transfer/subscribers.pyr   zBaseSubscriber.__new__   s+    ((***wws###    c                     | j         D ]W}t          | d|z             }t          |          st          d|z            t	          |          st          d|z            Xd S )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    s      #9 	 	O 'U_-D E E-.. 2<'(  
 ""344 2+->?  	 	r   c                     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.
        N selffuturer   s      r   	on_queuedzBaseSubscriber.on_queued1   	     	r   c                     dS )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                     dS )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_doneR   r"   r   )__name__
__module____qualname____doc__r   r   classmethodr   r   r!   r%   r'   __classcell__)r   s   @r   r   r      s          <;;$ $ $ $ $ Y[[  [ [    $      r   r   N)	functoolsr   s3transfer.compatr   s3transfer.exceptionsr   r   r   r   r   <module>r1      sy           , , , , , , > > > > > >L L L L L L L L L Lr   