o
    .&ßah  ã                   @   s8  d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dl	mZ d dlmZ d dlmZmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ e e¡Zedg d¢ƒZdefdd„ZeddgƒZedg d¢ƒZedƒZeddgƒZ edƒZ!eddgƒZ"ede"d�Z#edddgƒZ$ed d!gƒZ%G d"d#„ d#e&ƒZ'G d$d%„ d%eƒZ(G d&d'„ d'e(ƒZ)G d(d)„ d)e)ƒZ*G d*d+„ d+e(ƒZ+G d,d-„ d-e+ƒZ,G d.d/„ d/e(ƒZ-G d0d1„ d1e(ƒZ.G d2d3„ d3e&ƒZ/G d4d5„ d5e/ƒZ0G d6d7„ d7e/ƒZ1G d8d9„ d9e1ƒZ2G d:d;„ d;e1ƒZ3G d<d=„ d=ej4ƒZ5G d>d?„ d?e&ƒZ6dS )@é    )ÚdivisionN)Ú
namedtuple)Údefaultdict)ÚCancelledError)Ú
FatalError)ÚBaseSubscriber)ÚqueueÚensure_text_type©Úrelative_path)Úhuman_readable_size)Ú	uni_print)ÚWarningResult)ÚOnDoneFilteredSubscriberÚ
BaseResult)Útransfer_typeÚsrcÚdestc                 C   s,   t |jƒ}|r||7 }t| t| |ƒ|fi ƒS ©N)ÚlistÚ_fieldsÚtyper   )ÚnameÚextra_fieldsÚbase_clsÚfields© r   úB/usr/lib/python3/dist-packages/awscli/customizations/s3/results.pyÚ_create_new_result_cls'   s   
r   ÚQueuedResultÚtotal_transfer_sizeÚProgressResult)Úbytes_transferredr    Ú	timestampÚSuccessResultÚFailureResultÚ	exceptionÚDryRunResultÚErrorResultÚCtrlCResult)r   ÚCommandResultÚnum_tasks_failedÚnum_tasks_warnedÚFinalTotalSubmissionsResultÚtotal_submissionsc                   @   s   e Zd ZdS )ÚShutdownThreadRequestN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r/   K   s    r/   c                   @   sR   e Zd ZdZddd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚBaseResultSubscriberNc                 C   s*   || _ i | _|| _|du r| j| _dS dS )z§Subscriber to send result notifications during transfer process

        :param result_queue: The queue to place results to be processed later
            on.
        N)Ú_result_queueÚ_result_kwargs_cacheÚ_transfer_typeÚTRANSFER_TYPE)ÚselfÚresult_queuer   r   r   r   Ú__init__R   s   ÿzBaseResultSubscriber.__init__c                 K   s6   |   |¡ | j|jj }tdi |¤Ž}| j |¡ d S ©Nr   )Ú_add_to_result_kwargs_cacher5   ÚmetaÚtransfer_idr   r4   Úput)r8   ÚfutureÚkwargsÚresult_kwargsÚqueued_resultr   r   r   Ú	on_queued^   s   
zBaseResultSubscriber.on_queuedc                 K   s6   | j |jj }td|t ¡ dœ|¤Ž}| j |¡ d S )N)r"   r#   r   )r5   r=   r>   r!   Útimer4   r?   )r8   r@   r"   rA   rB   Úprogress_resultr   r   r   Úon_progressd   s   ÿþz BaseResultSubscriber.on_progressc                 C   s$   |   |¡}| j tdi |¤Ž¡ d S r;   )Ú%_on_done_pop_from_result_kwargs_cacher4   r?   r$   ©r8   r@   rB   r   r   r   Ú_on_successk   s   
z BaseResultSubscriber._on_successc                 C   sZ   |   |¡}t|tƒrt}t|tƒrt}| j ||d�¡ d S | j tdd|i|¤Ž¡ d S )N©r&   r&   r   )	rH   Ú
isinstancer   r)   r   r(   r4   r?   r%   )r8   r@   ÚerB   Úerror_result_clsr   r   r   Ú_on_failureo   s   


