ó V!¶\c@svddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddl mZddlmZddlmZddlmZddlmZd Zd d-Zd d.ZejeƒZejeeefZdd„Zd„Zd„Zd„Z dd„Z"d„Z#d„Z$d„Z%de&fd„ƒYZ'de&fd„ƒYZ(de&fd„ƒYZ)de&fd„ƒYZ*de&fd „ƒYZ+d!e&fd"„ƒYZ,d#e&fd$„ƒYZ-d%e.fd&„ƒYZ/d'e&fd(„ƒYZ0d)e0fd*„ƒYZ1d+e&fd,„ƒYZ2dS(/iÿÿÿÿN(t defaultdict(tIncompleteReadError(tReadTimeoutError(t SOCKET_ERROR(t rename_file(tseekable(t fallocatei'iiiiicCsdjd„t|ƒDƒƒS(Ntcss!|]}tjtjƒVqdS(N(trandomtchoicetstringt hexdigits(t.0t_((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pys 2s(tjointrange(t num_digits((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pytrandom_file_extension1scKs2|dkr.t|jdƒr.|jjƒndS(Nt PutObjectt UploadParttsignal_not_transferring(RR(thasattrtbodyR(trequesttoperation_nametkwargs((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pyR5s cKs2|dkr.t|jdƒr.|jjƒndS(NRRtsignal_transferring(s PutObjects UploadPart(RRR(RRR((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pyR;s cCsttj|t|ƒƒƒS(N(tinttmathtceiltfloat(tsizet part_size((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pytcalculate_num_partsAscCsd||}||dkrBd}|dk rPt|dƒ}qPn||d}d||f}|S(sÐCalculate the range parameter for multipart downloads/copies :type part_size: int :param part_size: The size of the part :type part_index: int :param part_index: The index for which this parts starts. This index starts at zero :type num_parts: int :param num_parts: The total number of parts in the transfer :returns: The value to use for Range parameter on downloads or the CopySourceRange parameter for copies iRs bytes=%s-%sN(tNonetstr(R t part_indext num_partst total_sizet start_ranget end_ranget range_param((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pytcalculate_range_parameterEs  cCseg}xX|jjjD]G}d|}t||ƒr|jtjt||ƒd|ƒƒqqW|S(s Retrieves callbacks from a subscriber :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future the subscriber is associated to. :type callback_type: str :param callback_type: The type of callback to retrieve from the subscriber. Valid types include: * 'queued' * 'progress' * 'done' :returns: A list of callbacks for the type specified. All callbacks are preinjected with the transfer future. ton_tfuture(tmetat call_argst subscribersRtappendt functoolstpartialtgetattr(ttransfer_futuret callback_typet callbackst subscribert callback_name((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pyt get_callbacksbs cCs+|r'x|D]}|d|ƒq WndS(sŸCalls all progress callbacks :param callbacks: A list of progress callbacks to invoke :param bytes_transferred: The number of bytes transferred. This is passed to the callbacks. If no bytes were transferred the callbacks will not be invoked because no progress was achieved. It is also possible to receive a negative amount which comes from retrying a transfer request. tbytes_transferredN((R6R:tcallback((s6/tmp/pip-install-usGedi/s3transfer/s3transfer/utils.pytinvoke_progress_callbacks€s  cCs@i}x3|jƒD]%\}}||kr||| sR                      0IC›%_