HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__pycache__/deprecations.cpython-310.pyc
o

���g�.�@s�dZddlmZddlZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlmZddlm
Z
dd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZeded�Zeddd�Z	dXdYd'd(�Z	dZd[d*d+�Z	)	dZd\d.d/�Z	0d]d^d4d5�Z		6		6d_d`d=d>�ZdadBdC�Z 	dXdbdFdG�Z!dcdJdK�Z"dddMdN�Z#	dXdedSdT�Z$		6dfdgdVdW�Z%dS)hzSHelpers related to deprecation of functions, methods, classes, other
functionality.�)�annotationsN)�Any)�Callable)�Dict)�Match)�Optional)�Sequence)�Set)�Tuple)�Type)�TypeVar)�Union�)�compat)�_hash_limit_string)�_warnings_warn)�	decorator)�inject_docstring_text)�inject_param_text�)�exc�_T)�bound�_FzCallable[..., Any]�msg�str�version�type_�Type[exc.SADeprecationWarning]�
stacklevel�int�code�
Optional[str]�return�NonecCs&|||d�}||_t||dd�dS)N�r!r�r)�deprecated_sincer)rrrrr!�warn�r)�G/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/deprecations.py�_warn_with_version*sr+�cCst||tj||d�dS)Nr%)r+r�SADeprecationWarning)rrrr!r)r)r*�warn_deprecated7s
�r.�args�
Sequence[Any]cCs(|rt|d|�}t||tj||d�dS)zhIssue a deprecation warning with a parameterized string,
    limiting the number of registrations.

    �
r%N)rr+rr-)rr/rrr!r)r)r*�warn_deprecated_limited?s

�r2�__init__�message�constructor�Callable[[Type[_T]], Type[_T]]cs(d��pdf�d����fdd�}|S)	N�.. deprecated:: %s %s��cls�Type[_T]r#cst|�tj�t�d����S)N��func)�_decorate_cls_with_warningrr-�dict)r9�r5�headerr4rr)r*�decorateVs�z deprecated_cls.<locals>.decorate)r9r:r#r:r))rr4r5rAr)r?r*�deprecated_clsQs
rBT�add_deprecation_to_docstring�bool�warning�(Optional[Type[exc.SADeprecationWarning]]�enable_warnings�Callable[[_F], _F]csZ|rd��pdf�nd��durd��durtj��d�7�d�����fd	d
�}|S)a�Decorates a function and issues a deprecation warning on use.

    :param version:
      Issue version in the warning.

    :param message:
      If provided, issue message in the warning.  A sensible default
      is used if not provided.

    :param add_deprecation_to_docstring:
      Default True.  If False, the wrapped function's __doc__ is left
      as-is.  If True, the 'message' is prepended to the docs if
      provided, or sensible default if message is omitted.

    r7r8Nz$Call to deprecated function %(func)sz (deprecated since: %s)�fnrr#cs8�dusJ��dusJ�t|��t|jd����d�S)Nr;)rG)�_decorate_with_warningr>�__name__)rI�rGr@r4rrEr)r*rA�s�zdeprecated.<locals>.decorate�rIrr#r)rr-)rr4rCrErGrAr)rLr*�
deprecatedcs�rN�kwr�0Callable[[Callable[..., _T]], Callable[..., _T]]cKst	d|tjd�|��S)N�2.0�r4rE�rQ)rNr�MovedIn20Warning)r4rOr)r)r*�moved_20�s���rU�api_name�alternativecKs�t�d|�}|rdddd�|�d�}nd}d||d	f}d
|vr6|�dd�}|s6|�d
�dus6Jd|��|r>|d|7}tj}td||d�|��S)Nz^:(attr|func|meth):�	attribute�function�method)�attrr<�methr�	constructzPThe %s %s is considered legacy as of the 1.x series of SQLAlchemy and %s in 2.0.zbecomes a legacy constructz:attr:�warn_on_attribute_accessFrGz�attribute %s will emit a warning on read access.  If you *really* want this, add warn_on_attribute_access=True.  Otherwise please add enable_warnings=False.� rQrRrS)�re�match�group�pop�getr�LegacyAPIWarningrN)rVrWrO�type_regrr4�attribute_ok�warning_clsr)r)r*�became_legacy_20�s2
����
��ri�specs�Tuple[str, str]csXi�i�i����D]\}\}}|�|<t|��|<tj�|<q
d����fdd�}|S)aKDecorates a function to warn on use of certain parameters.

    e.g. ::

        @deprecated_params(
            weak_identity_map=(
                "0.7",
                "the :paramref:`.Session.weak_identity_map parameter "
                "is deprecated.",
            )
        )
        def some_function(**kwargs): ...

    rIrr#c	s�t�|�}|jdur.tt|jt|j�t|j�d�|j���t������t���	���n|j