z BaseResultSubscriber._on_failurec                 C   s4   |   |¡\}}| j|||jjdœ}|| j|jj< d S )N)r   r   r   r    )Ú_get_src_destr6   r=   Úsizer5   r>   )r8   r@   r   r   rB   r   r   r   r<   y   s   üz0BaseResultSubscriber._add_to_result_kwargs_cachec                 C   s   | j  |jj¡}| d¡ |S )Nr    )r5   Úpopr=   r>   rI   r   r   r   rH   ƒ   s   
z:BaseResultSubscriber._on_done_pop_from_result_kwargs_cachec                 C   ó   t dƒ‚)Nz_get_src_dest()©ÚNotImplementedError)r8   r@   r   r   r   rP   ˆ   ó   z"BaseResultSubscriber._get_src_destr   )r0   r1   r2   r7   r:   rD   rG   rJ   rO   r<   rH   rP   r   r   r   r   r3   O   s    


r3   c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )ÚUploadResultSubscriberÚuploadc                 C   s0   |j j}|  |j¡}d|j d |j }||fS ©Nús3://ú/)r=   Ú	call_argsÚ_get_srcÚfileobjÚbucketÚkey©r8   r@   r]   r   r   r   r   r   rP   �   s   z$UploadResultSubscriber._get_src_destc                 C   ó   t |ƒS r   r
   ©r8   r_   r   r   r   r^   •   rV   zUploadResultSubscriber._get_srcN)r0   r1   r2   r7   rP   r^   r   r   r   r   rX   Œ   ó    rX   c                   @   ó   e Zd Zdd„ ZdS )ÚUploadStreamResultSubscriberc                 C   ó   dS ©Nú-r   rd   r   r   r   r^   š   ó   z%UploadStreamResultSubscriber._get_srcN)r0   r1   r2   r^   r   r   r   r   rg   ™   ó    rg   c                   @   rW   )ÚDownloadResultSubscriberÚdownloadc                 C   s0   |j j}d|j d |j }|  |j¡}||fS rZ   )r=   r]   r`   ra   Ú	_get_destr_   rb   r   r   r   rP   ¡   s   z&DownloadResultSubscriber._get_src_destc                 C   rc   r   r
   rd   r   r   r   ro   §   rV   z"DownloadResultSubscriber._get_destN)r0   r1   r2   r7   rP   ro   r   r   r   r   rm   ž   re   rm   c                   @   rf   )ÚDownloadStreamResultSubscriberc                 C   rh   ri   r   rd   r   r   r   ro   ¬   rk   z(DownloadStreamResultSubscriber._get_destN)r0   r1   r2   ro   r   r   r   r   rp   «   rl   rp   c                   @   ó   e Zd ZdZdd„ ZdS )ÚCopyResultSubscriberÚcopyc                 C   sB   |j j}|j}d|d  d |d  }d|j d |j }||fS )Nr[   ÚBucketr\   ÚKey)r=   r]   Úcopy_sourcer`   ra   )r8   r@   r]   rv   r   r   r   r   r   rP   ³   s
   z"CopyResultSubscriber._get_src_destN©r0   r1   r2   r7   rP   r   r   r   r   rr   °   ó    rr   c                   @   rq   )ÚDeleteResultSubscriberÚdeletec                 C   s$   |j j}d|j d |j }|d fS rZ   )r=   r]   r`   ra   )r8   r@   r]   r   r   r   r   rP   ¾   s   z$DeleteResultSubscriber._get_src_destNrw   r   r   r   r   ry   »   rx   ry   c                   @   rq   )ÚBaseResultHandlerz6Base handler class to be called in the ResultProcessorc                 C   rS   )Nz
