o
    ٰi	                     @   s   d dl Z d dlmZ d dlZerd dlmZmZmZ d dlZG dd dZdddZ	dddZ
er>G dd dejjeZdS dd  ZdS )    N)TYPE_CHECKING)AnyContextManagerOptionalc                   @   s.   e Zd ZdZdddZddd	ZdddZdS )
_InitGuardzUsing the return value of sentry_sdk.init as a context manager and manually calling the __enter__ and __exit__ methods on the return value are deprecated. We are no longer maintaining this functionality, and we will remove it in the next major release.clientsentry_sdk.ClientreturnNc                 C   s
   || _ d S N)_client)selfr    r   S/home/ubuntu/.local/lib/python3.10/site-packages/sentry_sdk/_init_implementation.py__init__   s   
z_InitGuard.__init__c                 C   s   t j| jdtd | S N   )
stacklevelcategory)warningswarn,_CONTEXT_MANAGER_DEPRECATION_WARNING_MESSAGEDeprecationWarning)r   r   r   r   	__enter__   s   z_InitGuard.__enter__exc_typer   	exc_valuetbc                 C   s0   t j| jdtd | j}|d ur|  d S d S r   )r   r   r   r   r   close)r   r   r   r   cr   r   r   __exit__!   s   z_InitGuard.__exit__)r   r   r	   N)r	   r   )r   r   r   r   r   r   r	   N)__name__
__module____qualname__r   r   r   r   r   r   r   r   r      s    

	r   r	   c                   C   s   d S r
   r   r   r   r   r   _check_python_deprecations-   s   r"   argsOptional[str]kwargsr   ContextManager[Any]c                  O   s0   t j| i |}t  | t  t|}|S )zsInitializes the SDK and optionally integrations.

    This takes the same arguments as the client constructor.
    )
sentry_sdkClientget_global_scope
set_clientr"   r   )r#   r%   r   rvr   r   r   _init4   s
   r,   c                   @   s   e Zd ZdS )initN)r   r    r!   r   r   r   r   r-   G   s    r-   c                   C   s   t S r
   )r,   r   r   r   r   <lambda>O   s    r.   )r	   N)r#   r$   r%   r   r	   r&   )r   typingr   r'   r   r   r   sentry_sdk.constsr   r"   r,   constsClientConstructorr-   r   r   r   r   <module>   s    
 
