
    Xj              	          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 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d	z  deeef         fdZdded
ed	z  ded	z  fdZ	 ddeded
ed	z  defdZdded
ed	z  defdZdd
ed	z  defdZdd
ed	z  deeef         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 )    )Mapping)	getLogger)compile)MappingProxyType)
create_key	get_value	set_value)Context)_BAGGAGE_PROPERTY_FORMAT_KEY_FORMAT_VALUE_FORMATbaggageNcontextreturnc                 <    t          t          |                     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   _get_baggage_valuer   s    [/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/opentelemetry/baggage/__init__.pyget_allr      s     .w???@@@    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   '   s#     g...224888r   valuec                 ~    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   copyr	   _BAGGAGE_KEY)r   r   r   r   s       r   set_baggager   6   s>     !1116688GGDM\7G<<<<r   c                     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"   H   sI     !1116688G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$   X   s     \2w7777r   c                 `    t          t          |           }t          |t                    r|S i S )Nr   )r   r   
isinstancedict)r   r   s     r   r   r   d   s0    g666G'4   Ir   c                 T    t                               t          |                     d uS N)_KEY_PATTERN	fullmatchstr)r   s    r   _is_valid_keyr-   k   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_valuer8   o   s    JJS!!E#--eAh77tCN
5zzA~~abb	 	 	H))(33;!& < r   keyc                 >    t          |           ot          |          S r)   )r-   r8   )r9   r   s     r   _is_valid_pairr;   z   s    8/%"8"88r   r)   )%collections.abcr   loggingr   rer   typesr   opentelemetry.contextr   r   r	   opentelemetry.context.contextr
   opentelemetry.util.rer   r   r   r   __name___loggerr*   r2   r4   r,   objectr   r   r   r"   r$   r'   r   boolr-   r8   r;    r   r   <module>rH      s   $ # # # # #             " " " " " " B B B B B B B B B B 1 1 1 1 1 1          z)$$
)H

w{##''7344  #A At^AS&[A A A A9 9c 9GdN 9ftm 9 9 9 9  9== =
=='.~== = = =$= = =w~ = = = = = 	8 	87T> 	8W 	8 	8 	8 	8 $ $sF{:K    9 9 9 9 9 96 d    9 9C 9D 9 9 9 9 9 9r   