__call__()rT   ©r8   Úresultr   r   r   Ú__call__Æ   rV   zBaseResultHandler.__call__N)r0   r1   r2   Ú__doc__r~   r   r   r   r   r{   Ä   ó    r{   c                   @   s€   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚResultRecorderz?Records and track transfer statistics based on results receivedc                 C   sŒ   d| _ d| _d| _d| _d| _d| _d| _d| _d | _d | _	d| _
ttƒ| _i | _t| jt| jt| jt| jt| jt| jt| jt| ji| _d S ©Nr   )r"   Úbytes_failed_to_transferÚfiles_transferredÚfiles_failedÚfiles_warnedÚerrorsÚexpected_bytes_transferredÚexpected_files_transferredÚ final_expected_files_transferredÚ
start_timeÚbytes_transfer_speedr   ÚintÚ_ongoing_progressÚ_ongoing_total_sizesr   Ú_record_queued_resultr!   Ú_record_progress_resultr$   Ú_record_success_resultr%   Ú_record_failure_resultr   Ú_record_warning_resultr(   Ú_record_error_resultr)   r-   Ú_record_final_expected_filesÚ_result_handler_map©r8   r   r   r   r:   Ì   s,   

øzResultRecorder.__init__c                 C   s   | j | jkS r   )rŠ   r‰   r˜   r   r   r   Úexpected_totals_are_finalè   s   ÿÿz(ResultRecorder.expected_totals_are_finalc                 C   ó   | j  t|ƒ| j¡|d� dS )z0Record the result of an individual Result object©r}   N)r—   Úgetr   Ú_record_noopr|   r   r   r   r~   î   ó   
ÿzResultRecorder.__call__c                 C   sT   t |tƒstdt|ƒ ƒ‚g }|j|j|jfD ]}|d ur$| t|ƒ¡ qd 	|¡S )NzdAny result using _get_ongoing_dict_key must subclass from BaseResult. Provided result is of type: %sú:)
rL   r   Ú
ValueErrorr   r   r   r   Úappendr	   Újoin)r8   r}   Ú	key_partsÚresult_propertyr   r   r   Ú_get_ongoing_dict_keyó   s   
ÿÿ€
z$ResultRecorder._get_ongoing_dict_keyc                 C   s.   |   |¡}| j |d¡}| j |d ¡}||fS r‚   )r¥   rŽ   rR   r�   )r8   r}   Úongoing_keyÚtotal_progressÚtotal_file_sizer   r   r   Ú_pop_result_from_ongoing_dictsÿ   s   
z-ResultRecorder._pop_result_from_ongoing_dictsc                 K   ó   d S r   r   ©r8   rA   r   r   r   r�     ó   zResultRecorder._record_noopc                 K   sN   | j d u r
t ¡ | _ |j}|| j|  |¡< |r|  j|7  _|  jd7  _d S ©Né   )r‹   rE   r    r�   r¥   rˆ   r‰   )r8   r}   rA   r    r   r   r   r�   	  s   

ÿÿz$ResultRecorder._record_queued_resultc                 K   s^   |j }|  |¡ | j|  |¡  |7  < |  j |7  _ |j| jkr-| j |j| j  | _d S d S r   )r"   Ú(_update_ongoing_transfer_size_if_unknownrŽ   r¥   r#   r‹   rŒ   )r8   r}   rA   r"   r   r   r   r‘     s   
ÿÿ

ÿÿz&ResultRecorder._record_progress_resultc                 C   sn   |   |¡}| j| d u r5|j}|jd ur+|| j|< | j| }|| }|  j|7  _d S |  j|j7  _d S d S r   )r¥   r�   r    rŽ   rˆ   r"   )r8   r}   r¦   r    Úongoing_progressÚunaccounted_bytesr   r   r   r¯   &  s   



