
    h                         S r SSKrSSKr SSKrSSKrSSKrSSK	r
SSKr
SSK
Jr  \R                  " \5      rSr Sr SS0rS rS	 rS
 rS\SSSS4S jr     SS jr    SS jrg! \ a    Sr N\f = f)zAImplements file-like objects for reading and writing to/from GCS.    NT)	constantsgsi   ignore_flushc                     [         R                  R                  U 5      nUR                  [        :X  d   eUR
                  nUR                  R                  S5      n[        [        X#S9$ )N/)scheme	bucket_idblob_id)	
smart_openutilssafe_urlsplitr   SCHEMEnetlocpathlstripdict)uri_as_stringsrr	   r
   s       H/home/james-whalen/.local/lib/python3.13/site-packages/smart_open/gcs.py	parse_urir   $   sR    				'	'	6B99		IggnnS!GvDD    c                     [        U 5      n[        R                  R                  [        U5      n[	        US   US   U40 UD6$ )Nr	   r
   )r   r   r   check_kwargsopen)urimodetransport_params
parsed_urikwargss        r   open_urir    ,   sB    3J**41ABF
;'I)>OOOr   c                 F    SU  S3n[         R                  " U[        5        g )Nz
Parameter z7 is deprecated, this parameter no-longer has any effect)warningswarnUserWarning)parameter_namemessages     r   warn_deprecatedr'   2   s     >**abGMM';'r   c	           	          Uc  0 nUb  [        S5        U[        R                  SS4;   a  [        U UUUUS9n	U	$ U[        R                  SS4;   a  [        U UUUUUS9n	U	$ [        SU S	35      e)
a  Open an GCS blob for reading or writing.

Parameters
----------
bucket_id: str
    The name of the bucket this object resides in.
blob_id: str
    The name of the blob within the bucket.
mode: str
    The mode for opening the object. Must be either "rb" or "wb".
buffer_size:
    deprecated
min_part_size: int, optional
    The minimum part size for multipart uploads. For writing only.
client: google.cloud.storage.Client, optional
    The GCS client to use when working with google-cloud-storage.
get_blob_kwargs: dict, optional
    Additional keyword arguments to propagate to the bucket.get_blob
    method of the google-cloud-storage library. For reading only.
blob_properties: dict, optional
    Set properties on blob before writing. For writing only.
blob_open_kwargs: dict, optional
    Additional keyword arguments to propagate to the blob.open method
    of the google-cloud-storage library.

buffer_sizerrt)bucketkeyclientget_blob_kwargsblob_open_kwargswwt)r,   blobmin_part_sizer.   blob_propertiesr0   zGCS support for mode z not implemented)r'   r   READ_BINARYReaderWRITE_BINARYWriterNotImplementedError)
r	   r
   r   r)   r4   r.   r/   r5   r0   _blobs
             r   r   r   7   s    J &	%%sD11i"$'6(8	:" L 
)((#t4	4i#%2$'6(8: L "$9$?O"PQQr   c                 t   Uc  0 nUc  0 nUc(  [         R                  R                  R                  5       nUb  [	        S5        Ub  [	        S5        UR                  U 5      nUR                  " U40 UD6nUc/  [         R                  R                  R                  SU SU  35      eUR                  " S0 UD6$ )Nr)   line_terminatorzblob z not found in )rb)
googlecloudstorageClientr'   r,   get_blob
exceptionsNotFoundr   )	r,   r-   r)   r=   r.   r/   r0   bktr3   s	            r   r7   r7   w   s     ~%%,,.&")*
--
C<<//D|ll%%..se>&/RSS99.-..r   c                 @   Uc  0 nUc  0 nUc(  [         R                  R                  R                  5       n0 [        EUEnUR                  U 5      R                  UUS9nUR                  5        H  u  px[        XgU5        M     UR                  " S0 UD6n	S U	l
        U	$ )N)
chunk_sizec                      g )N rJ   r   r   <lambda>Writer.<locals>.<lambda>   s    dr   )wb)r?   r@   rA   rB   _DEFAULT_WRITE_OPEN_KWARGSr,   r3   itemssetattrr   	terminate)
r,   r3   r4   r.   r5   r0   g_blobkvr;   s
             r   r9   r9      s     ~%%,,.I4I8HI]]6"''  ( F
  %%'1 ( KK1 01E #EOLr   )NNNNN)NNNN)__doc__loggingr"   google.cloud.exceptionsr?   google.cloud.storagegoogle.auth.transport.requestsImportErrorMISSING_DEPSsmart_open.bytebufferr   smart_open.utilsr   	getLogger__name__loggerr   _DEFAULT_MIN_PART_SIZErN   r   r    r'   r   r7   r9   rJ   r   r   <module>rb      s    H  ")    			8	$	 %  9,d3 EP( (=D  /<  E  Ls   A* *A54A5