+
     ]i8  c                   s    R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^RIHtH	t	H
t
HtHtHtHtHtHt  ! R R4      tR tRR/R ltR	 tR
 tR tRR ltR tR tR tR tRR ltR# )a+  
Helper functions for managing the Matplotlib API.

This documentation is only relevant for Matplotlib developers, not for users.

.. warning::

    This module and its submodules are for internal use only.  Do not use them
    in your own code.  We may change the API at any time with no warning.

N)	
deprecatedwarn_deprecatedrename_parameterdelete_parametermake_keyword_onlydeprecate_method_overridedeprecate_privatize_attribute'suppress_matplotlib_deprecation_warningMatplotlibDeprecationWarningc                   sD   a  ] tR t^t o RtRR ltR t]R 4       tRt	V t
R# )classpropertyz
Like `property`, but also triggers on access via the class, and it is the
*class* that's passed as argument.

Examples
--------
::

    class C:
        @classproperty
        def foo(cls):
            return cls.__name__

    assert C.foo == "C"
Nc                s\    Wn         Vf   Ve   \        R4      hW n        W0n        W@n        R # )Nz#classproperty only implements fget.)_fget
ValueErrorfsetfdel_doc)selffgetr   r   Zdocs   &&&&&?/usr/lib64/python3.14/site-packages/matplotlib/_api/__init__.py__init__Zclassproperty.__init__-   s-    
t/BCC			    c                s$    V P                  V4      # Nr
   )r   instanceZowner   &&&r   __get__Zclassproperty.__get__6   s    zz%  r   c                s    V P                   # r   r   )r      &r   r   Zclassproperty.fget9   s    zzr   )r   r
   r   r   )NNN)__name__
__module____qualname__Z__firstlineno____doc__r   r   propertyr   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r	   r	      s(      !  r   r	   c               sd  a \        R4      o\        V \         4      '       d   V 3M8V f   S3M1\        ;QJ d    . V3R lV  4       F  NK  	  5M! V3R lV  4       4      p V3R lpVP                  4        F  w  r4\        W@4      '       d   K  . \	        W 4      OpRV9   d#   VP                  R4       VP                  R4       \        RP                  T\        V4      ^8  d*   RP                  VRR 4      R,           VR,          ,           MV^ ,          V! \        V4      4      4      4      h	  R# )	a  
For each *key, value* pair in *kwargs*, check that *value* is an instance
of one of *types*; if not, raise an appropriate TypeError.

As a special case, a ``None`` entry in *types* is treated as NoneType.

Examples
--------
>>> _api.check_isinstance((SomeClass, None), arg=arg)
Nc              3   s2   <"   T F  qf   SMTx  K  	  R # 5ir    ).0tp	none_types   & r   	<genexpr>Z#check_isinstance.<locals>.<genexpr>O   s     CUr
92Us   c                 s   < V SJ d   R # V P                   R8X  d   V P                  # V P                    RV P                   2# )NoneZbuiltinsZ.)r   r   )r!   r"   s   &r   	type_nameZ#check_isinstance.<locals>.type_nameQ   sD    	/ 	;(*(CR__	;a'89	;r   r$   z({!r} must be an instance of {}, not a {}, z or )Ztype
isinstanceZtupleitemsmapZremoveZappend	TypeErrorZformatlenjoin)Ztypeskwargsr%   kvZnamesr"   s   ",    @r   check_isinstancer1   A   s     T
I#E400eX"]i\UCUCUUCUCC 
;
 !##,c)+,EV$V$:AA5zA~ IIeCRj)F2U2Y>+08d1g&	() ) r   _print_supported_valuesTc         	     s&   V'       g   \        R4      hVP                  4        FV  w  r4 W@9   pV'       d   K  V: RV 2pV'       d*   VRRP                  \	        \
        V 4      4       2,          p\        V4      h	  R#   \         d    Rp Lai ; i)a  
For each *key, value* pair in *kwargs*, check that *value* is in *values*;
if not, raise an appropriate ValueError.

