
    h                         S SK r S SKrS SKJr  S SKJr  S SKJr  S SKrS SK	J
r
  \R                  " \5      rS rS rSS jrS S	KJr  \  SS
S.S\S\S\\\4   S\S\4
S jjj5       rg)    N)PathLike)Path)Uniondownload_url_to_filec                     [        [        R                  R                  5       5      S-  [        U 5      -  nUR                  R                  SSS9  U$ )N
torchaudioT)parentsexist_ok)r   torchhubget_dirparentmkdir)keypaths     Q/var/www/auris/envauris/lib/python3.13/site-packages/torchaudio/utils/download.py_get_local_pathr      sC    		!!#$|3d3i?DKKdT2K    c                 "    SU  3n[        X1US9  g )Nz(https://download.pytorch.org/torchaudio/progressr   )r   r   r   urls       r   	_downloadr      s    4SE
:CX6r   c                 <   [         R                  " 5       n[        U S5       nUR                  U5      nU(       a+  UR	                  U5        UR                  U5      nU(       a  M+  S S S 5        UR                  5       $ ! , (       d  f       UR                  5       $ = f)Nrb)hashlibsha256openreadupdate	hexdigest)r   hash
chunk_sizemfiledatas         r   	_get_hashr(      su    A	dD	Tyy$HHTN99Z(D d 

 ;;= 
	
 ;;=s   AA>>
B)dropping_supportTr   r   r#   r   r   returnc          	         U=(       d    [        U 5      nUR                  5       (       a  [        R                  SU5        O [        R                  SX5        [	        XUS9  U(       aO  [        R                  S5        [        X!5      nXA:w  a  [        SU SU SU S35      e[        R                  S	5        [        U5      $ )
a  Download and store torchaudio assets to local file system.

If a file exists at the download path, then that path is returned with or without
hash validation.

Args:
    key (str): The asset identifier.
    hash (str, optional):
        The value of SHA256 hash of the asset. If provided, it is used to verify
        the downloaded / cached object. If not provided, then no hash validation
        is performed. This means if a file exists at the download path, then the path
        is returned as-is without verifying the identity of the file.
    path (path-like object, optional):
        By default, the downloaded asset is saved in a directory under
        :py:func:`torch.hub.get_dir` and intermediate directories based on the given `key`
        are created.
        This argument can be used to overwrite the target location.
        When this argument is provided, all the intermediate directories have to be
        created beforehand.
    progress (bool): Whether to show progress bar for downloading. Default: ``True``.

Note:
    Currently the valid key values are the route on ``download.pytorch.org/torchaudio``,
    but this is an implementation detail.

Returns:
    str: The path to the asset on the local file system.
z2The local file (%s) exists. Skipping the download.zDownloading %s to %sr   zVerifying the hash value.z'The hash value of the downloaded file (z), 'z+' does not match the provided hash value, 'z'.zHash validated.)r   exists_LGinfor   r(   
ValueErrorstr)r   r#   r   r   digests        r   download_assetr2   #   s    H '?3'D{{}}EtL'3#h/,-4&>9$tF8 L--1F"6 
 	"#t9r   )i  ) r3   )r   loggingosr   pathlibr   typingr   r   torchaudio._internalr   	getLogger__name__r-   r   r   r(   !torchaudio._internal.module_utilsr)   r0   boolr2    r   r   <module>r>      s          5!7
 ? !#7
 7	7
7 X
7
 7 	7 7r   