PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
sentry_sdk
/
integrations
/
__pycache__
� �eϸ�� �� �� � d dl mZ d dlmZ d dlmZ d dlmZmZ d dl m Z mZ d dlm Z d dlmZmZ d dlmZmZ d d lmZmZmZ d d lmZ d dlmZ d dlmZ d d lmZ d dl m!Z!m"Z"m#Z# er0d dl m$Z$m%Z%m&Z&m'Z'm(Z( d dl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2 d dlm3Z3 d dl4m5Z5 n# e6$ r e d� � �w xY wdZ7 G d� de � � Z8 G d� de� � Z9d)d�Z:d)d�Z;d*d�Z<d)d �Z=d+d$�Z>d%e?d!d"d&d'ddfd(�Z@dS ),� )� TYPE_CHECKING)� BaseModel)�OP)�Hub�_should_send_default_pii)�DidNotEnable�Integration)�SentryAsgiMiddleware)�SOURCE_FOR_STYLE�TRANSACTION_SOURCE_ROUTE)�event_from_exception�transaction_from_function)�Request�Starlite�State)�BaseRouteHandler)�DefineMiddleware)�get_plugin_for_value)� HTTPRoute)�ConnectionDataExtractor�is_async_callable�Ref)�Any�Dict�List�Optional�Union) �ASGIApp�HTTPReceiveMessage� HTTPScope�Message� Middleware�Receive�Scope�Send�WebSocketReceiveMessage)�MiddlewareProtocol)�EventzStarlite is not installedzgeneric Starlite requestc � � � e Zd Zd� fd�Z� xZS )�SentryStarliteASGIMiddleware�appr c �R �� t � � � |ddd�� � d S )NF�endpoint�asgi)r+ �unsafe_context_data�transaction_style�mechanism_type)�super�__init__)�selfr+ � __class__s ��r/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/sentry_sdk/integrations/starlite.pyr3 z%SentryStarliteASGIMiddleware.__init__* s: �� � ������ %�(�!� � � � � � � )r+ r )�__name__� __module__�__qualname__r3 � __classcell__)r5 s @r6 r* r* ) s= �� � � � � � � � � � � � � � � r7 r* c �* � e Zd ZdZedd�� � ZdS )�StarliteIntegration�starlite�returnNc �Z � t � � t � � t � � d S )N)�patch_app_init�patch_middlewares�patch_http_route_handle� r7 r6 � setup_oncezStarliteIntegration.setup_once6 s, � ����������!�!�!�!�!r7 �r? N)r8 r9 r: � identifier�staticmethodrE rD r7 r6 r= r= 3 s7 � � � � � ��J��"� "� "� �\�"� "� "r7 r= r? Nc �D �� t j �d �fd�} | t _ dS ) a� Replaces the Starlite class's `__init__` function in order to inject `after_exception` handlers and set the `SentryStarliteASGIMiddleware` as the outmost middleware in the stack. See: - https://starlite-api.github.io/starlite/usage/0-the-starlite-app/5-application-hooks/#after-exception - https://starlite-api.github.io/starlite/usage/7-middleware/0-middleware-intro/ r4 r �argsr �kwargsr? Nc �. �� |� dg � � }|� t gt |t � � r|n|g��� � t j t _ |� dd � � pg }t g|�|d<