ïz7ResultRecorder._update_ongoing_transfer_size_if_unknownc                 K   s   |   |¡ |  jd7  _d S r­   )r©   r„   ©r8   r}   rA   r   r   r   r’   @  s   
z%ResultRecorder._record_success_resultc                 K   sL   |   |¡\}}|d ur|| }|  j|7  _|  jd7  _|  jd7  _d S r­   )r©   rƒ   r…   r„   )r8   r}   rA   r§   r¨   Úprogress_leftr   r   r   r“   D  s   ÿz%ResultRecorder._record_failure_resultc                 K   ó   |  j d7  _ d S r­   )r†   r«   r   r   r   r”   Q  ó   z%ResultRecorder._record_warning_resultc                 K   r´   r­   )r‡   r«   r   r   r   r•   T  rµ   z#ResultRecorder._record_error_resultc                 K   s   |j | _d S r   )r.   rŠ   r²   r   r   r   r–   W  s   z+ResultRecorder._record_final_expected_filesN)r0   r1   r2   r   r:   r™   r~   r¥   r©   r�   r�   r‘   r¯   r’   r“   r”   r•   r–   r   r   r   r   r�   Ê   s     r�   c                   @   sð   e Zd ZdZdZdZde Zde ZdZde Z	dZ
d	Zd
ZdZdZdZd8dd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd9d.d/„Zd0d1„ Z d2d3„ Z!d4d5„ Z"d6d7„ Z#dS ):ÚResultPrinterz#{remaining_files} file(s) remainingz~{expected_total}z (calculating...)zOCompleted {bytes_completed}/{expected_bytes_completed} ({transfer_speed}) with z)Completed {files_completed} file(s) with z${transfer_type}: {transfer_location}z	(dryrun) z7{transfer_type} failed: {transfer_location} {exception}z	{message}zfatal error: {exception}zcancelled: ctrl-c receivedz{src} to {dest}z{src}Nc                 C   sv   || _ || _| jdu rtj| _|| _| jdu rtj| _d| _t| jt	| j
t| jt| jt| jt| jt| jt| ji| _dS )aÞ  Prints status of ongoing transfer

        :type result_recorder: ResultRecorder
        :param result_recorder: The associated result recorder

        :type out_file: file-like obj
        :param out_file: Location to write progress and success statements.
            By default, the location is sys.stdout.

        :type error_file: file-like obj
        :param error_file: Location to write warnings and errors.
            By default, the location is sys.stderr.
        Nr   )Ú_result_recorderÚ	_out_fileÚsysÚstdoutÚ_error_fileÚstderrÚ_progress_lengthr!   Ú_print_progressr$   Ú_print_successr%   Ú_print_failurer   Ú_print_warningr(   Ú_print_errorr)   Ú_print_ctrl_cr'   Ú_print_dry_runr-   Ú-_clear_progress_if_no_more_expected_transfersr—   )r8   Úresult_recorderÚout_fileÚ
error_filer   r   r   r:   z  s$   


÷zResultPrinter.__init__c                 C   rš   )z<Print the progress of the ongoing transfer based on a resultr›   N)r—   rœ   r   Ú_print_noopr|   r   r   r   r~   œ  rž   zResultPrinter.__call__c                 K   rª   r   r   r«   r   r   r   rÉ   ¡  r¬   zResultPrinter._print_noopc                 K   s0   | j j|j|  |¡d�}|  |¡}|  |¡ d S ©N)r   Útransfer_location)ÚDRY_RUN_FORMATÚformatr   Ú_get_transfer_locationÚ_adjust_statement_paddingÚ_print_to_out_file)r8   r}   rA   Ú	statementr   r   r   rÄ   ¥  s   þ
zResultPrinter._print_dry_runc                 K   s8   | j j|j|  |¡d�}|  |¡}|  |¡ |  ¡  d S rÊ   )ÚSUCCESS_FORMATrÍ   r   rÎ   rÏ   rÐ   Ú_redisplay_progress)r8   r}   rA   Úsuccess_statementr   r   r   r¿   ­  s   þ

zResultPrinter._print_successc                 K   s<   | j j|j|  |¡|jd�}|  |¡}|  |¡ |  ¡  d S )N)r   rË   r&   )ÚFAILURE_FORMATrÍ   r   rÎ   r&   rÏ   Ú_print_to_error_filerÓ   )r8   r}   rA   Úfailure_statementr   r   r   rÀ   ¶  s   ý

zResultPrinter._print_failurec                 K   s0   | j j|jd�}|  |¡}|  |¡ |  ¡  d S )N)Úmessage)ÚWARNING_FORMATrÍ   rØ   rÏ   rÖ   rÓ   )r8   r}   rA   Úwarning_statementr   r   r   rÁ   À  s   

zResultPrinter._print_warningc                 K   s   |   | jj|jd�¡ d S )NrK   )Ú_flush_error_statementÚERROR_FORMATrÍ   r&   r²   r   r   r   rÂ   Æ  s   ÿzResultPrinter._print_errorc                 K   s   |   | j¡ d S r   )rÛ   Ú
CTRL_C_MSGr²   r   r   r   rÃ   Ê  ó   zResultPrinter._print_ctrl_cc                 C   s   |   |¡}|  |¡ d S r   )rÏ   rÖ   )r8   Úerror_statementr   r   r   rÛ   Í  s   
z$ResultPrinter._flush_error_statementc                 C   s.   |j d u r| jj|jd�S | jj|j|j d�S )N)r   )r   r   )r   ÚSRC_TRANSFER_LOCATION_FORMATrÍ   r   Ú!SRC_DEST_TRANSFER_LOCATION_FORMATr|   r   r   r   rÎ   Ñ  s
   
