
    +gd`                        d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZ ddlmZ ddlmZ ddlmZmZmZmZmZ ddlmZmZ ddlZddlZddl Z dd	lm!Z! dd
l"m#Z# ddl$m%Z%m&Z& ddl'm(Z( ddl$m)Z) ddl*m+Z+ ddl,m-Z-  e)j.        e/          Z0dZ1 ede2e          Z3dRdeeee2f                  de2fdZ4de2de5fdZ6de2de5fdZ7de2de5fdZ8de3de3fdZ9dSde2d e2de2fd!Z:	 dTde2d e2dee j;        e<f         fd"Z=dUde2d#e2d$ee2         de2fd%Z>d&e2d'e2de2fd(Z?d)e2de2fd*Z@dRd+ZA	 dRde2fd,ZBdRd-eee2eCf                  de2fd.ZDdRd/e2d0eee2e5f                  deCfd1ZE G d2 d3eF          ZGdRd4ee2         fd5ZHdde jI        jJ        ddd6dfd7eeK         d8eeC         d9ee jI        jJ                 d:eeeL                  d;eLd<eMd=eMfd>ZN	 	 	 	 dVd@e2d/e2d;eLd<eMd=eMdAeMde j;        fdBZOdRdCZPdWdDZQdXdEZRdXdFZS	 dYdHZT	 dZde j;        fdIZUdRd/e2d0eee2e5f                  dee2         fdJZV	 	 	 	 	 	 	 	 	 	 	 	 	 d[de2fdLZWdM ZXdN ZYdO ZZdPej[        fdQZ\dS )\z
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
    N)closingcontextmanager)partial)sha256)Path)ListOptionalTypeTypeVarUnion)urljoinurlparse)HfFolder)version   )__version__config)DownloadConfig   )logging)ExtractManager)FileLock.incompleteThf_modules_cachereturnc                    | | nt           j        } t          |           } | t          j        vrt          j                            |            t          j        | d           t          j                            t          j        	                    | d                    sGt          t          j        	                    | d          d          5  	 ddd           n# 1 swxY w Y   | S )z
    Add hf_modules_cache to the python path.
    By default hf_modules_cache='~/.cache/huggingface/modules'.
    It can also be set with the environment variable HF_MODULES_CACHE.
    This is used to add modules such as `datasets_modules`
    NTexist_okz__init__.pyw)r   HF_MODULES_CACHEstrsyspathappendosmakedirsexistsjoinopen)r   s    9lib/python3.11/site-packages/datasets/utils/file_utils.pyinit_hf_modulesr,   -   s    ,<+G''VMd+,,sx''()))
$t4444w~~bgll+;]KKLL 	bgll#3]CCSII                s   CC #C url_or_filenamec                 2    t          |           }|j        dv S )N)httphttpss3gshdfsftp)r   scheme)r-   parseds     r+   is_remote_urlr7   @   s    o&&F=HHH    c                     t          |           j        dk    p3t          j                            t          |           j        dz             S )N z:/)r   r5   r&   r$   ismountr-   s    r+   is_local_pathr=   E   s>     O$$+r1mRW__XoE^E^EehlEl5m5mmr8   c                 r    t          |           j        dk    ot          j                            |            S )Nr:   )r   r5   r&   r$   isabsr<   s    r+   is_relative_pathr@   L   s.    O$$+r1X"'--:X:X6XXr8   r$   c           	         t           j                            t           j                            t           j                            t          |                                         }t          | t                    rt          |          n|S )z'Convert relative path to absolute path.)r&   r$   abspath
expanduser
expandvarsr"   
isinstancer   )r$   abs_path_strs     r+   relative_to_absolute_pathrG   P   s]    7??27#5#5bg6H6HT6S6S#T#TUUL!+D$!7!7I4\Ir8   FT
identifierfilenamec                     |r|rt           j        nt           j        }n|rt           j        nt           j        }d                    || |f          S N/)r   "CLOUDFRONT_DATASETS_DISTRIB_PREFIXS3_DATASETS_BUCKET_PREFIX!CLOUDFRONT_METRICS_DISTRIB_PREFIXS3_METRICS_BUCKET_PREFIXr)   )rH   rI   use_cdndatasetendpoints        r+   hf_bucket_urlrT   V   sP     l@Gm6<<VMm?Fk6;;FLk88Xz84555r8   c                 F    t          t          | |||          |          S )N)rH   rI   rQ   rR   )max_retries)	http_headrT   )rH   rI   rQ   rR   rV   s        r+   
head_hf_s3rX   ^   s3     hY`aaa   r8   namerevisionc                     t          j        t                    j        rdnt          }|p|}|r"t          j                            || |          S t          j                            || |          S )Nmain)rZ   r$   rY   )r   parser   is_devreleaser   REPO_DATASETS_URLformatREPO_METRICS_URL)r$   rY   rR   rZ   default_revisions        r+   hf_github_urlrc   g   sp    !({!;!;!IZvv{++H W'..tRV.WWW&--xdQU-VVVr8   	base_name	pathnamesc                     t          |           rt          j        | gd |D             R  S t          | g|R                                  S )Nc              3      K   | ]D}t          |                              t          j        d                               d           V  EdS rL   N)r"   replacer&   seplstrip).0pathnames     r+   	<genexpr>z#url_or_path_join.<locals>.<genexpr>r   sJ      *t*t^f3x==+@+@+M+M+T+TUX+Y+Y*t*t*t*t*t*tr8   )r7   	posixpathr)   r   as_posix)rd   re   s     r+   url_or_path_joinrq   p   s\    Y 6~iu*t*tjs*t*t*tuuuuI*	***33555r8   url_or_pathc                     t          |           r| d |                     d                   S t          j                            |           S rK   )r7   rindexr&   r$   dirname)rr   s    r+   url_or_path_parentrv   w   sE    [!! ,4[//44455w{+++r8   c                 *   |                      d          }t          |          }|                                }|r>|                     d          }t          |          }|d|                                z   z  }|                     d          r|dz  }|S )a  
    Convert `url` into a hashed filename in a repeatable way.
    If `etag` is specified, append its hash to the url's, delimited
    by a period.
    If the url ends with .h5 (Keras HDF5 weights) adds '.h5' to the name
    so that TF 2.0 can identify it as a HDF5 file
    (see https://github.com/tensorflow/tensorflow/blob/00fad90125b18b80fe054de1055770cfb8fe4ba3/tensorflow/python/keras/engine/network.py#L1380)
    utf-8.z.py)encoder   	hexdigestendswith)urletag	url_bytesurl_hashrI   
