
    i)              	          d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
mZmZ d dlmZ d dlmZmZmZ  e
d          Z ee          Z ee          Z ee          Z ee          Z	 dd
ee         deeef         fdZdded
ee         dee         fdZddeded
ee         defdZdded
ee         defdZdd
ee         defdZdede fdZ!dede fdZ"dedede fdZ#d	S )    )	getLogger)compile)MappingProxyType)MappingOptional)
create_key	get_value	set_value)Context)_BAGGAGE_PROPERTY_FORMAT_KEY_FORMAT_VALUE_FORMATbaggageNcontextreturnc                     t          t          |           }t          |t                    rt	          |          S t	          i           S )zReturns the name/value pairs in the Baggage

    Args:
        context: The Context to use. If not set, uses current Context

    Returns:
        The name/value pairs in the Baggage
    r   )r	   _BAGGAGE_KEY
isinstancedictr   )r   r   s     ^/var/www/cyber-strat/venv/lib/python3.11/site-packages/mysql/opentelemetry/baggage/__init__.pyget_allr   $   sD     g666G'4   )(((B    namec                 H    t          |                              |           S )a=  Provides access to the value for a name/value pair in the
    Baggage

    Args:
        name: The name of the value to retrieve
        context: The Context to use. If not set, uses current Context

    Returns:
        The value associated with the given name, or null if the given name is
        not present.
    r   )r   get)r   r   s     r   get_baggager   5   s#     7###''---r   valuec                 t    t          t          |                    }||| <   t          t          ||          S )zSets a value in the Baggage

    Args:
        name: The name of the value to set
        value: The value to set
        context: The Context to use. If not set, uses current Context

    Returns:
        A Context with the value updated
    r   )r   r   r
   r   )r   r   r   r   s       r   set_baggager    D   s:     77+++,,GGDM\7G<<<<r   c                     t          t          |                    }|                    | d           t          t          ||          S )zRemoves a value from the Baggage

    Args:
        name: The name of the value to remove
        context: The Context to use. If not set, uses current Context

    Returns:
        A Context with the name/value removed
    r   N)r   r   popr
   r   )r   r   r   s      r   remove_baggager#   T   sE     77+++,,GKKd\7G<<<<r   c                 0    t          t          i |           S )zRemoves all values from the Baggage

    Args:
        context: The Context to use. If not set, uses current Context

    Returns:
        A Context with all baggage entries removed
    r   )r
   r   r   s    r   clearr%   d   s     \2w7777r   c                 T    t                               t          |                     d uS N)_KEY_PATTERN	fullmatchstr)r   s    r   _is_valid_keyr+   p   s!    !!#d)),,D88r   c                 
   t          |                               d          }t                              |d                   d u}t	          |          dk    r+|dd          D ] }t
                              |          d} n!|S )N;r      F)r*   split_VALUE_PATTERNr)   len_PROPERT_PATTERN)r   partsis_valid_valuepropertys       r   _is_valid_valuer6   t   s    JJS!!E#--eAh77tCN
5zzA~~abb	 	 	H))(33;!& < r   keyc                 >    t          |           ot          |          S r'   )r+   r6   )r7   r   s     r   _is_valid_pairr9      s    8/%"8"88r   r'   )$loggingr   rer   typesr   typingr   r   mysql.opentelemetry.contextr   r	   r
   #mysql.opentelemetry.context.contextr   mysql.opentelemetry.util.rer   r   r   r   __name___loggerr(   r0   r2   r*   objectr   r   r    r#   r%   boolr+   r6   r9    r   r   <module>rF      s               " " " " " " $ $ $ $ $ $ $ $ H H H H H H H H H H 7 7 7 7 7 7          z)$$
)H

w{##''7344  "&   g S&[       ". .c .HW$5 .&AQ . . . .= =c =& =8G3D =PW = = = = = = =x'8 =G = = = = 	8 	88G$ 	8 	8 	8 	8 	89 9 9 9 9 96 d    9 9C 9D 9 9 9 9 9 9r   