HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/boto/file/__pycache__/bucket.cpython-310.pyc
o

we��@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�Key)�SimpleResultSet)�BucketListResultSetc@s^eZdZdd�Zdd�Zdd�Z		ddd	�Zdd
d�Zddej	fdd
�Z
dej	fdd�ZdS)�BucketcCs||_||_dS)zHInstantiate an anonymous file-based Bucket around a single key.
        N)�name�
contained_key)�selfrr�r	�I/home/arjun/projects/env/lib/python3.10/site-packages/boto/file/bucket.py�__init__s
zBucket.__init__cCstt|��S�N)�iterr�rr	r	r
�__iter__%szBucket.__iter__cCs
d|jS)Nzanonymous bucket for file://)rrr	r	r
�__str__(s
zBucket.__str__NcCst�|�dS)a<
        Deletes a key from the bucket.

        :type key_name: string
        :param key_name: The key name to delete

        :type version_id: string
        :param version_id: Unused in this subclass.

        :type mfa_token: tuple or list of strings
        :param mfa_token: Unused in this subclass.
        N)�os�remove)r�key_name�headers�
version_id�	mfa_tokenr	r	r
�
delete_key+szBucket.delete_keycKst|j|j�}t|g�S)z�
        This method returns the single key around which this anonymous Bucket
        was instantiated.

        :rtype: SimpleResultSet
        :return: The result from file system listing the keys requested

        )rrrr)rr�params�keyr	r	r
�get_all_keys;s	
zBucket.get_all_keyscCs2|dkr
t|jdtjd�St|d�}t|j||�S)a
        Check to see if a particular key exists within the bucket.
        Returns: An instance of a Key object or None

        :type key_name: string
        :param key_name: The name of the key to retrieve

        :type version_id: string
        :param version_id: Unused in this subclass.

        :type stream_type: integer
        :param stream_type: Type of the Key - Regular File or input/output Stream

        :rtype: :class:`boto.file.key.Key`
        :returns: A Key object from this bucket.
        �-��key_type�rb)rr�KEY_STREAM_READABLE�open)rrrrr�fpr	r	r
�get_keyGs
zBucket.get_keycCsX|dkr
t|jdtjd�Stj�|�}|r tj�|�s t�|�t|d�}t|j||�S)z�
        Creates a new key

        :type key_name: string
        :param key_name: The name of the key to create

        :rtype: :class:`boto.file.key.Key`
        :returns: An instance of the newly created key object
        rr�wb)	rr�KEY_STREAM_WRITABLEr�path�dirname�exists�makedirsr )rrr�dir_namer!r	r	r
�new_key_s


zBucket.new_key)NNNr)�__name__�
__module__�__qualname__rrrrrr�KEY_REGULAR_FILEr"r*r	r	r	r
rs
�

�r)	r�
boto.file.keyr�boto.file.simpleresultsetr�boto.s3.bucketlistresultsetr�objectrr	r	r	r
�<module>s