
    Zj                        d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ  ej	        e
          Zd ZddZddZddddZdS )    )annotationsN)ConfigurationError)entry_pointsc                   | j         t          j                  }t          d t	          j        |           D                       fd}t          |j                                                  }|	                    t          j
        dt          j
        j                             t          |d|                    |                     || _         | S )a  Decorator for dataclasses whose JSON Schema sets additionalProperties.

    Wraps the dataclass-generated ``__init__`` so that unknown keyword
    arguments are captured into an ``additional_properties`` instance
    attribute instead of raising ``TypeError``.  This lets plugin/custom
    component names flow through the config pipeline without modifying
    the codegen output for known fields.

    Applied automatically by the custom template in ``opentelemetry-sdk/codegen/``
    when ``additionalPropertiesType`` is present in the template context
    (set by ``datamodel-codegen`` for schema types with ``additionalProperties``).
    c              3  $   K   | ]}|j         V  d S )N)name).0fs     e/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/opentelemetry/sdk/_configuration/_common.py	<genexpr>z)_additional_properties.<locals>.<genexpr>   s$      EEQVEEEEEE    c                    fd|                                 D             }fd|                                 D             } | fi | || _        d S )Nc                $    i | ]\  }}|v 	||S  r   r	   kvknown_fieldss      r   
<dictcomp>z9_additional_properties.<locals>._init.<locals>.<dictcomp>"   s)    FFF$!QA4E4EA4E4E4Er   c                $    i | ]\  }}|v	||S r   r   r   s      r   r   z9_additional_properties.<locals>._init.<locals>.<dictcomp>#   s)    JJJ$!QA\4I4IA4I4I4Ir   )itemsadditional_properties)selfkwargsknownextrar   original_inits       r   _initz%_additional_properties.<locals>._init!   sk    FFFF&,,..FFFJJJJ&,,..JJJd$$e$$$%*"""r   r   __signature__)
parameters)__init__inspect	signature	frozensetdataclassesfieldslistr    valuesappend	ParameterVAR_KEYWORDsetattrreplace)clsoriginal_sigr   paramsr   r   s       @@r   _additional_propertiesr1      s     LM$]33LEE[-?-D-DEEEEEL+ + + + + + ,)002233F
MM'#Hg.?.KLLMMME?L$8$8F$8$K$KLLLCLJr   groupstrr   returntypec           	        	 t          t          t          | |                    d          }|t          d| d|  d          |                                S # t          $ r  t
          $ r}t          d| d|  d|           |d}~ww xY w)	u  Load a plugin class from an entry point group by name.

    Returns the loaded class — callers are responsible for instantiation
    with whatever arguments their config requires.

    Raises:
        ConfigurationError: If the entry point is not found or fails to load.
    )r2   r   NzPlugin 'z' not found in group 'z<'. Make sure the package providing this plugin is installed.zFailed to load plugin 'z' from group 'z': )nextiterr   r   load	Exception)r2   r   epexcs       r   load_entry_pointr=   2   s    $|%d;;;<<dCC:$L4 L Lu L L L   wwyy       IdII%IICII
 
	s   AA B.BBheaderslist | Noneheaders_list
str | Nonedict[str, str] | Nonec                   | |dS i }|r|                     d          D ]z}|                                }d|v rC|                     dd          \  }}|                                ||                                <   ]|rt                              d|           {| rL| D ]I}t	          |t
                    r!|                    d          pd||d         <   8|j        pd||j        <   J|S )	zMerge headers struct and headers_list into a dict.

    Returns None if neither is set, letting the exporter read env vars.
    headers struct takes priority over headers_list for the same key.
    N,=   z5Invalid header pair in headers_list (missing '='): %svalue r   )	splitstrip_loggerwarning
isinstancedictgetrG   r   )r>   r@   resultitemkeyrG   pairs          r   _parse_headersrT   K   s    </tF 
 &&s++ 		 		D::<<Dd{{!ZZQ//
U&+kkmmsyy{{## K    5 	5 	5D$%% 5'+xx'8'8'>BtF|$$$(J$4"ty!!Mr   F)allow_deflaterG   compression_enumrU   boolobject | Nonec               ,   | dS |                                  }t          |d          }|dk    rdS |dk    r|j        S |dk    r|r	|r|j        S ddg}|r|r|                    dd	           t          d
|  dd                    |           d          )z=Map a compression string to the given Compression enum value.NDeflatenonegzipdeflatez'gzip'z'none'rF   z	'deflate'zUnsupported compression value 'z'. Supported values: z, .)lowerhasattrGziprZ   insertr   join)rG   rV   rU   value_lowersupports_deflatesupported_valuess         r   _map_compressionrg   k   s     }t++--K/;;ftf$$iM6F'' (+ 0) 0;///
	*% 	* 	*99%&&	* 	* 	*  r   )r2   r3   r   r3   r4   r5   )r>   r?   r@   rA   r4   rB   )rG   rA   rV   r5   rU   rW   r4   rX   )
__future__r   r%   r"   logging,opentelemetry.sdk._configuration._exceptionsr   &opentelemetry.util._importlib_metadatar   	getLogger__name__rK   r1   r=   rT   rg   r   r   r   <module>rn      s    # " " " " "       K K K K K K ? ? ? ? ? ?
'
H
%
%  D   2   H  	       r   