
    OAi6                     d    S r SSKrSSKrSSKr SSKr " S S\5      r\r	g! \ a    SSKr Nf = f)a  
Parameters deprecation
======================

.. _Tantale's Blog: https://tantale.github.io/
.. _Deprecated Parameters: https://tantale.github.io/articles/deprecated_params/

This module introduces a :class:`deprecated_params` decorator to specify that one (or more)
parameter(s) are deprecated: when the user executes a function with a deprecated parameter,
he will see a warning message in the console.

The decorator is customizable, the user can specify the deprecated parameter names
and associate to each of them a message providing the reason of the deprecation.
As with the :func:`~deprecated.classic.deprecated` decorator, the user can specify
a version number (using the *version* parameter) and also define the warning message category
(a subclass of :class:`Warning`) and when to display the messages (using the *action* parameter).

The complete study concerning the implementation of this decorator is available on the `Tantale's blog`_,
on the `Deprecated Parameters`_ page.
    Nc                   B    \ rS rSrSrS\4S jrSS jrS rS r	S r
S	rg
)DeprecatedParams!   z[
Decorator used to decorate a function which at least one
of the parameters is deprecated.
 c                 <    0 U l         X0l        U R                  XS9  g )N)reason)messagescategorypopulate_messages)selfparamr   r
   s       M/var/www/html/land-ocr/venv/lib/python3.13/site-packages/deprecated/params.py__init__DeprecatedParams.__init__'   s     u4    c                     [        U[        5      (       a  U R                  R                  U5        g [        U[        5      (       a)  SnU=(       d    UR                  US9nX R                  U'   g [        U5      e)Nz!'{param}' parameter is deprecated)r   )
isinstancedictr	   updatestrformat	TypeError)r   r   r   fmts       r   r   "DeprecatedParams.populate_messages,   s_    eT""MM  's##5C6szzz6F#)MM% E""r   c                     UR                   " U0 UD6n[        R                  " UR                  40 UR                  D6nU Vs/ s H  ofU R
                  ;   d  M  UPM     sn$ s  snf N)bindcollectionsOrderedDict	argumentskwargsr	   )r   	signatureargsr!   bindingboundr   s          r   check_paramsDeprecatedParams.check_params6   sU    ..$1&1''(9(9LW^^L#(C5%T]],B5CCCs   A"A"c                 T    U H"  n[         R                  " X R                  SS9  M$     g )N   )r
   
stacklevel)warningswarnr
   )r   r	   messages      r   warn_messagesDeprecatedParams.warn_messages;   s    GMM'MMaH  r   c                 z   ^ ^^ [         R                  " T5      m[        R                  " T5      UU U4S j5       nU$ )Nc                     > TR                   " T/U Q70 UD6nTR                  U Vs/ s H  nTR                  U   PM     sn5        T" U 0 UD6$ s  snf r   )r&   r.   r	   )r#   r!   invalid_paramsr   fr   r"   s       r   wrapper*DeprecatedParams.__call__.<locals>.wrapperD   sY    !..yJ4J6JN.Q.e 4.QRd%f%%  Rs   A)inspectr"   	functoolswraps)r   r3   r4   r"   s   `` @r   __call__DeprecatedParams.__call__@   s5    %%a(				& 
	&
 r   )r
   r	   N)r   )__name__
__module____qualname____firstlineno____doc__DeprecationWarningr   r   r&   r.   r9   __static_attributes__ r   r   r   r   !   s*    
 &(2D 5
#D
I

r   r   )
r?   r   r7   r+   inspect2r6   ImportErrorobjectr   deprecated_paramsrB   r   r   <module>rG      sG   (   
)v )\ % e  s   " 
//