Parameters
----------
values : iterable
    Sequence of values to check on.

    Note: All values must support == comparisons.
    This means in particular the entries must not be numpy arrays.
_print_supported_values : bool, default: True
    Whether to print *values* when raising ValueError.
**kwargs : dict
    *key, value* pairs as keyword arguments to find in *values*.

Raises
------
ValueError
    If any *value* in *kwargs* is not found in *values*.

Examples
--------
>>> _api.check_in_list(["foo", "bar"], arg=arg, other_arg=other_arg)
zNo argument to check!F is not a valid value for ; supported values are r&   N)r+   r)   r   r-   r*   repr)valuesr2   r.   ZkeyZvalexistsZmsgs   "$,    r   check_in_listr8   d   s    4 /00LLN
	]F vG5cU;C&03tV;L1M0NOOS/!! #  	 F	s   B  BBc          
     s   VP                  4        EF@  w  r#VP                  p\        V4      \        V 4      8w  gO   \        ;QJ d%    R \	        W@4       4       F  '       g   K   RM	  RM! R \	        W@4       4       4      '       g   Ky  \        \        P                  ! RR \        P                  ! 4        4       4      4      pRP                  V RRR1,           Uu. uF  pVe   \        V4      M
\        V4      NK  	  upRRR1,          4      p\        V 4      ^8X  d
   VR,          p\        V: R	\        V 4       R
V RVP                   24      h	  R# u upi )a~  
For each *key, value* pair in *kwargs*, check that *value* has the shape *shape*;
if not, raise an appropriate ValueError.

*None* in the shape is treated as a "free" size that can have any length.
e.g. (None, 2) -> (N, 2)

The values checked must be numpy arrays.

Examples
--------
To check for (N, 2) shaped arrays

>>> _api.check_shape((None, 2), arg=arg, other_arg=other_arg)
c              3   sF   "   T F  w  rW8g  ;'       d    VR Jx  K  	  R # 5ir   r   )r    ZsZt   &  r   r#   check_shape.<locals>.<genexpr>   s%     S<RDAqv//!4-/<Rs   !!TFZNMLKJIHc              3   s,   "   T F
  pR V 2x  K  	  R# 5i)ZDNr   )r    i   & r   r#   r:      s     4"3Q1QC"3s   r&   NZ,z	 must be zD with shape (z), but your input has shape r'   )r)   shaper,   ZanyZzipiter	itertoolsZchaincountr-   strnextr   )r=   r.   r/   r0   Z
data_shapeZ
dim_labelsZnZ
text_shapes   ",      r   check_shaperC      s$     WW

Os5z)3SC
<RS333SC
<RSSSioo4)//"346 7J -24R4[$:-8 /0mCFjAQ$Q-8$::>B$$@ AJ5zQc!
%yUN:, G,,-GG96  $:s   #E
c               s    \        V4      ^8w  d   \        R4      hVP                  4       w  w  r# W,          #   \         d4    \        T: RT RRP	                  \        \        T 4      4       24      Rhi ; i)z
*kwargs* must consist of a single *key, value* pair.  If *key* is in
*mapping*, return ``mapping[value]``; else, raise an appropriate
ValueError.

Examples
--------
>>> _api.check_getitem({"foo": "bar"}, arg=arg)
z-check_getitem takes a single keyword argumentr3   r4   r&   N)r,   r   r)   ZKeyErrorr-   r*   r5   )Zmappingr.   r/   r0   s   ",  r   check_getitemrD      s     6{aHIIllnGFQ:z :e-aS0GyyT7+,-/059	::s	   9 >A7c                s  a aa S P                   R8X  g   Q h\        S 4      P                  4        UUu/ uF  w  r\        V\        4      '       g   K  WbK!  	  uppoS ! 4       o\
        P                  V VV3R l4       pV# u uppi )a  
Helper decorator for implementing module-level ``__getattr__`` as a class.

This decorator must be used at the module toplevel as follows::

    @caching_module_getattr
    class __getattr__:  # The class *must* be named ``__getattr__``.
        @property  # Only properties are taken into account.
        def name(self): ...

