
    h$              	       p   % S SK JrJrJrJr  SSKJr  SSKJr  SSK	J
r
JrJrJrJrJrJrJrJr  SSKJr  \R*                  " \5      r0 r\\\   \\   4   \S'   0 r\\\   \4   \S	'   0 r\\\   \4   \S
'    S/S\S\\   S\\ \      4S jjr! S/S\S\\   S\\ \      4S jjr"\!" \SS/S9  \!" \
SSS/S9  \!" \SS/S9  \!" \SS/S9  \!" \S5        \RF                  (       a  SSK$J%r%  \!" \%SS/S9  O\&" S5      r'\"" \'SS/S9  \RP                  (       a  SS K)J*r*  \!" \*S!S"S#/S9  O\&" S$5      r+\"" \+S!S"S#/S9  \RX                  (       a  SS%K-J.r.  \!" \.S&S'/S9  O\&" S(5      r/\"" \/S&S'/S9  \R`                  (       a  SS)K1J2r2  \!" \2S*/ S9  O\&" S+5      r3\"" \3S*/ S9  S\\   S,\\   4S- jr4S\\   S,\4S. jr5g)0    )DictListOptionalType   )config)logging   )	ArrowFormatterCustomFormatter	FormatterPandasFormatterPythonFormatterTableFormatterTensorFormatterformat_tablequery_table)NumpyFormatter_FORMAT_TYPES_FORMAT_TYPES_ALIASES!_FORMAT_TYPES_ALIASES_UNAVAILABLENformatter_clsformat_typealiasesc           
      H   Ub  UO/ nU[         ;   a:  [        R                  SU S[         U   R                   SU R                   S35        U [         U'   [	        X!/-   5       H<  nU[
        ;   a&  [        R                  SU S[
        U    SU S35        U[
        U'   M>     g)zq
Register a Formatter object using a name and optional aliases.
This function must be used on a Formatter class.
NzOverwriting format type 'z' (z -> )zOverwriting format type alias ')r   loggerwarning__name__setr   )r   r   r   aliass       V/home/james-whalen/.local/lib/python3.13/site-packages/datasets/formatting/__init__.py_register_formatterr#   (   s     !,g"Gm#'}Ck8R8[8[7\\`anawaw`xxyz	
 "/M+W},-))NN1%<QRW<X;YY]^i]jjkl (3e$ .    unavailable_errorc                 N    Ub  UO/ n[        X!/-   5       H  nU [        U'   M     g)z
Register an unavailable Formatter object using a name and optional aliases.
This function must be used on an Exception object that is raised when trying to get the unavailable formatter.
N)r    r   )r%   r   r   r!   s       r"   _register_unavailable_formatterr'   ?   s/     !,g"GW},-3D)%0 .r$   python)r   arrowpapyarrownumpynppandaspdcustom)PolarsFormatterpolarsplzDPolars needs to be installed to be able to return Polars dataframes.)TorchFormattertorchptpytorchzCPyTorch needs to be installed to be able to return PyTorch tensors.)TFFormatter
tensorflowtfzITensorflow needs to be installed to be able to return Tensorflow tensors.)JaxFormatterjaxz:JAX needs to be installed to be able to return JAX arrays.returnc                 ,    U [         ;   a	  [         U    $ U $ )ztIf the given format type is a known alias, then return its main type name. Otherwise return the type with no change.)r   )r   s    r"   get_format_type_from_aliasr?   s   s    ++$[11r$   c                     [        U 5      n U [        ;   a  [        U    " S0 UD6$ U [        ;   a	  [        U    e[        S[	        [        R                  5       5       SU  S35      e)a3  
Factory function to get a Formatter given its type name and keyword arguments.
A formatter is an object that extracts and formats data from pyarrow table.
It defines the formatting for rows, columns and batches.
If the formatter for a given type name doesn't exist or is not available, an error is raised.
zFormat type should be one of z, but got '' )r?   r   r   
ValueErrorlistkeys)r   format_kwargss     r"   get_formatterrG   {   sk     -[9Km#[):M::77/<<8m>P>P>R9S8TT_`k_llmnoor$   )N)6typingr   r   r   r    r   utilsr	   
formattingr   r   r   r   r   r   r   r   r   np_formatterr   
get_loggerr   r   r   dictstrtype__annotations__r   r   	ExceptionrD   r#   r'   POLARS_AVAILABLEpolars_formatterr1   rC   _polars_errorTORCH_AVAILABLEtorch_formatterr4   _torch_errorTF_AVAILABLEtf_formatterr8   	_tf_errorJAX_AVAILABLEjax_formatterr;   
_jax_errorr?   rG   rB   r$   r"   <module>r_      s:   . -  
 
 
 ) 
		H	%68tHSM4	?23 824 tHSM3./ 4DF !4y(@#A F $(33#3 d3i 30 ^b	E 	E/7}	EGOPTUXPYGZ	E OTH: > NGdI5F G NGdV < OXv > OX .	1D6BefM#M8dVL	/$	9JKcdL#L'D)CTU	)\D6BfgI#I|dVL	+eR8XYJ#JrBHSM hsm px} p) pr$   