
    i6                     b    d Z ddlZddlZddlZ	 ddlZ G d de      ZeZ	y# e$ r ddlZY w xY w)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                   6    e Zd ZdZdefdZd	dZd Zd Zd Z	y)
DeprecatedParamszg
    Decorator used to decorate a function which at least one
    of the parameters is deprecated.
     c                 F    i | _         || _        | j                  ||       y )N)reason)messagescategorypopulate_messages)selfparamr   r	   s       c/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/deprecated/params.py__init__zDeprecatedParams.__init__'   s#     uV4    c                     t        |t              r| j                  j                  |       y t        |t              r(d}|xs |j                  |      }|| j                  |<   y t        |      )Nz!'{param}' parameter is deprecated)r   )
isinstancedictr   updatestrformat	TypeError)r   r   r   fmts       r   r
   z"DeprecatedParams.populate_messages,   s[    eT"MM  's#5C6szzz6F#)DMM% E""r   c                      |j                   |i |}t        j                  |j                  fi |j                  }|D cg c]  }|| j
                  v s| c}S c c}w N)bindcollectionsOrderedDict	argumentskwargsr   )r   	signatureargsr   bindingboundr   s          r   check_paramszDeprecatedParams.check_params6   sU     )..$1&1''(9(9LW^^L#(C%ET]],BCCCs   AAc                 V    |D ]$  }t        j                  || j                  d       & y )N   )r	   
stacklevel)warningswarnr	   )r   r   messages      r   warn_messageszDeprecatedParams.warn_messages;   s'     	IGMM'DMMaH	Ir   c                 t     t        j                        t        j                         fd       }|S )Nc                       j                   g| i |}j                  |D cg c]  }j                  |    c}        | i |S c c}w r   )r#   r*   r   )r    r   invalid_paramsr   fr   r   s       r   wrapperz*DeprecatedParams.__call__.<locals>.wrapperD   sW    .T..yJ4J6JN.Qe 4QRd%f%%  Rs   A)inspectr   	functoolswraps)r   r.   r/   r   s   `` @r   __call__zDeprecatedParams.__call__@   s5    %%a(				& 
	&
 r   N)r   )
__name__
__module____qualname____doc__DeprecationWarningr   r
   r#   r*   r3    r   r   r   r   !   s*    
 &(2D 5
#D
I

r   r   )
r7   r   r1   r'   inspect2r0   ImportErrorobjectr   deprecated_paramsr9   r   r   <module>r>      sG   (   
)v )\ % e  s   " 	..