
    Mi	              	           S SK r S SKrS SKrS SKJr  S SKJrJrJrJ	r	J
r
  S SKJr  \(       a  S SKJr  S\S\
\S4   S	S4S
 jrSS.S\
\S4   S\S\S	S4S jjrS\S	\	\\\4      4S jrg)    N)Path)TYPE_CHECKINGAnyDictOptionalUnion)msg)	CloudPathsrcdestr
   returnc                 
   SSK n[        U[        5      (       a8  UR                  R	                  5       (       d  UR                  R                  SS9  [        U5      nUR                  S5      (       a  UR                  SSS5      n[        U5      nUR                  US	US
9 nU R                  SS9 nUR                  UR                  5       5        SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)zZUpload a file.

src (Path): The source path.
url (str): The destination URL to upload to.
r   NT)parentsaz://azazure   wb)modetransport_paramsrbr   )
smart_open
isinstancer   parentexistsmkdirstr
startswithreplace_transport_paramsopenwriteread)r   r   r   r   output_file
input_files         l/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/weasel/util/remote.pyupload_filer(      s      ${{!!##KKd+t9Dw||D'1-(.	4*: 
 
	XX4X Jjoo/0 !
 
 ! 
 
s$   "C42 C#C4#
C1	-C44
DF)forcer)   c                   SSK nUR                  5       (       a  U(       d  g[        U 5      n U R                  S5      (       a  U R	                  SSS5      n [        U 5      nUR                  U SSUS	9 nUR                  S
S9 n[        R                  " XV5        SSS5        SSS5        g! , (       d  f       N= f! , (       d  f       g= f)zDownload a file using smart_open.

url (str): The URL of the file.
dest (Path): The destination path.
force (bool): Whether to force download even if file exists.
    If False, the download will be skipped.
r   Nr   r   r   r   r   disable)r   compressionr   r   r   )	r   r   r   r   r    r!   r"   shutilcopyfileobj)r   r   r)   r   r   r&   r%   s          r'   download_filer/   %   s     {{}}U
c(C
~~gkk$+(-	$I@P 
 
	YYDY![z7 "
 
 "!
 
s$   3B<B+B<+
B9	5B<<
C
urlc                    U R                  S5      (       al  [        R                  R                  S5      nU(       d-  [        R
                  " SS5        [        R                  " S5        SSKJ	n  SUR                  U5      0$ g )	Nzazure://AZURE_STORAGE_CONNECTION_STRINGzCAzure storage requires a connection string, which was not provided.zFAssign it to the environment variable AZURE_STORAGE_CONNECTION_STRING.r   r   )BlobServiceClientclient)r   osenvirongetr	   failsysexitazure.storage.blobr3   from_connection_string)r0   connection_stringr3   s      r'   r!   r!   >   se    
~~j!!JJNN+LM HHUX HHQK8+BBCTUVV    )r5   r-   r9   pathlibr   typingr   r   r   r   r   wasabir	   cloudpathlibr
   r   r(   boolr/   r!    r>   r'   <module>rE      s    	  
  < < &1T 1sK'7!8 1T 12 @E8	sK	 8(,88<8	823 8DcN#; r>   