The ``__getattr__`` class will be replaced by a ``__getattr__``
function such that trying to access ``name`` on the module will
resolve the corresponding property (which may be decorated e.g. with
``_api.deprecated`` for deprecating module globals).  The properties are
all implicitly cached.  Moreover, a suitable AttributeError is generated
and raised if no property with the given name exists.
__getattr__c                 s|   < V S9   d   SV ,          P                  S4      # \        R SP                  : RV : 24      h)zmodule z has no attribute )r   ZAttributeErrorr   )nameclsr   propss   &r   rE   Z+caching_module_getattr.<locals>.__getattr__   sD    5=;&&x00cnn''9$BD 	Dr   )r   varsr)   r(   r   	functoolsZcache)rG   rF   proprE   r   rH   s   f   @@r   caching_module_getattrrL      s{    & <<=(((*.s)//*; ,*;JD4* TZ*; ,EuH__D D ,s   B B c                s  a Sf   \         P                  ! \        V 4      # V3R lpV P                  4        F  w  r4RpR
 Fe  pWc,           \	        S4      9   g   K  RpV FB  pV! Wc,           4      pWg,           Vn        RWc,            R2Vn        \        SWg,           V4       KD  	  Kg  	  V'       d   K|  \        RV: 24      h	  R p	\        SR/ 4      p
V	! V
4      V	! V 4      ,          pV'       d   \        R	V 24      h/ V
CV CSn        S# )a$  
Class decorator for defining property aliases.

Use as ::

    @_api.define_aliases({"property": ["alias", ...], ...})
    class C: ...

For each property, if the corresponding ``get_property`` is defined in the
class so far, an alias named ``get_alias`` will be defined; the same will
be done for setters.  If neither the getter nor the setter exists, an
exception will be raised.

The alias map is stored as the ``_alias_map`` attribute on the class and
can be used by `.normalize_kwargs` (which assumes that higher priority
aliases come last).
c                 s\   <a  \         P                  ! \        SS 4      4      V 3R  l4       pV# )c                 s(   < \        V S4      ! V/ VB # r   )getattr)r   argsr.   rF   s   &*,r   methodZ2define_aliases.<locals>.make_alias.<locals>.method  s    4&777r   )rJ   ZwrapsrM   )rF   rO   rG   s   f r   
make_aliasZ"define_aliases.<locals>.make_alias  s*    	d+	,	8 
-	8r   FTzAlias for `z`.z%Neither getter nor setter exists for c                 s8    0 V mR  V P                  4        4       m# )c              3   s4   "   T F  q F  q"x  K  	  K  	  R # 5ir   r   )r    aliasesaliasr9   r   r#   ZBdefine_aliases.<locals>.get_aliased_and_aliases.<locals>.<genexpr>  s     K:7%e7e:s   )r6   )Zdr   r   get_aliased_and_aliasesZ/define_aliases.<locals>.get_aliased_and_aliases  s    LLK188:KLLr   
_alias_mapz2Parent class already defines conflicting aliases: )Zget_Zset_)rJ   Zpartialdefine_aliasesr)   rI   r   r   Zsetattrr   rM   ZNotImplementedErrorrT   )Zalias_drG   rP   rK   rQ   r7   ZprefixrR   rO   rS   Zpreexisting_aliasesZconflictings   &f          r   rU   rU      s   $ {  99 !&F}S	)$E'6F&,nFO'26=/%DFNC8	 % ' v7x@B B )M "#|R8*+>?,W56K!@NP 	P7+7w7CNJr   c                s    \        V 4       F  w  r4 V! V/ VB u # 	  R#   \         d    T\        T 4      ^,
          8X  d   h  K:  i ; i)a  
Select and call the function that accepts ``*args, **kwargs``.

*funcs* is a list of functions which should not raise any exception (other
than `TypeError` if the arguments passed do not match their signature).

