관리-도구
편집 파일: attachments.cpython-311.pyc
� �܋f � �f � d dl Z d dlZd dlmZ d dlmZmZ er d dlmZm Z m Z G d� de� � ZdS )� N)� TYPE_CHECKING)�Item� PayloadRef)�Optional�Union�Callablec �, � e Zd Z dd�Zd� Zd� ZdS )� AttachmentNFc � � |�|�t d� � �|�!|�t j � |� � }|�t d� � �|�t j |� � d }|| _ || _ || _ || _ || _ d S )Nz)path or raw bytes required for attachmentz#filename is required for attachmentr ) � TypeError�os�path�basename� mimetypes� guess_type�bytes�filename�content_type�add_to_transactions)�selfr r r r r s �M/opt/cloudlinux/venv/lib64/python3.11/site-packages/sentry_sdk/attachments.py�__init__zAttachment.__init__ s� � � �=�T�\��G�H�H�H���� 0��w�'�'��-�-�H����A�B�B�B���$�/��9�9�!�<�L��� � �� ��� �(���#6�� � � � c �� � d}| j �1t | j � � r| � � � }n| j }nt | j �� � }t |d| j | j �� � S )z-Returns an envelope item for this attachment.N)r � attachment)�payload�typer r )r �callabler r r r r )r r s r �to_envelope_itemzAttachment.to_envelope_item# su � � ���:�!��� �#�#� %��*�*�,�,����*��� �d�i�0�0�0�G�����*��]� � � � r c � � d| j �d�S )Nz<Attachment �>)r )r s r �__repr__zAttachment.__repr__5 s � � �$(�M�M�M�3�3r )NNNNF)�__name__� __module__�__qualname__r r r"