
    Yf"'                     &   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 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m*Z*m+Z+  ed      Z, ededef         Z-nd Zg dZ.d Z/d Z0d Z1e/d        Z2e/	 	 d9d        Z3e/	 	 d9d!       Z4e/	 	 d9d"       Z5e/	 	 d9d#       Z6ed$        Z7ed%        Z7	 d:d&Z7ed'        Z8ed(        Z8	 d:d)Z8e/d*        Z9e/d+        Z:e/d,        Z;e/d-        Z<e/d.        Z=e/d/        Z>e0	 	 d9d0       Z?e/d1        Z@e/de	j                  dfd2       ZBe/d3        ZCd;d4ZDd:d5ZEd6 ZFd7 ZGd<d8ZHy)=    N)contextmanager)tracing_utilsClient)TYPE_CHECKING)INSTRUMENTER)Scope_ScopeManager	new_scopeisolation_scope)NoOpSpanTransaction)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    N/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/sentry_sdk/api.pyr   r   *   s        )add_breadcrumbcapture_eventcapture_exceptioncapture_messageconfigure_scopecontinue_traceflushget_baggage
get_client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_transactionc                     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+   scopemethodrM   M   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`rE   )rF   rG   rH   rI   r   rJ   rK   s    r+   clientmethodrO   V   s7     	4ajj@wvqzz23AI Hr,   c                  F    t        j                         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.
    )r   r5   	is_activer)   r,   r+   r8   r8   _   s     ''))r,   c                  *    t        j                         S r(   )r   r5   r)   r,   r+   r5   r5   m   s     r,   c                 R     t        j                         j                  | |fd|i|S Nscope)r   get_current_scoper.   )eventhintrU   scope_kwargss       r+   r.   r.   s   s7     35""$22t $0 r,   c                 R     t        j                         j                  | |fd|i|S rT   )r   rV   r0   )messagelevelrU   rY   s       r+   r0   r0      s7     55""$44#'3 r,   c                 P     t        j                         j                  | fd|i|S rT   )r   rV   r/   )errorrU   rY   s      r+   r/   r/      s5     75""$66* r,   c                 N     t        j                         j                  | |fi |S r(   )r   get_isolation_scoper-   )crumbrX   kwargss      r+   r-   r-      s'     65$$&55eTLVLLr,   c                       y r(   r)   r)   r,   r+   r1   r1           	r,   c                      y r(   r)   callbacks    r+   r1   r1          
 	r,   c                     t        j                         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.
    Nc               3      K     y wr(   r)   rU   s   r+   innerzconfigure_scope.<locals>.inner   s      s   	)r   r`   generate_propagation_contextr   )rg   rl   rU   s     @r+   r1   r1      sJ     %%'E	&&(  7Nr,   c                       y r(   r)   r)   r,   r+   r:   r:      rd   r,   c                      y r(   r)   rf   s    r+   r:   r:      rh   r,   c                 j    | t               5 } | |       ddd       yt               S # 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.
    N)r:   r	   )rg   rU   s     r+   r:   r:      s6     \ 	UUO	?		s   	)2c                 J    t        j                         j                  | |      S r(   )r   r`   r?   keyvalues     r+   r?   r?      s      $$&..sE::r,   c                 J    t        j                         j                  |        y r(   )r   r`   r@   )tagss    r+   r@   r@      s     
((.r,   c                 J    t        j                         j                  | |      S r(   )r   r`   r;   rr   s     r+   r;   r;      s      $$&223>>r,   c                 J    t        j                         j                  | |      S r(   )r   r`   r<   rr   s     r+   r<   r<     s      $$&00e<<r,   c                 H    t        j                         j                  |       S r(   )r   r`   rA   rt   s    r+   rA   rA     s     $$&//66r,   c                 H    t        j                         j                  |       S r(   )r   r`   r=   rz   s    r+   r=   r=     s     $$&0077r,   c                 L    t        j                         j                  | |      S )Ntimeoutrg   )r   r5   r3   r}   s     r+   r3   r3     s#     ##Gh#GGr,   c                  J     t        j                         j                  di | S )Nr)   )r   rV   rB   )rb   s    r+   rB   rB     s#    
 05""$//9&99r,   c                 P     t        j                         j                  | ||fi |S )a   
    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.
    :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   rV   rC   )transactioninstrumentercustom_sampling_contextrb   s       r+   rC   rC   %  s3    L 75""$66\#:>D r,   c                  *    t        j                         S )zn
    See :py:meth:`sentry_sdk.Scope.last_event_id` documentation regarding
    this method's limitations.
    )r   r9   r)   r,   r+   r9   r9   P  s       r,   c                 l    t        j                         j                  }||j                  | ||       y y r(   )r   rV   r   r>   )namert   unitr   s       r+   r>   r>   Z  s3    ))+77K##D%6 r,   c                 ,    t        j                  |       S )zU
    Returns the currently active span if there is one running, otherwise `None`
    )r   r6   rk   s    r+   r6   r6   a  s    
 ))%00r,   c                  F    t        j                         j                         S )zP
    Returns the traceparent either from the active span or from the scope.
    )r   rV   r7   r)   r,   r+   r7   r7   i  s    
 ""$4466r,   c                  l    t        j                         j                         } | | j                         S y)zH
    Returns Baggage either from the active span or from the scope.
    N)r   rV   r4   	serialize)baggages    r+   r4   r4   q  s3    
 %%'335G  ""r,   c                 N    t        j                         j                  | |||      S )z]
    Sets the propagation context from environment or headers and returns a transaction.
    )r   r`   r2   )environ_or_headersopr   sources       r+   r2   r2   }  s)    
 $$&55Bf r,   )NNr(   ) )NNN)IrG   
contextlibr   
sentry_sdkr   r   sentry_sdk._typesr   sentry_sdk.constsr   sentry_sdk.scoper   r	   r
   r   sentry_sdk.tracingr   r   collections.abcr   typingr   r   r   r   r   r   r   r   r   typing_extensionsr   sentry_sdk.clientr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   __all__rM   rO   r8   r5   r.   r0   r/   r-   r1   r:   r?   r@   r;   r<   rA   r=   r3   rB   SENTRYrC   r9   r>   r6   r7   r4   r2   r)   r,   r+   <module>r      sp    % , + * M M 4' %(,	 	 	 ;A8CH-.A:*  
  

	 	  
	 	 

  
	M M 
	 
	
 
	 
	 8 
	 
	
 
	 
	 * ; ;
 / /
 ? ?
 = =
 7 7
 8 8
 H H : : $$ ' 'T ! !717	r,   