
    biY                        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e      Z G d	 d
e      Z G d dee      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Z  G d) d*e      Z!y+),    )AnyOptionalUnion)HfFileSystem   )config)	CastError)TrackedIterableFromGeneratortracked_listtracked_strc                       e Zd ZdZy)DatasetsErrorz*Base class for exceptions in this library.N__name__
__module____qualname____doc__     N/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/datasets/exceptions.pyr   r      s    4r   r   c                       e Zd ZdZy)DefunctDatasetErrorzThe dataset has been defunct.Nr   r   r   r   r   r      s    'r   r   c                       e Zd ZdZy)FileNotFoundDatasetsErrorz)FileNotFoundError raised by this library.Nr   r   r   r   r   r          3r   r   c                       e Zd ZdZy)DataFilesNotFoundErrorz No (supported) data files found.Nr   r   r   r   r   r      s    *r   r   c                       e Zd ZdZy)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      s    r   r   c                       e Zd Zy)DatasetBuildErrorNr   r   r   r   r   r   r!   r!   %       r   r!   c                       e Zd Zy)ManualDownloadErrorNr"   r   r   r   r%   r%   )   r#   r   r%   c                       e Zd Zy)FileFormatErrorNr"   r   r   r   r'   r'   -   r#   r   r'   c                       e Zd Zy)DatasetGenerationErrorNr"   r   r   r   r)   r)   1   r#   r   r)   c                   L    e Zd Zedededeeef   dee	e
ef      dd f
d       Zy)DatasetGenerationCastError
cast_errorbuilder_name
gen_kwargstokenreturnc                 @   d|j                          }g }|j                         D ]J  }t        |t        t        t
        f      s t        |t        t
        f      r;|j                  /|j                  }t        |t        t
        f      r|j                  /t        |t              r|j                         }t        |t              r|j                  d      rt        t        j                  |      j                  |      }d|j                         z   }d|j                  z   |v r1|j!                  d|j                  z   dd      d|j                   dz   }|j#                  t        |             M |r|d	| d
dj%                  |       z  }d}	 | d|z   |	z         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_messages
             r   from_cast_errorz*DatasetGenerationCastError.from_cast_error6   s    TT^TfTfThSij 	 35$#**, 	@Ii+|Ea)bc9|5Q&RSXaXkXkXw%//	 9|5Q&RSXaXkXkXw )[1%002	)S)i.B.B7.K ,f6H6HPU V c cdm n#m&=&=&??	///9<!))#0F0F*FAN*=+A+A*B!DE  )//I?#	@$ (%A,O}  C  H  H  Ie  f  ~g  $h  h cCFYY\hhiir   N)r   r   r   classmethodr	   r;   dictr   r   r   boolrJ   r   r   r   r+   r+   5   sa     j j  j cN	 j
 dCi() j 
& j  jr   r+   c                       e Zd ZdZy)ChecksumVerificationErrorz@Error raised during checksums verifications of downloaded files.Nr   r   r   r   rO   rO   Z   s    Jr   rO   c                       e Zd ZdZy)UnexpectedDownloadedFileErrorz(Some downloaded files were not expected.Nr   r   r   r   rQ   rQ   ^   s    2r   rQ   c                       e Zd ZdZy) ExpectedMoreDownloadedFilesErrorz7Some files were supposed to be downloaded but were not.Nr   r   r   r   rS   rS   b       Ar   rS   c                       e Zd ZdZy)NonMatchingChecksumErrorz?The downloaded file checksum don't match the expected checksum.Nr   r   r   r   rV   rV   f   s    Ir   rV   c                       e Zd ZdZy)SplitsVerificationErrorz)Error raised during splits verifications.Nr   r   r   r   rX   rX   j   r   r   rX   c                       e Zd ZdZy)UnexpectedSplitsErrorz6The expected splits of the downloaded file is missing.Nr   r   r   r   rZ   rZ   n   s    @r   rZ   c                       e Zd ZdZy)ExpectedMoreSplitsErrorz!Some recorded splits are missing.Nr   r   r   r   r\   r\   r   s    +r   r\   c                       e Zd ZdZy)NonMatchingSplitsSizesErrorz7The splits sizes don't match the expected splits sizes.Nr   r   r   r   r^   r^   v   rT   r   r^   N)"typingr   r   r   huggingface_hubr   r4   r   tabler	   utils.trackr
   r   r   	Exceptionr   r   FileNotFoundErrorr   r   r   r!   r%   r'   r)   r+   rO   rQ   rS   rV   rX   rZ   r\   r^   r   r   r   <module>re      s   ( ' (   P P5I 5(- (4/@ 4+6 +4 	 		+ 		' 		. 	"j!7 "jJK K3$= 3B'@ BJ8 J4m 4A3 A,5 ,B"9 Br   