etag_bytes	etag_hashs          r+   hash_url_to_filenamer   ~   s     

7##Ii  H!!##H 0[[))
:&&	C)--////
||E EOr8   c                    |t          d	i |}|j        pt          j        }t	          |t
                    rt          |          }t	          | t
                    rt          |           } t          |           rTt          | ||j	        |j
        |j        |j        |j        |j        |j        |j        |j        |j        |j                  }nWt(          j                            |           r| }n5t/          |           rt1          d|  d          t3          d|  d          ||S |j        r/t7          |j                                      ||j                  }|S )
a  
    Given something that might be a URL (or might be a local path),
    determine which. If it's a URL, download the file and cache it, and
    return the path to the cached file. If it's already a local path,
    make sure the file exists and then return the path.

    Return:
        Local path (string)

    Raises:
        FileNotFoundError: in case of non-recoverable file
            (non-existent or no cache on disk)
        ConnectionError: in case of unreachable url
            and no cache on disk
        ValueError: if it couldn't parse the url or filename correctly
        requests.exceptions.ConnectionError: in case of internet connection issue
    N)	cache_dirforce_downloadproxiesresume_download
user_agentlocal_files_onlyuse_etagrV   use_auth_tokenignore_url_paramsstorage_optionsdownload_desczLocal file z doesn't existzunable to parse z as a URL or as a local path)r   )force_extract )r   r   r   DOWNLOADED_DATASETS_PATHrE   r   r"   r7   get_from_cacher   r   r   r   r   r   rV   r   r   r   r   r&   r$   r(   r=   FileNotFoundError
ValueErrorextract_compressed_filer   extractr   )r-   download_configdownload_kwargsr   output_paths        r+   cached_pathr      s   , (;;?;;)LV-LI)T"" #	NN	/4(( /o.._%% [$*9#++;&1,=$-'3*9-?+;)7
 
 
 
	(	( [%		'	' [ Mo M M MNNN YOYYYZZZ. 
$/HIIIQQ'D R 
 
 r8   r   c                 J   dt            }|dt          j         z  }|dt          j          z  }|dt          j         z  }t          j        r|dt          j         z  }t          j        r|dt          j         z  }t          j	        r|dt          j
         z  }t          j        r|dt          j         z  }t          | t                    r8|d	d	                    d
 |                                 D                        z  }nt          | t"                    r|d	| z   z  }|S )Nz	datasets/z	; python/z; huggingface_hub/z
