관리-도구
편집 파일: quart.cpython-311.pyc
� �܋f� � � � d dl mZ d dlZd dlZd dlmZmZ d dlmZm Z d dl mZ d dlm Z d dlmZ d dlmZ d d lmZmZ d d lmZ d dlmZ erd dlmZ d d lmZ d dlmZ d dlmZ d dlZn # e$ r dZY nw xY w d dl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& d dl'm(Z( d dl)m*Z*m+Z+m,Z,m-Z-m.Z. d dl/m0Z0 n# e$ r ed� � �w xY wdZ1 G d� de � � Z2d� Z3d� Z4d� Z5d� Z6d� Z7d� Z8d� Z9dS )� )�absolute_importN)�_should_send_default_pii�Hub)�DidNotEnable�Integration)�_filter_headers)�SentryAsgiMiddleware)�Scope)�SOURCE_FOR_STYLE)�capture_internal_exceptions�event_from_exception)�wraps)� TYPE_CHECKING)�Any)�Dict)�Union)�EventProcessor)�has_request_context�has_websocket_context�Request�Quart�request� websocket)�Scaffold)�got_background_exception�got_request_exception�got_websocket_exception�request_started�websocket_started)�is_coroutine_functionzQuart is not installed)�endpoint�urlc �4 � e Zd ZdZdZdd�Zed� � � ZdS )�QuartIntegration�quart� r! c �\ � |t vrt d|�dt �d�� � �|| _ d S )Nz%Invalid value for transaction_style: z (must be in �))�TRANSACTION_STYLE_VALUES� ValueError�transaction_style)�selfr+ s �n/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sentry_sdk/integrations/quart.py�__init__zQuartIntegration.__init__= sJ � ��$<�<�<��*�$�$�$�&>�&>�&>�@�� � � "3����� c �8 � t j t � � t j t � � t j t � � t j t � � t j t � � t � � t � � d S �N) r �connect�_request_websocket_startedr r �_capture_exceptionr r �patch_asgi_app�patch_scaffold_route� r/ r- � setup_oncezQuartIntegration.setup_onceF s| � � �� :�;�;�;��!�"<�=�=�=� �(�);�<�<�<��%�&8�9�9�9��'�(:�;�;�;����������r/ N)r! )�__name__� __module__�__qualname__� identifierr+ r. �staticmethodr8 r7 r/ r- r$ r$ 8 sN � � � � � ��J���3� 3� 3� 3� � � � �\� � � r/ r$ c �B �� t j ��fd�} | t _ d S )Nc � �� �� K � t j � t � � � �� |||� � � d {V ��S t �� fd�� � }|j |_ ||||� � � d {V ��S )Nc � �� ��g| �R i |��S r1 r7 )�a�kw�old_appr, s ��r- �<lambda>zApatch_asgi_app.<locals>.sentry_patched_asgi_app.<locals>.<lambda>] s! �� �7�7�4�;R�!�;R�;R�;R�r�;R�;R� r/ )r �current�get_integrationr$ r � _run_asgi3�__call__)r, �scope�receive�send� middlewarerC s ` �r- �sentry_patched_asgi_appz/patch_asgi_app.<locals>.sentry_patched_asgi_appX s� ��� � � ��;�&�&�'7�8�8�@� ���u�g�t�<�<�<�<�<�<�<�<�<�)�*R�*R�*R�*R�*R�S�S� �(�3� ���Z��w��5�5�5�5�5�5�5�5�5r/ )r rH )rM rC s @r- r5 r5 T s0 �� ��n�G�6� 6� 6� 6� 6� -�E�N�N�Nr/ c �B �� t j ��fd�} | t _ d S )Nc �$ ��� �| i |����fd�}|S )Nc � �� � t j � � � r4t � � � s%t � � � � fd�� � } �|� � S �� � � S )Nc �" �� t j }|� t � � }|� �| i |��S |� � � 5 }|j �"t j � � j |j _ �| i |��cd d d � � S # 1 swxY w Y d S r1 ) r rE rF r$ �configure_scope�profile� threading�current_thread�ident�active_thread_id)�args�kwargs�hub�integration�sentry_scope�old_funcs �r- �_sentry_funczTpatch_scaffold_route.<locals>._sentry_route.<locals>.decorator.<locals>._sentry_funcq s� �� � �+�C�"%�"5�"5�6F�"G�"G�K�"�*�'�x��8��8�8�8��,�,�.�.� 9�,�'�/�;� )� 8� :� :� @� )�0�A� (�x��8��8�8� 9� 9� 9� 9� 9� 9� 9� 9� 9� 9� 9� 9���� 9� 9� 9� 9� 9� 9s �1B�B�B)�inspect� isfunctionr r )r] r^ � old_decorators ` �r- � decoratorz>patch_scaffold_route.<locals>._sentry_route.<locals>.decoratorl st ��� � �!�(�+�+� 3�4I�(�4S�4S� 3��x��� 9� 9� 9� 9� !�� 9� %�}�\�2�2�2� �=��*�*�*r/ r7 )rX rY rb ra � old_routes @�r- � _sentry_routez+patch_scaffold_route.<locals>._sentry_routeh s9 ��� �!� �4�2�6�2�2� � +� +� +� +� +�2 �r/ )r �route)rd rc s @r- r6 r6 d s0 �� ���I�� � � � �>