
    hS                     p    S SK r SSKJr  S r " S S5      r " S S\5      r " S	 S
5      rS r\" 5       r	g)    N   )_apic                    ^  U 4S jnU$ )a  
Decorator for defining the kwdoc documentation of artist properties.

This decorator can be applied to artist property setter methods.
The given text is stored in a private attribute ``_kwarg_doc`` on
the method.  It is used to overwrite auto-generated documentation
in the *kwdoc list* for artists. The kwdoc list is used to document
``**kwargs`` when they are properties of an artist. See e.g. the
``**kwargs`` section in `.Axes.text`.

The text should contain the supported types, as well as the default
value if applicable, e.g.:

    @_docstring.kwarg_doc("bool, default: :rc:`text.usetex`")
    def set_usetex(self, usetex):

See Also
--------
matplotlib.artist.kwdoc

c                    > TU l         U $ N)
_kwarg_doc)functexts    G/var/www/html/env/lib/python3.13/site-packages/matplotlib/_docstring.py	decoratorkwarg_doc.<locals>.decorator   s         )r
   r   s   ` r   	kwarg_docr      s    , r   c                   $    \ rS rSrSrS rS rSrg)Substitution"   a  
A decorator that performs %-substitution on an object's docstring.

This decorator should be robust even if ``obj.__doc__`` is None (for
example, if -OO was passed to the interpreter).

Usage: construct a docstring.Substitution with a sequence or dictionary
suitable for performing substitution; then decorate a suitable function
with the constructed object, e.g.::

    sub_author_name = Substitution(author='Jason')

    @sub_author_name
    def some_function(x):
        "%(author)s wrote this function"

    # note that some_function.__doc__ is now "Jason wrote this function"

One can also use positional arguments::

    sub_first_last_names = Substitution('Edgar Allen', 'Poe')

    @sub_first_last_names
    def some_function(x):
        "%s %s wrote the Raven"
c                 V    U(       a  U(       a  [        S5      eU=(       d    UU l        g )Nz+Only positional or keyword args are allowed)	TypeErrorparams)selfargskwargss      r   __init__Substitution.__init__=   s    FIJJnfr   c                     UR                   (       a2  [        R                  " UR                   5      U R                  -  Ul         U$ r   )__doc__inspectcleandocr   )r   r	   s     r   __call__Substitution.__call__B   s-    <<"++DLL9DKKGDLr   r   N)__name__
__module____qualname____firstlineno__r   r   r    __static_attributes__r   r   r   r   r   "   s    4%
r   r   c                       \ rS rSrS rSrg)_ArtistKwdocLoaderH   c                 $  ^ UR                  S5      (       d  [        U5      eUS [        S5      *  mSSKJnJn   U4S j[        R                  " U5       5       u  nU R                  X" U5      5      $ ! [         a  n[        U5      UeS nAff = f)Nz:kwdocr   )Artistkwdocc              3   L   >#    U  H  nUR                   T:X  d  M  Uv   M     g 7fr   )r#   ).0clsnames     r   	<genexpr>1_ArtistKwdocLoader.__missing__.<locals>.<genexpr>O   s&      -#DC||t+ C#Ds   $	$)
endswithKeyErrorlenmatplotlib.artistr,   r-   r   recursive_subclasses
ValueError
setdefault)r   keyr,   r-   r0   er1   s         @r   __missing___ArtistKwdocLoader.__missing__I   s    ||H%%3-?S]N#3	'-4#<#<V#D -DC sE#J//  	'3-Q&	's   "A4 4
B>B

Br   N)r#   r$   r%   r&   r=   r'   r   r   r   r)   r)   H   s    
0r   r)   c                   *    \ rS rSrSrS rS rS rSrg)_ArtistPropertiesSubstitutionV   a  
A class to substitute formatted placeholders in docstrings.

This is realized in a single instance ``_docstring.interpd``.

Use `~._ArtistPropertiesSubstition.register` to define placeholders and
their substitution, e.g. ``_docstring.interpd.register(name="some value")``.

Use this as a decorator to apply the substitution::

    @_docstring.interpd
    def some_func():
        '''Replace %(name)s.'''

Decorating a class triggers substitution both on the class docstring and
on the class' ``__init__`` docstring (which is a commonly required
pattern for Artist subclasses).

Substitutions of the form ``%(classname:kwdoc)s`` (ending with the
literal ":kwdoc" suffix) trigger lookup of an Artist subclass with the
given *classname*, and are substituted with the `.kwdoc` of that class.
c                 "    [        5       U l        g r   )r)   r   )r   s    r   r   &_ArtistPropertiesSubstitution.__init__n   s    (*r   c                 <    U R                   R                  " S0 UD6  g)z
Register substitutions.

``_docstring.interpd.register(name="some value")`` makes "name" available
as a named parameter that will be replaced by "some value".
Nr   )r   update)r   r   s     r   register&_ArtistPropertiesSubstitution.registerq   s     	$V$r   c                    UR                   (       a2  [        R                  " UR                   5      U R                  -  Ul         [	        U[
        5      (       a0  UR                  [        R                  :w  a  U " UR                  5        U$ r   )r   r   r   r   
isinstancetyper   object)r   objs     r   r    &_ArtistPropertiesSubstitution.__call__z   sU    ;;!**3;;7$++ECKc4  S\\V__%D
r   r"   N)	r#   r$   r%   r&   r   r   rF   r    r'   r   r   r   r@   r@   V   s    .+%r   r@   c                    ^  U 4S jnU$ )z;Copy a docstring from another source function (if present).c                 L   > TR                   (       a  TR                   U l         U $ r   )r   )targetsources    r   do_copycopy.<locals>.do_copy   s    >>#^^FNr   r   )rQ   rR   s   ` r   copyrT      s     Nr   )
r    r   r   r   dictr)   r@   rT   interpdr   r   r   <module>rX      sA     8# #L0 0) )X (
)r   