; pyarrow/z; torch/z; tensorflow/z; jax/z; apache_beam/z; c              3   *   K   | ]\  }}| d | V  dS rh   r   )rl   kvs      r+   rn   z*get_datasets_user_agent.<locals>.<genexpr>   s0      GGDAqZZAZZGGGGGGr8   )r   r   
PY_VERSIONhuggingface_hubPYARROW_VERSIONTORCH_AVAILABLETORCH_VERSIONTF_AVAILABLE
TF_VERSIONJAX_AVAILABLEJAX_VERSIONBEAM_AVAILABLEBEAM_VERSIONrE   dictr)   itemsr"   )r   uas     r+   get_datasets_user_agentr      sI   	"[	"	"B
)f'
)
))B
<:
<
<<B
/v-
/
//B 0
/-/// 2
1f/111 ,
+v)+++ 5
4v2444*d##  
I499GGJ4D4D4F4FGGGGGIII	J	$	$  
dZIr8   r}   r   c                     i }|                      t          j                  r<|du rd}n+t          |t                    r|}nt          j                    }|rd| |d<   |S )zHandle the HF authenticationFNzBearer authorization)
startswithr   HF_ENDPOINTrE   r"   r   	get_token)r}   r   headerstokens       r+   "get_authentication_headers_for_urlr      sv    G
~~f()) 	9U""EE,, 	)"EE&((E 	9'8'8'8GO$Nr8   c                       e Zd ZdS )OfflineModeIsEnabledN)__name__
__module____qualname__r   r8   r+   r   r      s        Dr8   r   msgc                 d    t           j        r#t          | dndt          |           z             dS )zaRaise an OfflineModeIsEnabled error (subclass of ConnectionError) if HF_DATASETS_OFFLINE is True.NzOffline mode is enabled.zOffline mode is enabled. )r   HF_DATASETS_OFFLINEr   r"   )r   s    r+   !_raise_if_offline_mode_is_enabledr     sF    ! 
"*-+&&;VY\]`YaYa;a
 
 	

 
r8         ?	func_argsfunc_kwargs
exceptionsstatus_codesrV   base_wait_timemax_wait_timec           	      *   |pd}|pi }d}	 	  | |i |S # |$ rw}	||k    s|r|	j         j        |vr|	t          ||d|z  z            }
t                              |  d|
 d||z   d           t          j        |
           |dz  }Y d }	~	nd }	~	ww xY w)	Nr   r   Tr   z timed out, retrying in zs... []r   )responsestatus_codeminloggerinfotimesleep)funcr   r   r   r   rV   r   r   retryerr
sleep_times              r+   _retryr     s     RI#KE
		42k222 	 	 	###9QYe9e9e	 E0IJJ
tccZccuU`O`cccddd
:&&&
	
s    BA-BB      $@methodtimeoutc           	         t          d|            d\  }}|s|dz  }	 t          j        d|                                 ||d|}	d}n# t          j        j        t          j        j        f$ re}
||k    r|
t                              |  d| d||z   d           t          ||d	|dz
  z  z            }t          j        |           Y d
}
~
nd
}
~
ww xY w||	S )a  Wrapper around requests to retry in case it fails with a ConnectTimeout, with exponential backoff.

    Note that if the environment variable HF_DATASETS_OFFLINE is set to 1, then a OfflineModeIsEnabled error is raised.

    Args:
        method (str): HTTP method, such as 'GET' or 'HEAD'.
        url (str): The URL of the resource to fetch.
        max_retries (int): Maximum number of retries, defaults to 0 (no retries).
        base_wait_time (float): Duration (in seconds) to wait before retrying the first time. Wait time between
            retries then grows exponentially, capped by max_wait_time.
        max_wait_time (float): Maximum amount of time between two retries, in seconds.
        **params (additional keyword arguments): Params to pass to :obj:`requests.request`.
    Tried to reach )r   Fr   )r   r}   r   Tz request to z timed out, retrying... [r   r   Nr   )r   requestsrequestupperr   ConnectTimeoutConnectionErrorr   r   r   r   r   )r   r}   rV   r   r   r   paramstriessuccessr   r   r   s               r+   _request_with_retryr   %  s)   , &&=&=&=>>>NE7 '
		''bv||~~3PWbb[abbHGG#2H4G4WX 	' 	' 	'{""	vee3eeQVWbQbeeefff uqyAQ0QRR

:&&&&&&&&	'  ' Os   )A
 
