o Àyð`,ã@s8ddlmZddlmZddlmZGdd„deƒZdS)é)Úsix)Úaccepts_kwargs)ÚInvalidSubscriberMethodErrorcsLeZdZdZgd¢Z‡fdd„Zedd„ƒZdd„Zd d „Z d d „Z ‡Z S) ÚBaseSubscriberz¶The 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Údonecs| ¡tt|ƒ |¡S)N)Ú_validate_subscriber_methodsÚsuperrÚ__new__)ÚclsÚargsÚkwargs©Ú __class__©ú8/usr/lib/python3/dist-packages/s3transfer/subscribers.pyr szBaseSubscriber.__new__cCsH|jD]}t|d|ƒ}t |¡std|ƒ‚t|ƒs!td|ƒ‚qdS)NÚon_z&Subscriber method %s must be callable.z=Subscriber method %s must accept keyword arguments (**kwargs))ÚVALID_SUBSCRIBER_TYPESÚgetattrrÚcallablerr)r Úsubscriber_typeÚsubscriber_methodrrrr #s  ÿÿÿÿÿùz+BaseSubscriber._validate_subscriber_methodscKódS)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ÚfuturerrrrÚ on_queued1ó zBaseSubscriber.on_queuedcKr)ajCallback 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)rrÚbytes_transferredrrrrÚ on_progress@szBaseSubscriber.on_progresscKr)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. NrrrrrÚon_doneRrzBaseSubscriber.on_done) Ú__name__Ú __module__Ú __qualname__Ú__doc__rr Ú classmethodr rr r!Ú __classcell__rrrrrs   rN)Úbotocore.compatrÚs3transfer.compatrÚs3transfer.exceptionsrÚobjectrrrrrÚs