
    h|                         S SK r S SKrS SKrS SKJr  S SKJrJr  SSKJ	r	  \
" 5       q\	" \5      rSS\\   4S jjr " S S	\ R                   5      r " S
 S\ R$                  \S9rg)    N)wraps)CallableOptional   )
get_loggerhelp_messagec                 $   ^  S[         4U 4S jjnU$ )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                   >^^ [         R                  " U 5      (       a  U R                  mU R                  nO4U mTR                  nUS:w  a  UOTR                  R                  S5      S   nT(       a  U S3ST 3-   OSm[        T5      UU4S j5       nSUl        [         R                  " U 5      (       a  X l        U $ U$ )	N__init__.zI is deprecated and will be removed in the next major version of datasets.  c                     > [        T5      nU[        ;  a/  [        R                  " T[        SS9  [        R                  U5        T" U 0 UD6$ )N   )category
stacklevel)hash_emitted_deprecation_warningswarningswarnFutureWarningadd)argskwargs	func_hashdeprecated_functionwarning_msgs      Z/home/james-whalen/.local/lib/python3.13/site-packages/datasets/utils/deprecation_utils.pywrapper.deprecated.<locals>.decorator.<locals>.wrapper(   sE    01I ==kMaP-11)<&777    
deprecated)inspectisclassr   __name____qualname__splitr   _decorator_name_)r
   namer!   r   r   r   s      @@r    	decoratordeprecated.<locals>.decorator   s     ??788">"G"G/88D">&//D:-43F3S3S3Y3YZ]3^_a3bD  f]^cdeqdrass 	 
"	#	8 
$	8 $0 ??7884;1//Nr#   )r   )r   r,   s   ` r    r$   r$      s       D r#   c                   V   ^  \ rS rSrSrU 4S jrU 4S jrS
SSSSS.U 4S jjjrS	rU =r	$ )OnAccess;   zT
Enum metaclass that calls a user-specified function whenever a member is accessed.
c                    > [         TU ]  U5      n[        U[        R                  5      (       a!  UR
                  (       a  UR                  5         U$ N)super__getattribute__
isinstanceenumEnum
_on_access)clsr+   obj	__class__s      r    r4   OnAccess.__getattribute__@   s8    g&t,c499%%#..NN
r#   c                 h   > [         TU ]  U5      nUR                  (       a  UR                  5         U$ r2   )r3   __getitem__r8   )r9   r+   memberr;   s      r    r>   OnAccess.__getitem__F   s,    $T*r#   Nr   modulequalnametypestartc          	         > [         TU ]  XX4XVS9n[        U[        R                  5      (       a!  UR
                  (       a  UR                  5         U$ )NrA   )r3   __call__r5   r6   r7   r8   )	r9   valuenamesrB   rC   rD   rE   r:   r;   s	           r    rG   OnAccess.__call__L   s@    guFTXfc499%%#..NN
r#    r2   )
r'   
__module__r(   __firstlineno____doc__r4   r>   rG   __static_attributes____classcell__)r;   s   @r    r/   r/   ;   s*    4$TYZ  r#   r/   c                   4    \ rS rSrSrS r\S 5       rS rSr	g)DeprecatedEnumS   zI
Enum class that calls `deprecate` method whenever a member is accessed.
c                 ^    [         R                  U 5      nXl        UR                  Ul        U$ r2   )object__new___value_	deprecater8   )r9   rH   r?   s      r    rV   DeprecatedEnum.__new__X   s(    $",,r#   c                     g)Nr   rK   )selfs    r    r   DeprecatedEnum.help_message^   s    r#   c                     U R                   (       a  SU R                    3OSn[        R                  " SU R                  R                   S3U-   [
        SS9  g )Nr   r   'zJ' is deprecated and will be removed in the next major version of datasets.   )r   )r   r   r   __objclass__r'   r   )r[   r   s     r    rX   DeprecatedEnum.deprecateb   sS    262C2C4,,-.!!**++uv		
r#   rK   N)
r'   rL   r(   rM   rN   rV   propertyr   rX   rO   rK   r#   r    rR   rR   S   s%      
r#   rR   )	metaclassr2   )r6   r%   r   	functoolsr   typingr   r   loggingr   setr   r'   loggerstrr$   EnumMetar/   r7   rR   rK   r#   r    <module>rk      s^        %  !$ 	H	*Xc] *Zt}} 0
TYY( 
r#   