%C/ACCc                     t          d|             t          j        | |          \  }}}t          |          dk    rt	          d|           |                    |d                   S )Nr   r   r   z=HEAD can be called with at most one path but was called with r   )r   fsspecget_fs_token_pathslenr   r   )r}   r   fs_pathss        r+   fsspec_headr   L  sq    %&=&=&=>>>,S/RRRLB5
5zzA~~`Y^``aaa7758r8   c                 \   t          d|             t          j        | |          \  }}}t          |          dk    rt	          d|           t          j                            |pdt          j                     d          }|	                    |d         |j
        |	           d S )
Nr   r   r   z<GET can be called with at most one path but was called with Downloading)descdisable)tqdm_kwargsr   )callback)r   r   r   r   r   	callbacksTqdmCallbackr   is_progress_bar_enabledget_filerY   )r}   	temp_filer   r   r   r   r   r   s           r+   
fsspec_getr   T  s    %&=&=&=>>>,S/RRRLB5
5zzA~~_X]__```,,)M":<<<
 
 -  H KKa).8K<<<<<r8   c                    t          d|             	 t          t          j                            | |                    5 }|                    d           d d d            n# 1 swxY w Y   n# t          $ r Y dS w xY wdS )Nr   r   r   FT)r   r   urllibr   urlopenread	Exception)r}   r   rs      r+   ftp_headr   b  s    %&=&=&=>>>V^++C+AABB 	aFF1III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   uu4s5   .A0 A$A0 $A((A0 +A(,A0 0
A>=A>c                    t          d|             	 t                              d|  d|j                    t	          t
          j                            | |                    5 }t          j	        ||           d d d            d S # 1 swxY w Y   d S # t
          j
        j        $ r}t          |          d d }~ww xY w)Nr   zGetting through FTP z into r   )r   r   r   rY   r   r   r   r   shutilcopyfileobjerrorURLErrorr   )r}   r   r   r   es        r+   ftp_getr  l  s   %&=&=&=>>>+F3FFinFFGGGV^++C+AABB 	-aq),,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-<  + + +a  d*+s<   AB 'B
=B 
BB BB C +B;;C       Y@c	           
      v   t          j        |          pi }t          |                    d                    |d<   |dk    r
d|dd|d<   t	          d| d	|||||
          }	|	j        dk    rd S |	j                            d          }
|
|t          |
          z   nd }t          j	        dd	|||pdt          j
                               5 }|	                    d          D ]9}|                    t          |                     |                    |           :	 d d d            d S # 1 swxY w Y   d S )N
user-agentr   r   zbytes=d-RangeGETT)r   r}   streamr   r   cookiesrV   r   i  zContent-LengthBr   )unit
unit_scaletotalinitialr   r   i   )
chunk_size)copydeepcopyr   getr   r   r   intr   tqdmr   iter_contentupdater   write)r}   r   r   resume_sizer   r  r   rV   r   r   content_lengthr  progresschunks                 r+   http_getr#  v  s    mG$$*G3w{{<?X?XYYYGLQ4K4444"	 	 	H s""%))*:;;N1?1KK#n----QUE	"]3555
 
 
 
# 
**d*;; 	# 	#EOOCJJ'''OOE""""	#
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
# 
#s   AD..D25D2c           
          t          j        |          pi }t          |                    d                    |d<   t	          d| ||||||          }|S )Nr	  r
  HEAD)r   r}   r   r   r  allow_redirectsr   rV   )r  r  r   r  r   )r}   r   r   r  r&  r   rV   r   s           r+   rW   rW     sl     mG$$*G3w{{<?X?XYYYGL"'	 	 	H Or8   c                     t          |           j        dvrd S t          | |          }t          | |d          }|                                 |j        r|j                            d          nd }|S )Nr/   r0   r      )r   rV   ETag)r   r5   r   rW   raise_for_statusokr   r  )r}   r   r   r   r~   s        r+   request_etagr.    s{    }}#444t0^TTTGg1===H+3;@8'''DDKr8   d   c                   $ |t           j        }t          |t                    rt	          |          }t          j        |d           |r#t          | t          |           j	                  }n| }d}d}d}d}d}d}t          |d          }t
          j	                            ||          }t
          j	                            |          r|s|s|S t          | |
          }|||d<   |st          |           j        }|dk    rt          |           }nG|d	vrCt!          | |
          }|r,|                    dd          p|                    dd          nd}d}	 t%          | d|||	|          }|j        dk    ru|r|j                            d          nd}|j                                        D ]-\  }}|                    d          rd| v r| d|z   z  } |j        }.d}d| v r	d| vr| dz  } n|j        dk    rd| v sX|j        dk    rd| v sI|j        dk    r/t1          j        d|           s)t1          j        d|j                  s|j        dk    r$d| v r d}t6                              d|             n.|j        dk    r#t           j        | v r|