`select_matching_signature` tries to call each of the functions in *funcs*
with ``*args, **kwargs`` (in the order in which they are given).  Calls
that fail with a `TypeError` are silently skipped.  As soon as a call
succeeds, `select_matching_signature` returns its return value.  If no
function accepts ``*args, **kwargs``, then the `TypeError` raised by the
last failing call is re-raised.

Callers should normally make sure that any ``*args, **kwargs`` can only
bind a single *func* (to avoid any ambiguity), although this is not checked
by `select_matching_signature`.

Notes
-----
`select_matching_signature` is intended to help implementing
signature-overloaded functions.  In general, such functions should be
avoided, except for back-compatibility concerns.  A typical use pattern is
::

    def my_func(*args, **kwargs):
        params = select_matching_signature(
            [lambda old1, old2: locals(), lambda new: locals()],
            *args, **kwargs)
        if "old1" in params:
            warn_deprecated(...)
            old1, old2 = params.values()  # note that locals() is ordered.
        else:
            new, = params.values()
        # do things with params

which allows *my_func* to be called either with two parameters (*old1* and
*old2*) or a single one (*new*).  Note that the new signature is given
last, so that callers get a `TypeError` corresponding to the new signature
if the arguments they passed in do not match any signature.
N)Z	enumerater+   r,   )ZfuncsrN   r.   r;   Zfuncs   &*,  r   select_matching_signaturerV   %  sT    X U#	((( $  	CJN" #	s    #AAc                s*    \        V  RV RV R24      # )zEGenerate a TypeError to be raised by function calls with wrong arity.z	() takes z positional arguments but z were given)r+   )rF   ZtakesZgivenr   r   nargs_errorrW   Y  s(    vYug-Gwk+ , ,r   c                sx    \        V\        4      '       g   \        \        V4      4      p\	        V  RV R24      # )a(  
Generate a TypeError to be raised by function calls with wrong kwarg.

Parameters
----------
name : str
    The name of the calling function.
kw : str or Iterable[str]
    Either the invalid keyword argument name, or an iterable yielding
    invalid keyword arguments (e.g., a ``kwargs`` dict).
z'() got an unexpected keyword argument 'Z')r(   rA   rB   r>   r+   )rF   Zkws   &&r   kwarg_errorrX   _  s7     b#$r(^vDRDJKKr   c              #  sn   "   V x  V P                  4        F  p\        V4       Rj  xL
  K  	  R#  L
5i)z8Yield *cls* and direct and indirect subclasses of *cls*.N)Z__subclasses__recursive_subclasses)rG   Zsubclsr<   r   rY   rY   p  s.     
I$$&'/// '/s   &535c                s"   / p\         P                  R,          R
8  dT   \        P                  ! \        4      P
                  ^,          p\        VR,          4      \        VR,          4      3VR&   M\         P                  ! 4       p\        P                  ! ^4       FV  pVf   WRR&    MM\        P                  ! RVP                  P                  RR	4      4      '       g   WRR&    MVP                  pKX  	  ?\        P                   ! W3/ VB  R# )a  
`warnings.warn` wrapper that sets *stacklevel* to "outside Matplotlib".

The original emitter of the warning can be obtained by patching this
function back to `warnings.warn`, i.e. ``_api.warn_external =
warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
etc.).
:Ni   NZ
matplotlibZmpl_toolkitsZskip_file_prefixesN
stacklevelz-\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))r   Z )i   i   )sysZversion_infopathlibZPathZ__file__ZparentsrA   Z	_getframer?   r@   reZmatchZ	f_globalsZgetZf_backwarningsZwarn)ZmessageZcategoryr.   ZbasedirZframerZ   s   &&    r   warn_externalr_   w  s     F
w&,,x(003(+Gl,B(C(+Gn,D(E(G#$ #//!,J}'1|$88L!OO//
B?A A (2|$LLE - MM'.v.r   r   )r   rJ   r?   r\   r]   r[   r^   Zdeprecationr    r   r   r   r   r   r   r   r   r	   r1   r8   rC   rD   rL   rU   rV   rW   rX   rY   r_   r   r   r   <module>r`      s}   
    	 
 " " " J )F," ,"^ F:* F4n1h,L"0/r   