o
    TZh                     @   sj   d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	m
Z
mZmZ ddlmZ eG dd dZdS )	    N)InitVar	dataclassfield)Path)AnyDictOptionalUnion   )configc                       sF  e Zd ZU dZdZeeeef  e	d< dZ
ee	d< dZee	d< dZee	d< dZee e	d< dZee e	d	< dZee	d
< dZee	d< dZee	d< dZee	d< dZee e	d< dZee	d< dZeeeef  e	d< dZeeeeef   e	d< dZee	d< eedZeeef e	d< dZ ee e	d< dd Z!d ddZ" fddZ#  Z$S )!DownloadConfiga
  Configuration for our cached path manager.

    Attributes:
        cache_dir (`str` or `Path`, *optional*):
            Specify a cache directory to save the file to (overwrite the
            default cache dir).
        force_download (`bool`, defaults to `False`):
            If `True`, re-dowload the file even if it's already cached in
            the cache dir.
        resume_download (`bool`, defaults to `False`):
            If `True`, resume the download if an incompletely received file is
            found.
        proxies (`dict`, *optional*):
        user_agent (`str`, *optional*):
            Optional string or dict that will be appended to the user-agent on remote
            requests.
        extract_compressed_file (`bool`, defaults to `False`):
            If `True` and the path point to a zip or tar file,
            extract the compressed file in a folder along the archive.
        force_extract (`bool`, defaults to `False`):
            If `True` when `extract_compressed_file` is `True` and the archive
            was already extracted, re-extract the archive and override the folder where it was extracted.
        delete_extracted (`bool`, defaults to `False`):
            Whether to delete (or keep) the extracted files.
        use_etag (`bool`, defaults to `True`):
            Whether to use the ETag HTTP response header to validate the cached files.
        num_proc (`int`, *optional*):
            The number of processes to launch to download the files in parallel.
        max_retries (`int`, default to `1`):
            The number of times to retry an HTTP request if it fails.
        token (`str` or `bool`, *optional*):
            Optional string or boolean to use as Bearer token
            for remote files on the Datasets Hub. If `True`, or not specified, will get token from `~/.huggingface`.
        use_auth_token (`str` or `bool`, *optional*):
            Optional string or boolean to use as Bearer token
            for remote files on the Datasets Hub. If `True`, or not specified, will get token from `~/.huggingface`.

            <Deprecated version="2.14.0">

            `use_auth_token` was deprecated in favor of `token` in version 2.14.0 and will be removed in 3.0.0.

            </Deprecated>

        ignore_url_params (`bool`, defaults to `False`):
            Whether to strip all query parameters and fragments from
            the download URL before using it for caching the file.
        storage_options (`dict`, *optional*):
            Key/value pairs to be passed on to the dataset file-system backend, if any.
        download_desc (`str`, *optional*):
            A description to be displayed alongside with the progress bar while downloading the files.
    N	cache_dirFforce_downloadresume_downloadlocal_files_onlyproxies
user_agentextract_compressed_fileforce_extractdelete_extractedTuse_etagnum_proc   max_retriestoken
deprecateduse_auth_tokenignore_url_params)default_factorystorage_optionsdownload_descc                 C   sH   |dkrt d| dt || _d| jvr"| jtjd| jd< d S d S )Nr   z'use_auth_token' was deprecated in favor of 'token' in version 2.14.0 and will be removed in 3.0.0.
You can remove this warning by passing 'token=z
' instead.hfr   Zendpoint)warningswarnFutureWarningr   r   r   HF_ENDPOINT)selfr    r(   X/var/www/html/lang_env/lib/python3.10/site-packages/datasets/download/download_config.py__post_init__R   s   
zDownloadConfig.__post_init__returnc                 C   s    | j di dd | j D S )Nc                 S   s   i | ]
\}}|t |qS r(   )copydeepcopy).0kvr(   r(   r)   
<dictcomp>^   s    z'DownloadConfig.copy.<locals>.<dictcomp>r(   )	__class____dict__items)r'   r(   r(   r)   r,   ]   s    zDownloadConfig.copyc                    sl   |dkr-t | dd d ur-d| jvr|tjd| jd< nt | jd dd d u r-|| jd d< t || d S )Nr   r   r!   r"   )getattrr   r   r&   super__setattr__)r'   namevaluer2   r(   r)   r7   `   s   
zDownloadConfig.__setattr__)r+   r   )%__name__
__module____qualname____doc__r   r   r	   strr   __annotations__r   boolr   r   r   r   r   r   r   r   r   r   intr   r   r   r   r   r   dictr   r   r    r*   r,   r7   __classcell__r(   r(   r:   r)   r   
   s,   
 4
r   )r,   r#   dataclassesr   r   r   pathlibr   typingr   r   r   r	    r   r   r(   r(   r(   r)   <module>   s    