
    lh;                        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	 	 dCd&       Z=e5	 	 dCd'       Z>e5	 	 dCd(       Z?e5	 	 	 	 	 dDd)       Z@e5	 	 dCd*       ZAed+        ZBed,        ZB	 dEd-ZBed.        ZCed/        ZC	 dEd0ZCe5d1        ZDe5d2        ZEe5d3        ZFe5d4        ZGe5d5        ZHe5d6        ZIe6	 	 dCd7       ZJe5d8        ZKe5de
j                  dfd9       ZMdFd:ZNdEd;ZOd< ZPd= ZQ	 dGd>ZRe5	 dHd?       ZSe5d@        ZTe5dEdA       ZUdIdBZVy)J    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    `/var/www/pru.catia.catastroantioquia-mas.com/tasa/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_sessionset_transaction_nameupdate_current_spanc                     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.   scopemethodrX   \   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`rP   )rQ   rR   rS   rT   r   rU   rV   s    r.   clientmethodrZ   e   s7     	4ajj@wvqzz23AI Hr/   c                  *    t        j                         S r+   )r   r9   r,   r/   r.   r9   r9   n   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?   t   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hintrd   scope_kwargss       r.   r2   r2      s'     -,,UDVVVVr/   c                 >     t               j                  | |fd|i|S rc   )r<   r4   )messagelevelrd   rg   s       r.   r4   r4      s2     /..#'3 r/   c                 <     t               j                  | fd|i|S rc   )r<   r3   )errorrd   rg   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   )crumbrf   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,   rd   s   r.   innerzconfigure_scope.<locals>.inner  s      s   	)warningswarnDeprecationWarningr;   generate_propagation_contextr   )rz   r   rd   s     @r.   r5   r5      s`     MM	Y 	  !E	&&(  7Nr/   c                       y r+   r,   r,   r/   r.   rA   rA   
  rw   r/   c                      y r+   r,   ry   s    r.   rA   rA     r{   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	   )rz   rd   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   7  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   C  s      ,,S%88r/   c                 6    t               j                  | |      S r+   )r;   rC   r   s     r.   rC   rC   I  s      **366r/   c                 4    t               j                  |       S r+   )r;   rH   r   s    r.   rH   rH   O  s      ))%00r/   c                 4    t               j                  |       S r+   )r;   rD   r   s    r.   rD   rD   U  s      **511r/   c                 8    t               j                  | |      S )Ntimeoutrz   )r9   r7   r   s     r.   r7   r7   [  s     <gAAr/   c                  6     t               j                  di | S )Nr,   )r<   rI   )ru   s    r.   rI   rI   d  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_contextru   s       r.   rJ   rJ   l  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/   c                 6    t               j                  | |      S r+   )r<   rM   )r   r   s     r.   rM   rM     s     33D&AAr/   c                     t               }|y| | |_        |||_        ||t        d      |t	        j
                  dt        d       |}||j                  |       yy)a  
    Update the current active span with the provided parameters.

    This function allows you to modify properties of the currently active span.
    If no span is currently active, this function will do nothing.

    :param op: The operation name for the span. This is a high-level description
        of what the span represents (e.g., "http.client", "db.query").
        You can use predefined constants from :py:class:`sentry_sdk.consts.OP`
        or provide your own string. If not provided, the span's operation will
        remain unchanged.
    :type op: str or None

    :param name: The human-readable name/description for the span. This provides
        more specific details about what the span represents (e.g., "GET /api/users",
        "SELECT * FROM users"). If not provided, the span's name will remain unchanged.
    :type name: str or None

    :param data: A dictionary of key-value pairs to add as data to the span. This
        data will be merged with any existing span data. If not provided,
        no data will be added.

        .. deprecated:: 2.35.0
            Use ``attributes`` instead. The ``data`` parameter will be removed
            in a future version.
    :type data: dict[str, Union[str, int, float, bool]] or None

    :param attributes: A dictionary of key-value pairs to add as attributes to the span.
        Attribute values must be strings, integers, floats, or booleans. These
        attributes will be merged with any existing span data. If not provided,
        no attributes will be added.
    :type attributes: dict[str, Union[str, int, float, bool]] or None

    :returns: None

    .. versionadded:: 2.35.0

    Example::

        import sentry_sdk
        from sentry_sdk.consts import OP

        sentry_sdk.update_current_span(
            op=OP.FUNCTION,
            name="process_user_data",
            attributes={"user_id": 123, "batch_size": 50}
        )
    NzJCannot provide both `data` and `attributes`. Please use only `attributes`.zDThe `data` parameter is deprecated. Please use `attributes` instead.r}   r~   )r=   r   description
ValueErrorr   r   r   update_data)r   r   
attributesdatacurrent_spans        r.   rN   rN     s    d $%L	~#' J2X
 	
 R	

 
  , r/   )NN)NNNNFr+   ) )NNNmanual)application)NNNN)WrR   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__rX   rZ   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   rM   rN   r,   r/   r.   <module>r      s1     % , 0 * M M ; ; $  ' %(,	 	 	 ;A8CH-.A%P  
$ $ $
 ' '
 % %
 ! !  

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 / /
 B B
L-r/   