� l\�g�.���dZddlmZddlZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZede���Zedd���Z dMdNd'�Z dOdPd)�Z dOdQd,�Z dRdSd1�Z dTdUd9�ZdVd=�Z dMdWd@�Z!dXdC�Z"dYdE�Z# dMdZdJ�Z$ d[d\dL�Z%dS)]zSHelpers 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�Nonec�V�|||���}||_t||dz���dS)N�r"r�r )�deprecated_sincer)rrrr r"�warns �l/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sqlalchemy/util/deprecations.py�_warn_with_versionr,*s=�� �5��4� � � �D�#�D���4�J��N�3�3�3�3�3�3��c�B�t||tj||���dS)Nr')r,r�SADeprecationWarning)rrr r"s r+�warn_deprecatedr17s3��� �W�c�.� �������r-�args� Sequence[Any]c�h�|rt|d|��}t||tj||���dS)zhIssue a deprecation warning with a parameterized string, limiting the number of registrations. � r'N)rr,rr0)rr2rr r"s r+�warn_deprecated_limitedr6?sL�� �0� ��b�$�/�/��� �W�c�.� �������r-�__init__�message� constructor�Callable[[Type[_T]], Type[_T]]c�4�����d��d�pd���d����fd� }|S) N�.. deprecated:: � ��cls�Type[_T]r$c �b��t|�tj�t����z����S)N��func)�_decorate_cls_with_warningrr0�dict)r?r9�headerr8rs ����r+�decoratez deprecated_cls.<locals>.decorateVs:���)� � � � $� �d� �,�,�,� ,� � �  � � r-)r?r@r$r@�)rr8r9rGrFs``` @r+�deprecated_clsrIQsR�������)0���'�-�R�-� A�F� � � � � � � � � � �Or-T�add_deprecation_to_docstring�bool�warning�(Optional[Type[exc.SADeprecationWarning]]�enable_warnings�Callable[[_F], _F]c�v������|r d��d�pd���nd���d��� tj��d�zz �d �����fd � }|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. r<r=r>Nz$Call to deprecated function %(func)sz (deprecated since: %s)�fnrr$c�j����J���J�t|��t|j���z������S)NrB)rN)�_decorate_with_warningrE�__name__)rQrNrFr8rrLs �����r+rGzdeprecated.<locals>.decorate�sV����"�"�"��"�"�"�%� � � �d�� �,�,�,� ,� � �+�  � � � r-�rQrr$r)rr0)rr8rJrLrNrGrFs`` `` @r+� deprecatedrVcs��������.$��� �G�G� �]��]� ��� ����8�����*�� �(�7�2�2�G�  �  �  �  �  �  �  �  �  �  � �Or-�kwr�0Callable[[Callable[..., _T]], Callable[..., _T]]c �6�t d|tjd�|��S)N�2.0�r8rL�rZ)rVr�MovedIn20Warning)r8rWs r+�moved_20r^�s3�� � � ���(<� � �@B� � �r-�api_name� alternativec �V�tjd|��}|r dddd�|�d��}nd}d|�d |�d d �d �}d |vr<|�dd��}|s$|�d��dus Jd|z���|r|d |zz }t j}td||d�|��S)Nz^:(attr|func|meth):� attribute�function�method)�attrrC�methr� constructzThe r=z= is considered legacy as of the 1.x series of SQLAlchemy and zbecomes a legacy constructz in 2.0.z:attr:�warn_on_attribute_accessFrNz�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.rZr[r\)�re�match�group�pop�getr�LegacyAPIWarningrV)r_r`rW�type_regrr8� attribute_ok� warning_clss r+�became_legacy_20rr�s���x�-�x�8�8�H���$�j�(�K�K� �N�N�1� � � ������ �H�H� �E�E� (� (� (�  � ��8����v�v�8�%�@�@� �� ��6�6�+�,�,��5�5�5�)�,4�4�6�5�5��%��3��$�$���&�K� � H�W�k� H� H�R� H� H�Hr-�specs�Tuple[str, str]c ������i�i�i�����D].\}\}}|�|<t|���|<tj�|<�/d����fd� }|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): ... rQrr$c �(������tj|��}|j��tt |jt |j��t |j��z d�|j�����t����� ���t� ��� ����nd|j �L|j �t����� ���t� ��� ����nd�t� ���|j �td ����� � � fd� ��}|j dur|j pd }|r,t|d �� ���D����}||��}||_ |S) NrHrQrr2r�kwargsr$c����D]Q}�|�||��|�7||�|kr%t�|� |� |d����R��vrKt|������r)��J�t��� �� �d����D]+}||vr%t�|� |� |d����,||i|��S�Nr.r()r,�set� difference) rQr2rw�m� check_any_kw�check_defaults�check_kw�defaults�messages�version_warnings�versionss �������r+�warnedz3deprecated_params.<locals>.decorate.<locals>.warned�s?���#� � ���Q�K�'�F�1�I�,A��Q�K�+��q� �X�a�[�0H�0H�&� �� � �� �(��+�#$� ������x�'�'�C��K�K�,B�,B��-�-�'�$�/�/�/�"��\�*��\�*�$�\�2� � ����� � ����;�;�&� �� � �� �(��+�#$� ����� �2�t�&�v�&�&� &r-r>c�@�i|]\}\}}|d|dkrdn|�d|pd����S)r<rZz1.4r=r>rH)�.0�paramrr8s r+� <dictcomp>z7deprecated_params.<locals>.decorate.<locals>.<dictcomp>sZ�����2��1����E� '�5� 0� 0�u�u�g�=�=�� �2� �P���r-�rQrr2rrwrr$r)r�inspect_getfullargspecr�rE�zipr2�lenrz� intersectionr{�kwonlydefaults�varkwr�__doc__r�items) rQ�specr��doc� decoratedr}r~rr�r�rsr�r�s @@@@����r+rGz#deprecated_params.<locals>.decorate�s���������,�R�0�0�� �=� $����I�s�4�9�~�~��D�M�0B�0B�B�E�E�F��M�����H� !��]�]�7�7��A�A�N��8�}�}�/�/��9�9�H�H� � � ,��*�H� ��]�]�7�7��A�A�N��8�}�}�/�/��9�9�H�H��N��8�}�}�H��z� � � '� '� '� '� '� '� '� '� '� '� '� �� '�B�j��$�3���9�r�� � �#����6;�[�[�]�]������C��F�2�J�J� �� ���r-rU)r��_sanitize_restructured_textrr0)rsr�rr8rGr�r�r�s` @@@r+�deprecated_paramsr��s������� "�H�!�H�BD��%*�[�[�]�]�;�;�!��!���!����5�g�>�>����"%�":�����G�G�G�G�G�G�G�G�G�R �Or-�textc�d�d d�}tjdd�|��}tjd||��S) Nr|� Match[str]r$rc�J�|�dd��\}}|dvr|dz }|S)Nrr)rCrfz()�rk)r|r�names r+�replz)_sanitize_restructured_text.<locals>.repl-s1���g�g�a��m�m� ��t� �$� $� $� �D�L�D�� r-z:ref:`(.+) <.*>`c�2�d|�d��zS)Nz"%s"rr�)r|s r+�<lambda>z-_sanitize_restructured_text.<locals>.<lambda>3s���!�'�'�!�*�*�1D�r-z\:(\w+)\:`~?(?:_\w+)?\.?(.+?)`)r|r�r$r)ri�sub)r�r�s r+r�r�,sE������ �6�%�'D�'D�d� K� K�D� �6�3�T�4� @� @�@r-r?r@�wtype�docstring_headerc �J�|jdur|jpd}|�� |�|t|���z}t|tj��r|dz }t ||d��}d}t |��t urkt|j��}||d<|�dd��|�dd��t |j |j |��}|�||}n||_|�t||��}|�*|�J�|�J�t||t||||d����|S)Nr>rB�@ (Background on SQLAlchemy 2.0 at: :ref:`migration_20_toplevel`)rr��__dict__� __weakref__)r�rE� issubclassr�Base20DeprecationWarningr�typer�rlrT� __bases__�getattr�setattrrS) r?r9r�r8rr�r��constructor_fn�clsdicts r+rDrD7sg�� �+�T� !� 1�c�k� 7�R�C��#� � "� ��+� 6� 6� 6� 6� � �e�S�9� :� :� � �0� � �$�C�)9�1�=�=���� ��9�9�� � ��3�<�(�(�G�!$�G�I� � �K�K� �D� )� )� )� �K�K� �t� ,� ,� ,��s�|�S�]�G�<�<�C��&�!(��!5����C�K��&�!(��k�!:�!:�� � "�!�-�-�-��$�$�$� ���&�"�E�7�G�T��� � � � �Jr-rCc�V�����t����t�tj��rd}nd}td����fd � ��}|jd ur|jpd}|�.|t |j� ��z}||z }t||d ��}||��} || _���fd �| _ | S)z=Wrap a function with a warnings.warn and augmented docstring.r�r>rQrr2rrwr$c�p��� p|�dd��}|st���d���||i|��S)N�_sa_skip_warningFr.r()rlr,)rQr2rw� skip_warningrNr8rr�s ����r+r�z&_decorate_with_warning.<locals>.warned{s\���*�*� �f�j�j� ��/ �/ � �� F� �w���1� E� E� E� E��r�4�"�6�"�"�"r-NrBrc�*��t���d���Sry)r,)r8rr�s���r+r�z(_decorate_with_warning.<locals>.<lambda>�s ���!3���%�A�"�"�"�r-r�) r�r�rr�rr�rErTr�_sa_warn) rCr�r8rr�rN�doc_onlyr�r�r�s ``` ` r+rSrSgs ������*�'�2�2�G��%��5�6�6�� ,� �� ���#�#�#�#�#�#�#�#��Y�#� �,�d� "� 3�t�|� 9�r�C��#��D�d�m�4�4�4�4���H�$��#�C�)9�1�=�=����t� � �I��I��������I�� �r-)N) rrrrrrr r!r"r#r$r%)r.N) rrrrr r!r"r#r$r%) rrr2r3rrr r!r"r#r$r%)r7)rrr8rr9r#r$r:)NTNT) rrr8r#rJrKrLrMrNrKr$rO)r8rrWrr$rX)r_rr`r#rWrr$rO)rsrtr$rO)r�rr$r)r?r@r9r#r�rr8rrrr�r#r$r@)NT)rCrr�rr8rrrr�r#rNrKr$r)&r�� __future__rri�typingrrrrrr r r r r rr>r� langhelpersrrrrrrrrr,r1r6rIrVr^rrr�r�rDrSrHr-r+�<module>r�s�����#�"�"�"�"�"� � � � �������������������������������������������������������������������������+�+�+�+�+�+�'�'�'�'�'�'�"�"�"�"�"�"�.�.�.�.�.�.�*�*�*�*�*�*������� �W�T������ �W�T�-�.�.�.��� 4� 4� 4� 4� 4�HL�������� �����&>H������("�)-�8<� � 3�3�3�3�3�l����15�#I�#I�#I�#I�#I�Lb�b�b�b�JA�A�A�A�"'+� -�-�-�-�-�j'+� � *�*�*�*�*�*�*r-
Memory