
    Uvh/                        d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZmZmZ d dlmZmZmZ d dlmZ d d	lmZ er|d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dl#m$Z$ d dl%m&Z& d dl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ d dlm0Z0m1Z1  e d      Z2 e dedef         Z3nd Zg dZ4d Z5d Z6e5d         Z7d! Z8e5d"        Z9e5d#        Z:e5d$        Z;e5d%        Z<e5	 	 dAd&       Z=e5	 	 dAd'       Z>e5	 	 dAd(       Z?e5	 	 	 	 	 dBd)       Z@e5	 	 dAd*       ZAed+        ZBed,        ZB	 dCd-ZBed.        ZCed/        ZC	 dCd0ZCe5d1        ZDe5d2        ZEe5d3        ZFe5d4        ZGe5d5        ZHe5d6        ZIe6	 	 dAd7       ZJe5d8        ZKe5de
j                  dfd9       ZMdDd:ZNdCd;ZOd< ZPd= ZQ	 dEd>ZRe5	 dFd?       ZSe5d@        ZTy)G    N)contextmanager)tracing_utilsClient)init)INSTRUMENTER)Scope_ScopeManager	new_scopeisolation_scope)NoOpSpanTransactiontrace)monitor)TYPE_CHECKING)Mapping)Any)Dict)	Generator)Optional)overload)Callable)TypeVar)ContextManager)Union)Unpack)
BaseClient)EventHint
BreadcrumbBreadcrumbHintExcInfoMeasurementUnitLogLevelStrSamplingContext)SpanTransactionKwargsTF.)boundc                     | S N )xs    I/opt/face_recognition/venv/lib/python3.12/site-packages/sentry_sdk/api.pyr   r   .   s        )"r   add_attachmentadd_breadcrumbcapture_eventcapture_exceptioncapture_messageconfigure_scopecontinue_traceflushget_baggage
get_clientget_global_scopeget_isolation_scopeget_current_scopeget_current_spanget_traceparentis_initializedr   last_event_idr
   
push_scopeset_context	set_extra	set_levelset_measurementset_tagset_tagsset_user
start_spanstart_transactionr   r   start_sessionend_sessionc                     d| j                   z  dt        j                  t        t        | j                               | _        | S )Nz(Alias for :py:meth:`sentry_sdk.Scope.%s`

)__name__inspectgetdocgetattrr   __doc__fs    r.   scopemethodrV   Z   s7     	3QZZ?wuajj12AI Hr/   c                     d| j                   z  dt        j                  t        t        | j                               | _        | S )Nz)Alias for :py:meth:`sentry_sdk.Client.%s`rN   )rO   rP   rQ   rR   r   rS   rT   s    r.   clientmethodrX   c   s7     	4ajj@wvqzz23AI Hr/   c                  *    t        j                         S r+   )r   r9   r,   r/   r.   r9   r9   l   s     r/   c                  2    t               j                         S )z
    .. versionadded:: 2.0.0

    Returns whether Sentry has been initialized or not.

    If a client is available and the client is active
    (meaning it is configured to send data) then
    Sentry is initialized.
    )r9   	is_activer,   r/   r.   r?   r?   r   s     <!!##r/   c                  *    t        j                         S r+   )r   r:   r,   r/   r.   r:   r:      s     !!##r/   c                  *    t        j                         S r+   )r   r;   r,   r/   r.   r;   r;      s     $$&&r/   c                  *    t        j                         S r+   )r   r<   r,   r/   r.   r<   r<      s     ""$$r/   c                  *    t        j                         S )zn
    See :py:meth:`sentry_sdk.Scope.last_event_id` documentation regarding
    this method's limitations.
    )r   r@   r,   r/   r.   r@   r@      s       r/   c                 >     t               j                  | |fd|i|S Nscope)r<   r2   )eventhintrb   scope_kwargss       r.   r2   r2      s'     -,,UDVVVVr/   c                 >     t               j                  | |fd|i|S ra   )r<   r4   )messagelevelrb   re   s       r.   r4   r4      s2     /..#'3 r/   c                 <     t               j                  | fd|i|S ra   )r<   r3   )errorrb   re   s      r.   r3   r3      s%     100TeT|TTr/   c                 <    t               j                  | ||||      S r+   )r;   r0   )bytesfilenamepathcontent_typeadd_to_transactionss        r.   r0   r0      s&      //x|-@ r/   c                 :     t               j                  | |fi |S r+   )r;   r1   )crumbrd   kwargss      r.   r1   r1      s"     0 //tFvFFr/   c                       y r+   r,   r,   r/   r.   r5   r5           	r/   c                      y r+   r,   callbacks    r.   r5   r5          
 	r/   c                     t        j                  dt        d       t               j	                          | 	 |        yt
        fd       } |       S )z
    Reconfigures the scope.

    :param callback: If provided, call the callback with the current scope.

    :returns: If no callback is provided, returns a context manager that returns the scope.
    zsentry_sdk.configure_scope is deprecated and will be removed in the next major version. Please consult our migration guide to learn how to migrate to the new API: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring   
