U
    W+d                     @   s^   d dl mZ dddZG dd deZddd	ZG d
d deZdddZG dd deZdS )    )unquote_str Nc           	      c   s`   d}d}|r\| j |||||d}|D ]
}|V  q$|r@|jp>|j}|rT|dkrTt|}|j}qdS )z<
    A generator function for listing keys in a bucket.
    TN)prefixmarker	delimiterheadersencoding_typeurl)Zget_all_keysZnext_markernamer   is_truncated)	bucketr   r   r   r   r   more_resultskrs r   ?/tmp/pip-unpacked-wheel-dlxw5sjy/boto/s3/bucketlistresultset.pybucket_lister   s     r   c                   @   s"   e Zd ZdZdddZdd ZdS )	BucketListResultSetaM  
    A resultset for listing keys within a bucket.  Uses the bucket_lister
    generator function and implements the iterator interface.  This
    transparently handles the results paging from S3 so even if you have
    many thousands of keys within the bucket you can iterate over all
    keys in a reasonably efficient manner.
    Nr   c                 C   s(   || _ || _|| _|| _|| _|| _d S N)r   r   r   r   r   r   )selfr   r   r   r   r   r   r   r   r   __init__4   s    zBucketListResultSet.__init__c                 C   s    t | j| j| j| j| j| jdS )N)r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   __iter__=   s    
 zBucketListResultSet.__iter__)Nr   r   r   NN__name__
__module____qualname____doc__r   r   r   r   r   r   r   +   s       
	r   c           
   	   c   s`   d}d}|r\| j |||||d|d}	|	D ]
}|V  q(|	j}|rN|dkrNt|}|	j}|	j}qdS )z@
    A generator function for listing versions in a bucket.
    TNi  )r   
key_markerversion_id_markerr   r   Zmax_keysr   r	   )Zget_all_versionsnext_key_markerr   Znext_version_id_markerr   )
r   r   r   r   r   r   r   r   r   r   r   r   r   versioned_bucket_listerC   s"      r!   c                   @   s"   e Zd ZdZdddZdd ZdS )	VersionedBucketListResultSetaQ  
    A resultset for listing versions within a bucket.  Uses the bucket_lister
    generator function and implements the iterator interface.  This
    transparently handles the results paging from S3 so even if you have
    many thousands of keys within the bucket you can iterate over all
    keys in a reasonably efficient manner.
    Nr   c                 C   s.   || _ || _|| _|| _|| _|| _|| _d S r   )r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   a   s    z%VersionedBucketListResultSet.__init__c              	   C   s$   t | j| j| j| j| j| j| jdS )N)r   r   r   r   r   r   )r!   r   r   r   r   r   r   r   r   r   r   r   r   k   s    
z%VersionedBucketListResultSet.__iter__)Nr   r   r   r   NNr   r   r   r   r   r"   X   s         

r"   c                 c   sZ   d}d}|rV| j ||||d}|D ]
}|V  q"|j}|rH|dkrHt|}|j}|j}qdS )zI
    A generator function for listing multipart uploads in a bucket.
    TNr   upload_id_markerr   r   r	   )Zget_all_multipart_uploadsr    r   Znext_upload_id_markerr   )r   r   r$   r   r   r   r   r   r   r   r   multipart_upload_listers   s    r%   c                   @   s"   e Zd ZdZdddZdd ZdS )	MultiPartUploadListResultSetaj  
    A resultset for listing multipart uploads within a bucket.
    Uses the multipart_upload_lister generator function and
    implements the iterator interface.  This
    transparently handles the results paging from S3 so even if you have
    many thousands of uploads within the bucket you can iterate over all
    keys in a reasonably efficient manner.
    Nr   c                 C   s"   || _ || _|| _|| _|| _d S r   )r   r   r$   r   r   )r   r   r   r$   r   r   r   r   r   r      s
    z%MultiPartUploadListResultSet.__init__c                 C   s   t | j| j| j| j| jdS )Nr#   )r%   r   r   r$   r   r   r   r   r   r   r      s    z%MultiPartUploadListResultSet.__iter__)Nr   r   NNr   r   r   r   r   r&      s         
r&   )r   r   r   NN)r   r   r   r   NN)r   r   NN)	Zboto.compatr   r   objectr   r!   r"   r%   r&   r   r   r   r   <module>   s"     
       
     