t=          d|  d          n*# t>          t@          j!        j"        f$ r}|}Y d}~nd}~ww xY w|st
          j	                            |          r|s|S |rtG          d| d           ||j        d!k    rtG          d"|            tI          d#|             |#t=          d$|  d%tK          |           d&          |t=          d$|  d'|j         d&          t=          d$|            t          ||          }t
          j	                            ||          }t
          j	                            |          r|s|S |d(z   }tM          |          5  |rU|d)z   $tN          $fd*            }|}t
          j	                            $          rt          j(        $          j)        }n!d+}ntU          tV          j,        |d,          }d+} |            5 }t6                              |  d-|j-                    |dk    rt]          | |           n/|d	vrt_          | |||.           nta          | ||||||	|/           ddd           n# 1 swxY w Y   t6                              d0|  d1|            tc          j2        |j-        |           t          j3        d2          } t          j3        |            t          j4        |d2|  z             t6                              d3|            | |d4}!|d5z   }"tk          |"d6d78          5 }#tm          j7        |!|#           ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   |S )9a  
    Given a URL, look for the corresponding file in the local cache.
    If it's not there, download it. Then return the path to the cached file.

    Return:
        Local path (string)

    Raises:
        FileNotFoundError: in case of non-recoverable file
            (non-existent or no cache on disk)
        ConnectionError: in case of unreachable url
            and no cache on disk
    NTr   F)r~   r)  r	  r4   r(  r   r+  r~   )r&  r   r   rV   r      download_warningzdrive.google.comz	&confirm=zconfirm=z
&confirm=ti  zfirebasestorage.googleapis.comi  i  z7^https?://github.com/.*?/.*?/releases/download/.*?/.*?$z#^https://.*?s3.*?amazonaws.com/.*?$zndownloader.figstatic.comz"Couldn't get ETag version for url i  zUnauthorized for URL z^. Please use the parameter `use_auth_token=True` after logging in with `huggingface-cli login`z6Cannot find the requested files in the cached path at zi and outgoing traffic has been disabled. To enable file online look-ups, set 'local_files_only' to False.i  zCouldn't find file at r   zCouldn't reach z ()z (error z.lockr   c               3   f   K   t          d          5 } | V  d d d            d S # 1 swxY w Y   d S )Nza+b)r*   )fincomplete_paths    r+   _resumable_file_managerz/get_from_cache.<locals>._resumable_file_managerJ  s      /511 QGGG                 s   &**r   )dirdeletezB not found in cache or force_download set to True, downloading to )r   r   )r   r  r   r  rV   r   zstoring z in cache at i  zcreating metadata file for )r}   r~   z.jsonr    rx   )encoding)8r   HF_DATASETS_CACHErE   r   r"   r&   r'   r   r   r$   r   r)   r(   r   r5   r   r   r  rW   r   r   r  r   r   rematchr}   r   r   r   r   OSErrorr   r   Timeoutr   r   reprr   r   statst_sizer   tempfileNamedTemporaryFilerY   r  r   r#  r  moveumaskchmodr*   jsondump)%r}   r   r   r   etag_timeoutr   r   r   r   rV   r   r   r   r   
cached_url	connectedr   r  r~   
head_errorr5   rI   
cache_pathr   r   r   r  	lock_pathr7  temp_file_managerr  r   rF  meta	meta_path	meta_filer6  s%                                       @r+   r   r     s   : ,	)T"" #	NN	K	D)))) S(3--"455