stacklevelNc               3      K     y wr+   r,   rb   s   r.   innerzconfigure_scope.<locals>.inner   s      s   	)warningswarnDeprecationWarningr;   generate_propagation_contextr   )rx   r   rb   s     @r.   r5   r5      s`     MM	Y 	  !E	&&(  7Nr/   c                       y r+   r,   r,   r/   r.   rA   rA     ru   r/   c                      y r+   r,   rw   s    r.   rA   rA     ry   r/   c                 (   t        j                  dt        d       | St        j                         5  t        j                  dt               t               5 } | |       ddd       ddd       yt               S # 1 sw Y   xY w# 1 sw Y   yxY w)a  
    Pushes a new layer on the scope stack.

    :param callback: If provided, this method pushes a scope, calls
        `callback`, and pops the scope again.

    :returns: If no `callback` is provided, a context manager that should
        be used to pop the scope again.
    zsentry_sdk.push_scope is deprecated and will be removed in the next major version. Please consult our migration guide to learn how to migrate to the new API: https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-pushingr{   r|   Nignore)r   r   r   catch_warningssimplefilterrA   r	   )rx   rb   s     r.   rA   rA     s     MM	U 	 $$& 	 !!(,>?   	  ?	   	  s#   %B	A<!B<B	BBc                 6    t               j                  | |      S r+   )r;   rF   keyvalues     r.   rF   rF   5  s      ((e44r/   c                 4    t               j                  |       S r+   )r;   rG   )tagss    r.   rG   rG   ;  s      ))$//r/   c                 6    t               j                  | |      S r+   )r;   rB   r   s     r.   rB   rB   A  s      ,,S%88r/   c                 6    t               j                  | |      S r+   )r;   rC   r   s     r.   rC   rC   G  s      **366r/   c                 4    t               j                  |       S r+   )r;   rH   r   s    r.   rH   rH   M  s      ))%00r/   c                 4    t               j                  |       S r+   )r;   rD   r   s    r.   rD   rD   S  s      **511r/   c                 8    t               j                  | |      S )Ntimeoutrx   )r9   r7   r   s     r.   r7   r7   Y  s     <gAAr/   c                  6     t               j                  di | S )Nr,   )r<   rI   )rs   s    r.   rI   rI   b  s    
 *))3F33r/   c                 <     t               j                  | ||fi |S )aV  
    Start and return a transaction on the current scope.

    Start an existing transaction if given, otherwise create and start a new
    transaction with kwargs.

    This is the entry point to manual tracing instrumentation.

    A tree structure can be built by adding child spans to the transaction,
    and child spans to other spans. To start a new child span within the
    transaction or any span, call the respective `.start_child()` method.

    Every child span must be finished before the transaction is finished,
    otherwise the unfinished spans are discarded.

    When used as context managers, spans and transactions are automatically
    finished at the end of the `with` block. If not using context managers,
    call the `.finish()` method.

    When the transaction is finished, it will be sent to Sentry with all its
    finished child spans.

    :param transaction: The transaction to start. If omitted, we create and
        start a new transaction.
    :param instrumenter: This parameter is meant for internal use only. It
        will be removed in the next major version.
    :param custom_sampling_context: The transaction's custom sampling context.
    :param kwargs: Optional keyword arguments to be passed to the Transaction
        constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
        available arguments.
    )r<   rJ   )transactioninstrumentercustom_sampling_contextrs   s       r.   rJ   rJ   j  s.    N 100\#:>D r/   c                 X    t               j                  }||j                  | ||       yy)zs
    .. deprecated:: 2.28.0
        This function is deprecated and will be removed in the next major release.
    N)r<   r   rE   )namer   unitr   s       r.   rE   rE     s/     $%11K##D%6 r/   c                 ,    t        j                  |       S )zU
    Returns the currently active span if there is one running, otherwise `None`
    )r   r=   r   s    r.   r=   r=     s    
 ))%00r/   c                  2    t               j                         S )zP
    Returns the traceparent either from the active span or from the scope.
    )r<   r>   r,   r/   r.   r>   r>     s    
 ..00r/   c                  X    t               j                         } | | j                         S y)zH
    Returns Baggage either from the active span or from the scope.
    N)r<   r8   	serialize)baggages    r.   r8   r8     s-    
  !--/G  ""r/   c                 <    t               j                  | ||||      S )z]
    Sets the propagation context from environment or headers and returns a transaction.
    )r;   r6   )environ_or_headersopr   sourceorigins        r.   r6   r6     s%      //Bff r/   c                 6    t               j                  |       S )Nsession_mode)r;   rK   r   s    r.   rK   rK     s    
  ..L.IIr/   c                  2    t               j                         S r+   )r;   rL   r,   r/   r.   rL   rL     s      ,,..r/   )NN)NNNNFr+   ) )NNNmanual)application)UrP   r   
contextlibr   
sentry_sdkr   r   sentry_sdk._init_implementationr   sentry_sdk.constsr   sentry_sdk.scoper   r	   r
   r   sentry_sdk.tracingr   r   r   sentry_sdk.cronsr   typingr   collections.abcr   r   r   r   r   r   r   r   r   r   typing_extensionsr   sentry_sdk.clientr   sentry_sdk._typesr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   __all__rV   rX   r9   r?   r:   r;   r<   r@   r2   r4   r3   r0   r1   r5   rA   rF   rG   rB   rC   rH   rD   r7   rI   SENTRYrJ   rE   r=   r>   r8   r6   rK   rL   r,   r/   r.   <module>r      s     % , 0 * M M ; ; $  ' %(,	 	 	 ;A8CH-.A#L  
$ $ $
 ' '
 % %
 ! !  

W W  
	 	 

U U 
	
 
 
	G G 
	 
	
 
	 
	 !H 
	 
	
 
	 
	 > 5 5
 0 0
 9 9
 7 7
 1 1
 2 2
 B B 4 4 $$ ( (V711	 AI	 J J / /r/   