o
    8wiY                     @   sr  d dl mZ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 G dd deZG d	d
 d
eZG dd deeZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd  d eZG d!d" d"eZG d#d$ d$eZG d%d& d&eZG d'd( d(eZ G d)d* d*eZ!d+S ),    )AnyOptionalUnion)HfFileSystem   )config)	CastError)TrackedIterableFromGeneratortracked_listtracked_strc                   @      e Zd ZdZdS )DatasetsErrorz*Base class for exceptions in this library.N__name__
__module____qualname____doc__ r   r   P/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/datasets/exceptions.pyr          r   c                   @   r   )DefunctDatasetErrorzThe dataset has been defunct.Nr   r   r   r   r   r      r   r   c                   @   r   )FileNotFoundDatasetsErrorz)FileNotFoundError raised by this library.Nr   r   r   r   r   r      r   r   c                   @   r   )DataFilesNotFoundErrorz No (supported) data files found.Nr   r   r   r   r   r      r   r   c                   @   r   )DatasetNotFoundErrorzDataset not found.

    Raised when trying to access:
    - a missing dataset, or
    - a private/gated dataset and the user is not authenticated.
    Nr   r   r   r   r   r      r   r   c                   @      e Zd ZdS )DatasetBuildErrorNr   r   r   r   r   r   r   r   %       r   c                   @   r   )ManualDownloadErrorNr   r   r   r   r   r   )   r   r   c                   @   r   )FileFormatErrorNr   r   r   r   r   r   -   r   r   c                   @   r   )DatasetGenerationErrorNr   r   r   r   r   r    1   r   r    c                   @   sB   e Zd Zedededeeef dee	e
ef  dd f
ddZdS )	DatasetGenerationCastError
cast_errorbuilder_name
gen_kwargstokenreturnc           
      C   s  d|   }g }| D ]h}t|tttfsqt|ttfr3|jd ur3|j}t|ttfr3|jd us$t|tr<| }t|trn|	drnt
tj|d|}d|  }d|j |v rn|d|j ddd|j d }|t| q|r|d	| d
d| 7 }d}	| d| |	 S )NzC

All the data files must have the same columns, but at some point zhf://)endpointr%   @ r   z (at revision )z

This happened while the z, dataset builder was generating data using

z, z

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)z.An error occurred while generating the dataset)detailsvalues
isinstancer   r
   r	   	last_item
get_originstr
startswithr   r   HF_ENDPOINTresolve_path	unresolverevisionreplaceappendjoin)
clsr"   r#   r$   r%   explanation_messageformatted_tracked_gen_kwargs	gen_kwargresolved_pathhelp_messager   r   r   from_cast_error6   s8   	


z*DatasetGenerationCastError.from_cast_errorN)r   r   r   classmethodr   r0   dictr   r   r   boolr?   r   r   r   r   r!   5   s    
r!   c                   @   r   )ChecksumVerificationErrorz@Error raised during checksums verifications of downloaded files.Nr   r   r   r   r   rC   Z   r   rC   c                   @   r   )UnexpectedDownloadedFileErrorz(Some downloaded files were not expected.Nr   r   r   r   r   rD   ^   r   rD   c                   @   r   ) ExpectedMoreDownloadedFilesErrorz7Some files were supposed to be downloaded but were not.Nr   r   r   r   r   rE   b   r   rE   c                   @   r   )NonMatchingChecksumErrorz?The downloaded file checksum don't match the expected checksum.Nr   r   r   r   r   rF   f   r   rF   c                   @   r   )SplitsVerificationErrorz)Error raised during splits verifications.Nr   r   r   r   r   rG   j   r   rG   c                   @   r   )UnexpectedSplitsErrorz6The expected splits of the downloaded file is missing.Nr   r   r   r   r   rH   n   r   rH   c                   @   r   )ExpectedMoreSplitsErrorz!Some recorded splits are missing.Nr   r   r   r   r   rI   r   r   rI   c                   @   r   )NonMatchingSplitsSizesErrorz7The splits sizes don't match the expected splits sizes.Nr   r   r   r   r   rJ   v   r   rJ   N)"typingr   r   r   huggingface_hubr   r)   r   tabler   utils.trackr	   r
   r   	Exceptionr   r   FileNotFoundErrorr   r   r   r   r   r   r    r!   rC   rD   rE   rF   rG   rH   rI   rJ   r   r   r   r   <module>   s.   	%