U
    4Je                     @   sz   d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	m
Z
 dZedZde
ee eddd	Zdee e
d
ddZdS )    )Optional)
create_key	get_value	set_value)Context)INVALID_SPANSpanzcurrent-spanN)spancontextreturnc                 C   s   t t| |d}|S )zSet the span in the given context.

    Args:
        span: The Span to set.
        context: a Context object. if one is not passed, the
            default current context is used instead.
    r
   )r   	_SPAN_KEY)r	   r
   ctx r   R/tmp/pip-unpacked-wheel-7_167w8m/mysql/opentelemetry/trace/propagation/__init__.pyset_span_in_context   s    r   )r
   r   c                 C   s&   t t| d}|dkst|ts"tS |S )zRetrieve the current span.

    Args:
        context: A Context object. If one is not passed, the
            default current context is used instead.

    Returns:
        The Span set in the context if it exists. INVALID_SPAN otherwise.
    r   N)r   r   
isinstancer   r   )r
   r	   r   r   r   get_current_span$   s    
r   )N)N)typingr   Zmysql.opentelemetry.contextr   r   r   Z#mysql.opentelemetry.context.contextr   Zmysql.opentelemetry.trace.spanr   r   ZSPAN_KEYr   r   r   r   r   r   r   <module>   s   