
    ϶vg#                        d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 g dZ
dZ ee          j        ZefddZedfddZddZddZdS )    )annotationsN)Path)	HTTPError)urlopen)DOWNLOAD_DIRretrieve_fileoutput_fileurls_from_file)zhttp://zhttps://zgithub.com/z/raw/urlstrdownload_dirr   returnc                    |                                  }t          D ]O}|                    |d                                                                d                                           }Pt          |t	          j        dd|                    S )N z/:z[^\-_\.\w\d]+_)stripNAME_REMOVEreplacer   resub)r   r   	file_nameparts       g/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/tests/config/downloads/__init__.pyr	   r	      s|    		I L L%%dB//5577==dCCIIKK		bf%5sIFFGGG       waitfloatc                `   t          | |          }|                                rt          d|  d| d           nr|                    dd           t          d|  d|            	 t	          | |           n4# t
          $ r' t          j        |           t	          | |           Y nw xY w|S )Nz	Skipping z (already exists: )T)exist_okparentszDownloading z to )r	   existsprintmkdirdownloadr   timesleep)r   r   r   paths       r   r   r      s    sL))D{{}} 	 8#888889999D$777,S,,d,,---	 S$ 	  	  	 JtS$	  Ks   )A: :.B+*B+	list_file	list[str]c                    t          d|             |                     d          }d |                                D             S )z^``list_file`` should be a text file where each line corresponds to a URL to
    download.
    zfile: zutf-8)encodingc                <    g | ]}|                     d           |S )#)
startswith).0r   s     r   
<listcomp>z"urls_from_file.<locals>.<listcomp>1   s)    KKKCs~~c7J7JKCKKKr   )r#   	read_text
splitlines)r)   contents     r   r
   r
   +   sQ     

9

!!7!33GKK7--//KKKKr   destc                <   t          |           5 }|                                }d d d            n# 1 swxY w Y   t          |d          5 }|                    |           d d d            n# 1 swxY w Y   t	          |                                          sJ d S )Nwb)r   readopenwriter   r"   )r   r5   fdatas       r   r%   r%   4   s   	 vvxx               
dD		 Q	               ::s   155A..A25A2)r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r)   r   r   r*   )r   r   r5   r   )
__future__r   r   r&   pathlibr   urllib.errorr   urllib.requestr   __all__r   __file__parentr   r	   r   r
   r%    r   r   <module>rE      s    " " " " " " 				        " " " " " " " " " " " "
L
L
L >tH~~$ 0< H H H H H 2>Q     L L L L     r   