관리-도구
편집 파일: envelope.cpython-311.pyc
� ^�Dg� � � � d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl m Z mZ er,d dlm Z d dlmZ d dlmZ d d lmZ d d lmZ d dlmZ d dlmZmZ G d � de� � Z G d� de� � Z G d� de� � ZdS )� N)� text_type)�MYPY)�Session)� json_dumps�capture_internal_exceptions)�Any)�Optional)�Union)�Dict)�List)�Iterator)�Event�EventDataCategoryc � � e Zd Z dd�Zed� � � Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zed � � � Zed� � � Zd� ZdS )�EnvelopeNc �p � |�t |� � }|pi | _ |�g }nt |� � }|| _ d S �N)�dict�headers�list�items)�selfr r s �J/opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/envelope.py�__init__zEnvelope.__init__ sB � � ���7�m�m�G��}�"����=��E�E���K�K�E��� � � � c �| � dt | j � � �dd� d� | j D � � � � �d�S )Nzenvelope with z items (z, c 3 �$ K � | ]}|j V � �d S r )� data_category)�.0�xs r � <genexpr>z'Envelope.description.<locals>.<genexpr>* s$ � � � �:�:�!�a�o�:�:�:�:�:�:r �))�lenr �join�r s r �descriptionzEnvelope.description% sE � � � �� �O�O�O�O��I�I�:�:�t�z�:�:�:�:�:�:�:� � r c �j � | � t t |�� � d�� � � � d S )N��json�event��payload�type��add_item�Item� PayloadRef)r r* s r � add_eventzEnvelope.add_event- s4 � � � � �d�:�5�#9�#9�#9��H�H�H�I�I�I�I�Ir c �j � | � t t |�� � d�� � � � d S )Nr( �transactionr+ r. )r r4 s r �add_transactionzEnvelope.add_transaction3 s4 � � � � �d�:�;�#?�#?�#?�m�T�T�T�U�U�U�U�Ur c � � t |t � � r|� � � }| � t t |�� � d�� � � � d S )Nr( �sessionr+ )� isinstancer �to_jsonr/ r0 r1 )r r7 s r �add_sessionzEnvelope.add_session9 sU � � �g�w�'�'� (��o�o�'�'�G�� � �d�:�7�#;�#;�#;�)�L�L�L�M�M�M�M�Mr c �: � | j � |� � d S r )r �append)r �items r r/ zEnvelope.add_itemA s � � � ���$�����r c �N � | j D ]}|� � � }|�|c S �d S r )r � get_event)r r r* s r r? zEnvelope.get_eventG s; � ��Z� � �E��O�O�%�%�E�� ����� !��tr c �N � | j D ]}|� � � }|�|c S �d S r )r �get_transaction_event)r r= r* s r rA zEnvelope.get_transaction_eventO s= � ��J� � �D��.�.�0�0�E�� ����� !��tr c �* � t | j � � S r )�iterr r% s r �__iter__zEnvelope.__iter__W s � ��D�J���r c � � |� t | j � � � � |� d� � | j D ]}|� |� � �d S )N� )�writer r r �serialize_into)r �fr= s r rH zEnvelope.serialize_into[ sa � � ��� �4�<�(�(�)�)�)� ��������J� #� #�D�����"�"�"�"� #� #r c �z � t j � � }| � |� � |� � � S r ��io�BytesIOrH �getvalue�r �outs r � serializezEnvelope.serialized �/ � ��j�l�l�����C� � � ��|�|�~�~�r c �� � t j |� � � � � }g } t � |� � }|�n|� |� � �3 | ||�� � S )N� �r r )r) �loads�readliner0 �deserialize_fromr<