
    Qjf	                    t    d Z ddlmZ ddlZ G d de      Z G d de      ZeZ	 ddd		 	 	 	 	 	 	 	 	 	 	 dd
Z	y)z)Sphinx deprecation classes and utilities.    )annotationsNc                      e Zd Zy)RemovedInSphinx80WarningN__name__
__module____qualname__     2lib/python3.12/site-packages/sphinx/deprecation.pyr   r          r   r   c                      e Zd Zy)RemovedInSphinx90WarningNr   r
   r   r   r   r      r   r   r   F)raisesc                   |dk(  rt         }n|dk(  rt        }nd|d}t        |      |  d| }|r
d|d|d}n|d	}|rt        |      | d
}t	        j
                  ||d       y)a  Helper function for module-level deprecations using ``__getattr__``.

    :param module: The module containing a deprecated object.
    :param attribute: The name of the deprecated object.
    :param canonical_name: Optional fully-qualified name for its replacement.
    :param remove: Target version for removal.
    :param raises: Indicate whether to raise an exception instead of a warning.

    When *raises* is ``True``, an :exc:`AttributeError` is raised instead
    of emitting a warning so that it is easy to locate deprecated objects
    in tests that could suppress deprecation warnings.

    Usage::

       # deprecated name -> (object to return, canonical path or empty string, removal version)
       _DEPRECATED_OBJECTS = {
           'deprecated_name': (object_to_return, 'fully_qualified_replacement_name', (8, 0)),
       }


       def __getattr__(name: str) -> Any:
           if name not in _DEPRECATED_OBJECTS:
               msg = f'module {__name__!r} has no attribute {name!r}'
               raise AttributeError(msg)

           from sphinx.deprecation import _deprecation_warning

           deprecated_object, canonical_name, remove = _DEPRECATED_OBJECTS[name]
           _deprecation_warning(__name__, name, canonical_name, remove=remove)
           return deprecated_object
    )   r   )	   r   zremoval version z is invalid!.z
The alias z is deprecated, use z	 instead.z is deprecated.z, Check CHANGES for Sphinx API modifications.   )
stacklevelN)r   r   RuntimeErrorAttributeErrorwarningswarn)	module	attributecanonical_nameremover   warning_classmsgqualnamemessages	            r   _deprecation_warningr#      s    N '?	6	0 
,739+&Hxl*>~>PPYZL0W%%	EFGMM'=Q7r   ) )r   strr   r%   r   r%   r   ztuple[int, int]r   boolreturnNone)
__doc__
__future__r   r   DeprecationWarningr   PendingDeprecationWarningr   RemovedInNextVersionWarningr#   r
   r   r   <module>r.      s|    / " 	1 		8 	 7  98 989898 98
 98 98 
98r   