
    OAi_2                         S SK r S SKrS SKrS SKrS SKJr  S SKJr  Sr/ SQr	Sr
 " S S\5      r " S	 S
\5      r  SS jrS rg)    N)version)datez2.1.0)
deprecatedmessage_locationfail_if_not_removedDeprecatedWarningUnsupportedWarningbottomc                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )r   "   a?  A warning class for deprecated methods

This is a specialization of the built-in :class:`DeprecationWarning`,
adding parameters that allow us to get information into the __str__
that ends up being sent through the :mod:`warnings` system.
The attributes aren't able to be retrieved after the warning gets
raised and passed through the system as only the class--not the
instance--and message are what gets preserved.

:param function: The function being deprecated.
:param deprecated_in: The version that ``function`` is deprecated in
:param removed_in: The version or :class:`datetime.date` specifying
                   when ``function`` gets removed.
:param details: Optional details about the deprecation. Most often
                this will include directions on what to use instead
                of the now deprecated code.
c                 ^   > Xl         X l        X0l        X@l        [        [
        U ]  XX45        g )N)functiondeprecated_in
removed_indetailssuperr   __init__)selfr   r   r   r   	__class__s        G/var/www/html/land-ocr/venv/lib/python3.13/site-packages/deprecation.pyr   DeprecatedWarning.__init__5   s0     !*$/0:	E    c                    [         R                  " [        5      nU R                  US'   U R                  (       a  SU R                  -  US'   U R
                  (       a@  SR                  [        U R
                  [        5      (       a  SOSU R
                  5      US'   [        U R                  U R
                  U R                  /5      (       a  SUS	'   U R                  (       a  S
U R                  -  US'   SU-  $ )Nr   z	 as of %sr   z and will be removed {} {}oninremoved.period %sr   zH%(function)s is deprecated%(deprecated)s%(removed)s%(period)s%(details)s)collectionsdefaultdictstrr   r   r   format
isinstancer   anyr   r   partss     r   __str__DeprecatedWarning.__str__@   s     '', MMj"-0B0B"BE,??;BB:VZVeVegkKlKl4rvCG?? TE)""DOOT\\BCC!E(O<<$t||3E)(+02 	3r   )r   r   r   r   ) )	__name__
__module____qualname____firstlineno____doc__r   r(   __static_attributes____classcell__)r   s   @r   r   r   "   s    $	E3 3r   r   c                       \ rS rSrSrS rSrg)r	   T   ak  A warning class for methods to be removed

This is a subclass of :class:`~deprecation.DeprecatedWarning` and is used
to output a proper message about a function being unsupported.
Additionally, the :func:`~deprecation.fail_if_not_removed` decorator
will handle this warning and cause any tests to fail if the system
under test uses code that raises this warning.
c                     [         R                  " [        5      nU R                  US'   U R                  US'   U R
                  (       a  SU R
                  -  US'   SU-  $ )Nr   r   r   r   z9%(function)s is unsupported as of %(removed)s.%(details)s)r    r!   r"   r   r   r   r&   s     r   r(   UnsupportedWarning.__str__^   sZ    '', MMj??i<<$t||3E)!&( 	)r    N)r+   r,   r-   r.   r/   r(   r0   r6   r   r   r	   r	   T   s    	)r   r	   c                   ^ ^^^^ T c  Tb  [        S5      eSnSm[        T[        5      (       a  [        R                  " 5       T:  a  SmOjSnOgU(       a^  [        R
                  " U5      nT(       a  U[        R
                  " T5      :  a  SmO&T (       a  U[        R
                  " T 5      :  a  SnOSn[        UT/5      mU UUUU4S jnU$ )aQ	  Decorate a function to signify its deprecation

This function wraps a method that will soon be removed and does two things:
    * The docstring of the method will be modified to include a notice
      about deprecation, e.g., "Deprecated since 0.9.11. Use foo instead."
    * Raises a :class:`~deprecation.DeprecatedWarning`
      via the :mod:`warnings` module, which is a subclass of the built-in
      :class:`DeprecationWarning`. Note that built-in
      :class:`DeprecationWarning`s are ignored by default, so for users
      to be informed of said warnings they will need to enable them--see
      the :mod:`warnings` module documentation for more details.

:param deprecated_in: The version at which the decorated method is
                      considered deprecated. This will usually be the
                      next version to be released when the decorator is
                      added. The default is **None**, which effectively
                      means immediate deprecation. If this is not
                      specified, then the `removed_in` and
                      `current_version` arguments are ignored.
:param removed_in: The version or :class:`datetime.date` when the decorated
                   method will be removed. The default is **None**,
                   specifying that the function is not currently planned
                   to be removed.
                   Note: This parameter cannot be set to a value if
                   `deprecated_in=None`.
:param current_version: The source of version information for the
                        currently running code. This will usually be
                        a `__version__` attribute on your library.
                        The default is `None`.
                        When `current_version=None` the automation to
                        determine if the wrapped function is actually
                        in a period of deprecation or time for removal
                        does not work, causing a
                        :class:`~deprecation.DeprecatedWarning`
                        to be raised in all cases.
:param details: Extra details to be added to the method docstring and
                warning. For example, the details may point users to
                a replacement method, such as "Use the foo_bar
                method instead". By default there are no details.
zCCannot set removed_in to a value without also setting deprecated_inFTc                 x  >^  T(       Ga  T R                   =(       d    SnT(       a  ST-  OST
(       a)  SR                  [        T
[        5      (       a  SOST
5      OST(       a  ST-  OSS.nSR                  " S0 UD6nSnUR	                  S	S5      n[        U5      S:  a:  [        R                  " US   5      US'   UR                  US	5        [        S
:w  a  SnUR                  XC5        UR                  US5        SR                  U5      T l         [        R                  " T 5      UUU U	U
U4S j5       nU$ )Nr*   r   z
   This will be removed {} {}.r   r   )r   r   r   z3.. deprecated::{deprecated_in}{removed_in}{details}   
top   z

c                     > T	(       aC  T(       a  [         nO[        nU" TR                  TTT5      n[        R                  " U[
        SS9  T" U 0 UD6$ )N   )category
stacklevel)r	   r   r+   warningswarnDeprecationWarning)
argskwargsclsthe_warningr   r   r   is_unsupportedr   should_warns
       r   _inner5deprecated.<locals>._function_wrapper.<locals>._inner   sR    !,C+C!("3"3]",g7k4F)*, T,V,,r   r6   )r/   r#   r$   r   splitlentextwrapdedentinsertr   join	functoolswraps)r   existing_docstringr'   deprecation_notelocstring_listrJ   r   r   rH   r   rI   s   `      r   _function_wrapper%deprecated.<locals>._function_wrapper   sB   !)!1!1!7R .;EM) NX 7==jQ[]aFbFbdhl>HJ]_'.EGOB8E!88>!? !HAF!H C -224;K;!# "*Q!@A ""3- $u,C s5sF+!ww{3H		"	- 	- 
#	- r   )	TypeErrorr$   r   todayr   parser%   )r   r   current_versionr   is_deprecatedrX   rH   rI   s   `` `  @@r   r   r   j   s    X !7 = > 	> MN
 *d##::<:%!N M	!--8#w}}Z'@@!N!W]]=%AA M }n56KJ JV r   c                 F   ^  [         R                  " T 5      U 4S j5       nU$ )a  Decorate a test method to track removal of deprecated code

This decorator catches :class:`~deprecation.UnsupportedWarning`
warnings that occur during testing and causes unittests to fail,
making it easier to keep track of when code should be removed.

:raises: :class:`AssertionError` if an
         :class:`~deprecation.UnsupportedWarning`
         is raised while running the test method.
c                  $  > [         R                  " SS9 n[         R                  " S5        T" U 0 UD6nS S S 5        W H<  nUR                  [        :X  d  M  [        T< S[        UR                  5      < 35      e   W$ ! , (       d  f       NR= f)NT)recordalwaysz) uses a function that should be removed: )rA   catch_warningssimplefilterr?   r	   AssertionErrorr"   message)rD   rE   caught_warningsrvwarningmethods        r   
test_inner'fail_if_not_removed.<locals>.test_inner  s    $$D1_!!(+((B 2 'G#55$c'//246 6 '
 	 21s   B
B)rR   rS   )rj   rk   s   ` r   r   r   	  s(     __V
 
 r   )NNNr*   )r    rR   rN   rA   	packagingr   datetimer   __version____all__r   rC   r   r	   r   r   r6   r   r   <module>rq      s^         6  /3* /3d)* ), EI\~r   