
    +gd|                         d dl Z d dlZd dlZd dlmZ d dlmZmZ ddlm	Z	  e
            a e	e          Zddee         fdZ G d d	e j                  Z G d
 de j        e          ZdS )    N)wraps)CallableOptional   )
get_loggerhelp_messagec                 "     dt           f fd}|S )zDecorator to mark a class or a function as deprecated.

    Args:
        help_message (:obj:`str`, optional): An optional message to guide the user on how to
            switch to non-deprecated usage of the library.
    deprecated_class_or_functionc                 P   t          j        |           r| j        | j        }n1| j        }|dk    r|nj                            d          d         }r| dd z   ndt                    fd            }d|_        t          j        |           r	|| _        | S |S )	N__init__.zI is deprecated and will be removed in the next major version of datasets.  c                      t                    }|t          vr6t          j        t          d           t                              |            | i |S )N   )category
stacklevel)hash_emitted_deprecation_warningswarningswarnFutureWarningadd)argskwargs	func_hashdeprecated_functionwarning_msgs      @lib/python3.11/site-packages/datasets/utils/deprecation_utils.pywrapperz.deprecated.<locals>.decorator.<locals>.wrapper(   s^    011I ===kMaPPPP-11)<<<&&7777    
deprecated)inspectisclassr   __name____qualname__splitr   _decorator_name_)r
   namer!   r   r   r   s      @@r    	decoratorzdeprecated.<locals>.decorator   s     ?788 	c">"G/8DD">&/D:--443F3S3Y3YZ]3^3^_a3bD t^^^aseqasasss 	 
"	#	#	8 	8 	8 	8 	8 
$	#	8 $0 ?788 	4;(1//Nr"   )r   )r   r+   s   ` r    r#   r#      s1                 D r"   c                   D     e Zd ZdZ fdZ fdZdddddd fdZ xZS )	OnAccessz\
    Enum metaclass that calls a user-specified function whenever a member is accessed.
    c                     t                                          |          }t          |t          j                  r|j        r|                                 |S N)super__getattribute__
isinstanceenumEnum
_on_access)clsr*   obj	__class__s      r    r1   zOnAccess.__getattribute__@   sL    gg&&t,,c49%% 	#. 	NN
r"   c                     t                                          |          }|j        r|                                 |S r/   )r0   __getitem__r5   )r6   r*   memberr8   s      r    r:   zOnAccess.__getitem__F   s<    $$T** 	 r"   Nr   modulequalnametypestartc                    t                                          ||||||          }t          |t          j                  r|j        r|                                 |S )Nr<   )r0   __call__r2   r3   r4   r5   )	r6   valuenamesr=   r>   r?   r@   r7   r8   s	           r    rB   zOnAccess.__call__L   s[    ggueFXTX`effc49%% 	#. 	NN
r"   r/   )r&   
__module__r'   __doc__r1   r:   rB   __classcell__)r8   s   @r    r-   r-   ;   s                 4$TYZ           r"   r-   c                   4    e Zd ZdZd Zed             Zd ZdS )DeprecatedEnumzQ
    Enum class that calls `deprecate` method whenever a member is accessed.
    c                 `    t                               |           }||_        |j        |_        |S r/   )object__new___value_	deprecater5   )r6   rC   r;   s      r    rL   zDeprecatedEnum.__new__X   s*    $$",r"   c                     dS )Nr    )selfs    r    r   zDeprecatedEnum.help_message^   s    rr"   c                     | j         r
d| j          nd}t          j        d| j        j         d|z   t
          d           d S )Nr   r   'zJ' is deprecated and will be removed in the next major version of datasets.   )r   )r   r   r   __objclass__r&   r   )rQ   r   s     r    rN   zDeprecatedEnum.deprecateb   se    262CK.4,...v!*vvv		
 	
 	
 	
 	
 	
r"   N)r&   rE   r'   rF   rL   propertyr   rN   rP   r"   r    rI   rI   S   sW              X
 
 
 
 
r"   rI   )	metaclassr/   )r3   r$   r   	functoolsr   typingr   r   loggingr   setr   r&   loggerstrr#   EnumMetar-   r4   rI   rP   r"   r    <module>r_      s            % % % % % % % %       !$ 	H		* *Xc] * * * *Z    t}   0
 
 
 
 
TY( 
 
 
 
 
 
r"   