durE|j
�t������t���	���nd�t���|j�td
�������fdd	��}|j
dure|j
pfd
}|rut|dd����D��}||�}||_
|S)Nr)rIrr/r�kwargsr#cs��D]*}�|dur||dus�|dur,||�|kr,t�|�|�|dd�q��vrLt|����rL�dus>J�t������dd��D]}||vrbt�|�|�|dd�qN||i|��S�Nr,r&)r+�set�
difference)rIr/rl�m)�check_any_kw�check_defaults�check_kw�defaults�messages�version_warnings�versionsr)r*�warned�s<������z3deprecated_params.<locals>.decorate.<locals>.warnedr8cSs2i|]\}\}}|d|dkrdn||pdf�qS)r7rQz1.4r8r))�.0�paramrr4r)r)r*�
<dictcomp>s
���z7deprecated_params.<locals>.decorate.<locals>.<dictcomp>�rIrr/rrlrr#r)r�inspect_getfullargspecrtr>�zipr/�lenrn�intersectionro�kwonlydefaults�varkwr�__doc__r�items)rI�specrx�doc�	decorated�rurjrvrw)rqrrrsrtr*rA�s<

��
!��z#deprecated_params.<locals>.decorateNrM)r��_sanitize_restructured_textrr-)rjrzrr4rAr)r�r*�deprecated_params�sIr��textcCs*ddd�}t�ddd	�|�}t�d
||�S)Nrp�
Match[str]r#rcSs$|�dd�\}}|dvr|d7}|S)Nrr)r<r\z()�rb)rpr�namer)r)r*�repl-sz)_sanitize_restructured_text.<locals>.replz:ref:`(.+) <.*>`cSsd|�d�S)Nz"%s"rr�)rpr)r)r*�<lambda>3sz-_sanitize_restructured_text.<locals>.<lambda>z\:(\w+)\:`~?(?:_\w+)?\.?(.+?)`)rpr�r#r)r`�sub)r�r�r)r)r*r�,s
r�r9r:�wtype�docstring_headerc		Cs|jdur|jp	d}|dur|dur|t|d�;}t|tj�r#|d7}t||d�}d}t|�turWt|j�}||d<|�dd�|�dd�t|j	|j
|�}|durV||}n||_|durct||�}|dur|dusmJ�|dussJ�t||t
||||d��|S)Nr8r;�@ (Background on SQLAlchemy 2.0 at: :ref:`migration_20_toplevel`)rr��__dict__�__weakref__)r�r>�
issubclassr�Base20DeprecationWarningr�typer�rcrK�	__bases__�getattr�setattrrJ)	r9r5r�r4rr�r��constructor_fn�clsdictr)r)r*r=7sB�
�

��r=r<c
s�t���t�tj�r
d}nd}td����fd	d
��}|jdur#|jp$d}|dur;|t|jd�;}||7}t||d
�}||�}	||	_���fdd�|	_	|	S)z=Wrap a function with a warnings.warn and augmented docstring.r�r8rIrr/rrlr#cs4�p|�dd�}|st���dd�||i|��S)N�_sa_skip_warningFr,r&)rcr+)rIr/rl�skip_warning�rGr4rr�r)r*rx{s
�z&_decorate_with_warning.<locals>.warnedNr;rcst���dd�Srm)r+r))r4rr�r)r*r��s�z(_decorate_with_warning.<locals>.<lambda>r|)
r�r�rr�rr�r>rKr�_sa_warn)
r<r�r4rr�rG�doc_onlyrxr�r�r)r�r*rJgs 
�rJ)N)rrrrrrrr r!r"r#r$)r,N)
rrrrrr r!r"r#r$)rrr/r0rrrr r!r"r#r$)r3)rrr4rr5r"r#r6)NTNT)rrr4r"rCrDrErFrGrDr#rH)r4rrOrr#rP)rVrrWr"rOrr#rH)rjrkr#rH)r�rr#r)r9r:r5r"r�rr4rrrr�r"r#r:)NT)r<rr�rr4rrrr�r"rGrDr#r)&r��
__future__rr`�typingrrrrrrr	r
rrr
r8r�langhelpersrrrrrrrrr+r.r2rBrNrUrir�r�r=rJr)r)r)r*�<module>s^�����
6	�
&
e�5