ÿz$ResultPrinter._get_transfer_locationc                 C   s   d| _ |  ¡  d S r‚   )r½   Ú_add_progress_if_neededr˜   r   r   r   rÓ   ×  s   z!ResultPrinter._redisplay_progressc                 C   s   |   ¡ r
|  ¡  d S d S r   )Ú_has_remaining_progressr¾   r˜   r   r   r   râ   Þ  s   ÿz%ResultPrinter._add_progress_if_neededc                 K   sÄ   |   t| jj| jj ƒ¡}| jjdkr9t| jj| jj ƒ}|   t| jjƒ¡}t| jj	ƒd }| j
j||||d�}n
| jj| jj|d�}| j ¡ sM|| j7 }| j|dd�}t|ƒd | _|  |¡ d S )Nr   z/s)Úbytes_completedÚexpected_bytes_completedÚtransfer_speedÚremaining_files)Úfiles_completedrç   ú)Úending_charr®   )Ú_get_expected_totalÚstrr·   r‰   r„   rˆ   r   r"   rƒ   rŒ   ÚBYTE_PROGRESS_FORMATrÍ   ÚFILE_PROGRESS_FORMATr™   Ú_STILL_CALCULATING_TOTALSrÏ   Úlenr½   rÐ   )r8   rA   rç   rä   rå   ræ   Úprogress_statementr   r   r   r¾   â  sL   ÿÿÿÿÿÿÿÿü	þ

ÿzResultPrinter._print_progressc                 C   s   | j  ¡ s| jj|d�S |S )N)Úexpected_total)r·   r™   Ú_ESTIMATED_EXPECTED_TOTALrÍ   )r8   rò   r   r   r   rë     s
   
ÿz!ResultPrinter._get_expected_totalÚ
c                 C   s   |  | jd¡}|| S )Nú )Úljustr½   )r8   Úprint_statementrê   r   r   r   rÏ     s   z'ResultPrinter._adjust_statement_paddingc                 C   s&   | j  ¡ sdS | j j}| j j}||kS )NT)r·   r™   r„   r‰   )r8   ÚactualÚexpectedr   r   r   rã     s
   
z%ResultPrinter._has_remaining_progressc                 C   ó   t || jƒ d S r   )r   r¸   ©r8   rÑ   r   r   r   rÐ   "  rÞ   z ResultPrinter._print_to_out_filec                 C   rú   r   )r   r»   rû   r   r   r   rÖ   %  rÞ   z"ResultPrinter._print_to_error_filec                 K   s,   | j r|  ¡ st|  d¡| jƒ d S d S d S )NÚ )r½   rã   r   rÏ   r¸   r«   r   r   r   rÅ   (  s   ÿz;ResultPrinter._clear_progress_if_no_more_expected_transfers)NN)rô   )$r0   r1   r2   Ú_FILES_REMAININGró   rï   rí   rî   rÒ   rÌ   rÕ   rÙ   rÜ   rÝ   rá   rà   r:   r~   rÉ   rÄ   r¿   rÀ   rÁ   rÂ   rÃ   rÛ   rÎ   rÓ   râ   r¾   rë   rÏ   rã   rÐ   rÖ   rÅ   r   r   r   r   r¶   [  sT    ÿÿÿÿÿÿÿ
"	
/
r¶   c                   @   rq   )ÚNoProgressResultPrinterz,A result printer that doesn't print progressc                 K   rª   r   r   r«   r   r   r   r¾   /  rk   z'NoProgressResultPrinter._print_progressN)r0   r1   r2   r   r¾   r   r   r   r   rþ   -  r€   rþ   c                   @   rW   )ÚOnlyShowErrorsResultPrinterz,A result printer that only prints out errorsc                 K   rª   r   r   r«   r   r   r   r¾   5  rk   z+OnlyShowErrorsResultPrinter._print_progressc                 K   rª   r   r   r²   r   r   r   r¿   8  rk   z*OnlyShowErrorsResultPrinter._print_successN)r0   r1   r2   r   r¾   r¿   r   r   r   r   rÿ   3  s    rÿ   c                   @   s&   e Zd Zddd„Zdd„ Zdd„ ZdS )	ÚResultProcessorNc                 C   s2   t j | ¡ || _|| _| jdu rg | _d| _dS )aQ  Thread to process results from result queue

        This includes recording statistics and printing transfer status

        :param result_queue: The result queue to process results from
        :param result_handlers: A list of callables that take a result in as
            a parameter to process the result for that handler.
        NT)Ú	threadingÚThreadr:   r4   Ú_result_handlersÚ_result_handlers_enabled)r8   r9   Úresult_handlersr   r   r   r:   =  s   	