IHGDJF $JT:::Hi22J	w~~j!! .   1^TTTG *  3#%U?? II,,,"3HHHHQYcHLL..L(,,vt2L2L_cDI*	  $$'  H #s**7?Ix'++F333T$,2244 3 3DAq||$677 3<NRU<U<U{Q."*"2 	%,,31F1F<'C %,,1QUX1X1X(C//4F#4M4M(C//![]`aa 0 8$JHLYY 0 (C//4OSV4V4V 	FFFGGGG%,,1Cs1J1J~Oe% PC  P  P  P   ,45 	 	 	JDDDD	  ;7>>*%% 	n 	 	D#^ ^ ^ ^   !h&:c&A&A#$BS$B$BCCC)*AC*A*ABBB!!"NC"N"N4
;K;K"N"N"NOOO!!"XC"X"XAU"X"X"XYYY!"9C"9"9::: $J55Hi22J	w~~j!! .  W$I	)		 2' 2' 	(=8O    ^ !8w~~o..   go66> '(C[` a a aK    	IKK3rrbkbprrsss Y''''0003	?Q^_____# +## +&	 	 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	( 	=s====>>>INJ///

UeV^,,,>*>>???D))(	)S7333 	'yIdI&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'c2' 2' 2' 2' 2' 2' 2' 2' 2' 2' 2' 2' 2' 2' 2'h sv    E
J+ +KKK;B W*;A+S2&W*2S6	6W*9S6	:B7W*1WW*W	W*W	W**W.1W.c                        fd}|S )Nc                 d    d                               dz   | j        | j        ndz   | _        | S Nr:   z

)r)   __doc__fndocstrs    r+   docstring_decoratorz1add_start_docstrings.<locals>.docstring_decorator~  s1    WWV__v-rz?U[]^
	r8   r   rZ  r[  s   ` r+   add_start_docstringsr]  }  $         r8   c                        fd}|S )Nc                 d    | j         | j         nddz   d                              z   | _         | S rV  )rW  r)   rX  s    r+   r[  z/add_end_docstrings.<locals>.docstring_decorator  s1    $&J$:bjjfLrwwW]^
	r8   r   r\  s   ` r+   add_end_docstringsra    r^  r8   c                 4    t          d | D                       S )Nc              3   H   K   | ]}|                                 j        V  d S N)rA  rB  )rl   r$   s     r+   rn   z(estimate_dataset_size.<locals>.<genexpr>  s-      55ttyy{{"555555r8   )sum)r   s    r+   estimate_dataset_sizerf    s    55u555555r8   r5  c                     t                      }	 |                     d          }|sn||z  }|                    d          rn4t          |          S )NTr      
)	bytearrayr   r|   bytes)r5  resbs      r+   readlinerm    s]    
++CFF1II 	q<< 	 ::r8   rd  )FT)FTr   )TN)r   r   r   r   )NN)r   )Nr   NNr  r   N)NNNTr   r   )NFNr/  FNFTr   NFNN)]rW  r  iorH  r&   ro   r<  r  r#   rC  r   r   
contextlibr   r   	functoolsr   hashlibr   pathlibr   typingr   r	   r
   r   r   urllib.parser   r   r   r   r   r   	packagingr   r:   r   r   download.download_configr   r   r   r   filelockr   
get_loggerr   r   INCOMPLETE_SUFFIXr"   r   r,   boolr7   r=   r@   rG   rT   Responser   rX   rc   rq   rv   r   r   r   r   r   r   r   r   r   RequestExceptiontupler  floatr   r   r   r   r   r  r#  rW   r.  r   r]  ra  rf  	RawIOBaserm  r   r8   r+   <module>r     s7     				  				     				  



    . . . . . . . .                   7 7 7 7 7 7 7 7 7 7 7 7 7 7 * * * * * * * *       $ $ $ $ $ $       " " " " " " " " 5 5 5 5 5 5       # # # # # #       
	H	%	%! GCd huT3Y/?&@ C    &I3 I4 I I I I
n3 n4 n n n nYc Yd Y Y Y YJA J! J J J J6 6c 6S 6RU 6 6 6 6 NO "
8i'(   W W W3 W WY\ W W W W6 6 6 6 6 6 6,C ,C , , , ,   4 B B 		B B B BJ sDy1A(B c    ( C %PSUYPYJZA[ gk     	 	 	 	 	? 	 	 	
 
8C= 
 
 
 
 "&"&=E=P=a(,  $ X(9:	
 49%      : $ $$	$ $ 	$
 $ $ $ $ $ $N   = = = =   + + + + qu# # # #F de    $ c 8E#t)4D+E QYZ]Q^     F F 	F F F FR    6 6 6
 
 
 
 
 
 
r8   