
    g                    v   d dl mZ d dlZd dlZd dlZd dlmZmZ ej                  dk\  rd dlm	Z
 nd dlm	Z
 erej                  dk\  rd dlmZ nd dlmZ g dZ G d	 d
e      Z	 	 	 	 	 	 	 	 ddZddedd	 	 	 	 	 	 	 	 	 ddZ	deddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZe
Z	  G d d      Z e       a	 	 	 	 	 	 	 	 ddZy)    )annotationsN)TYPE_CHECKINGLiteral)      )
deprecated)r      )LiteralString)AltairDeprecationWarningr   deprecated_static_onlydeprecated_warnc                      e Zd Zy)r   N)__name__
__module____qualname__     M/var/www/openai/venv/lib/python3.12/site-packages/altair/utils/deprecation.pyr   r      s    r   r   c               8    d|  d}|r| d| d}|r| d| S |S )Nz
Deprecated since `altair=z`.z Use z	 instead.
r   )versionalternativemessageoutputs       r   _format_messager      s?     +7)26F85Y7%,fXRy!8&8r      )r   r   category
stacklevelc                8    t        | ||      }t        |||      S )a  
    Indicate that a class, function or overload is deprecated.

    When this decorator is applied to an object, the type checker
    will generate a diagnostic on usage of the deprecated object.

    Parameters
    ----------
    version
        ``altair`` version the deprecation first appeared.
    alternative
        Suggested replacement class/method/function.
    message
        Additional message appended to ``version``, ``alternative``.
    category
        If the *category* is ``None``, no warning is emitted at runtime.
    stacklevel
        The *stacklevel* determines where the
        warning is emitted. If it is ``1`` (the default), the warning
        is emitted at the direct caller of the deprecated object; if it
        is higher, it is emitted further up the stack.
        Static type checker behavior is not affected by the *category*
        and *stacklevel* arguments.

    References
    ----------
    [PEP 702](https://peps.python.org/pep-0702/)
    r   r   )r   _deprecated)r   r   r   r   r   msgs         r   r   r   -   s"    H ';
8CsX*EEr      )r   r   r   actionc                   t        |||       }|t        j                  |||       y|dk(  rt        |||       yt	        |      )ar  
    Indicate that the current code path is deprecated.

    This should be used for non-trivial cases *only*. ``@deprecated`` should
    always be preferred as it is recognized by static type checkers.

    Parameters
    ----------
    message
        Explanation of the deprecated behaviour.

        .. note::
            Unlike ``@deprecated``, this is *not* optional.

    version
        ``altair`` version the deprecation first appeared.
    alternative
        Suggested replacement argument/method/function.
    category
        The runtime warning type emitted.
    stacklevel
        How far up the call stack to make this warning appear.
        A value of ``2`` attributes the warning to the caller
        of the code calling ``deprecated_warn()``.

    References
    ----------
    [warnings.warn](https://docs.python.org/3/library/warnings.html#warnings.warn)
    Nr    once)r   warningswarn
_warn_onceNotImplementedError)r   r   r   r   r   r$   r"   s          r   r   r   U   sG    L ';
8C~cHD	6	3jA!&))r   c                  ,    e Zd ZddZddZddZddZy)	_WarningsMonitorc                D    i | _         t        j                         | _        y N)_warned	threadingLock_lockselfs    r   __init__z_WarningsMonitor.__init__   s    ;=^^%
r   c               b    | j                   5  || j                  v cd d d        S # 1 sw Y   y xY wr.   r2   r/   r4   keys     r   __contains__z_WarningsMonitor.__contains__   s    ZZ$,,& ZZs   %.c               d    | j                   5  d| j                  |<   d d d        y # 1 sw Y   y xY w)NTr7   r8   s     r   hitz_WarningsMonitor.hit   s!    ZZ $DLL ZZs   &/c                z    | j                   5  | j                  j                          d d d        y # 1 sw Y   y xY wr.   )r2   r/   clearr3   s    r   r>   z_WarningsMonitor.clear   s#    ZZLL  ZZs   1:N)returnNone)r9   r
   r?   bool)r9   r
   r?   r@   )r   r   r   r5   r:   r<   r>   r   r   r   r,   r,      s    &'%!r   r,   c              v    | t         v ry t         j                  |        t        j                  | ||dz          y )Nr   r    )_warnings_monitorr<   r'   r(   )r"   r   r   s      r   r)   r)      s2     c"cHaHr   )r   r
   r   LiteralString | Noner   rD   r?   r
   )
r   r
   r   rD   r   rD   r   z%type[AltairDeprecationWarning] | Noner   int)r   r
   r   r
   r   rD   r   type[AltairDeprecationWarning]r   rE   r$   zLiteral['once'] | Noner?   r@   )r"   r
   r   rF   r   rE   r?   r@   )
__future__r   sysr0   r'   typingr   r   version_infor   r!   typing_extensionsr
   __all__DeprecationWarningr   r   r   r   r,   rC   r)   r   r   r   <module>rN      sk   " 
   )w2; 
7"(3 81 7	9	9%	9 "	9
 	9" )-$(6N%F%F &%F "	%F
 4%F %FX )-/G%),*,* ,* &	,*
 -,* ,* #,* 
,*^ % D! !$ %& I	I(FITWI	Ir   