zResultProcessor.__init__c                 C   sd   	 z%| j  d¡}t|tƒrt d¡ W d S | jr|  |¡ t|tƒr%d| _W n
 t	j
y0   Y nw q)NTzSShutdown request received in result processing thread, shutting down result thread.F)r4   rœ   rL   r/   ÚLOGGERÚdebugr  Ú_process_resultr(   r   ÚEmptyr|   r   r   r   ÚrunM  s"   
ÿ

€ÿïzResultProcessor.runc                 C   sT   | j D ]$}z||ƒ W q ty' } ztjd|||dd� W Y d }~qd }~ww d S )Nz.Error processing result %s with handler %s: %sT©Úexc_info)r  Ú	Exceptionr  r  )r8   r}   Úresult_handlerrM   r   r   r   r  b  s   
þ€ÿýzResultProcessor._process_resultr   )r0   r1   r2   r:   r
  r  r   r   r   r   r   <  s    
r   c                   @   sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )ÚCommandResultRecorderc                 C   s   || _ || _|| _dS )aŽ  Records the result for an entire command

        It will fully process all results in a result queue and determine
        a CommandResult representing the entire command.

        :type result_queue: queue.Queue
        :param result_queue: The result queue in which results are placed on
            and processed from

        :type result_recorder: ResultRecorder
        :param result_recorder: The result recorder to track the various
            results sent through the result queue

        :type result_processor: ResultProcessor
        :param result_processor: The result processor to process results
            placed on the queue
        N)r9   r·   Ú_result_processor)r8   r9   rÆ   Úresult_processorr   r   r   r:   m  s   
zCommandResultRecorder.__init__c                 C   s   | j  ¡  d S r   )r  Ústartr˜   r   r   r   r  ƒ  s   zCommandResultRecorder.startc                 C   s   | j  tƒ ¡ | j ¡  d S r   )r9   r?   r/   r  r¢   r˜   r   r   r   Úshutdown†  s   zCommandResultRecorder.shutdownc                 C   s   t | jj| jj | jjƒS )zÒGet the CommandResult representing the result of a command

        :rtype: CommandResult
        :returns: The CommandResult representing the total result from running
            a particular command
        )r*   r·   r…   r‡   r†   r˜   r   r   r   Úget_command_resultŠ  s   þz(CommandResultRecorder.get_command_resultc                 C   s   | j  t|ƒ¡ d S r   )r9   r?   r-   )r8   Útotalr   r   r   Únotify_total_submissions–  s   z.CommandResultRecorder.notify_total_submissionsc                 C   s   |   ¡  | S r   )r  r˜   r   r   r   Ú	__enter__™  s   zCommandResultRecorder.__enter__c                 G   s>   |rt jd|dd� | j t|d�¡ |  ¡  dS |  ¡  d S )Nz-Exception caught during command execution: %sTr  rK   )r  r  r9   r?   r(   r  )r8   Úexc_typeÚ	exc_valueÚargsr   r   r   Ú__exit__�  s   ÿzCommandResultRecorder.__exit__N)
r0   r1   r2   r:   r  r  r  r  r  r  r   r   r   r   r  l  s    r  )7Ú
__future__r   Úloggingr¹   r  rE   Úcollectionsr   r   Ús3transfer.exceptionsr   r   Ús3transfer.subscribersr   Úawscli.compatr   r	   Úawscli.customizations.s3.utilsr   r   Úawscli.customizations.utilsr   r   r   Ú	getLoggerr0   r  r   r   r   r!   r$   r%   r'   r(   r)   r*   r-   Úobjectr/   r3   rX   rg   rm   rp   rr   ry   r{   r�   r¶   rþ   rÿ   r  r   r  r   r   r   r   Ú<module>   sf   
ÿÿÿ=	  S	0