
    osj7                         d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ dedefd	Zedefd
       ZdefdZg dZy)a  
Caching and compatibility wrapper for standard library ``importlib.metadata``.

This module caches ``entry_points()`` to avoid reloading entry points from disk on every call.
It also normalizes minor differences across python versions 3.10+. References to issues:

- https://github.com/open-telemetry/opentelemetry-python/pull/4735
- https://github.com/open-telemetry/opentelemetry-python/pull/5203
    N)cache)Distribution
EntryPointEntryPointsPackageNotFoundErrordistributionsrequiresversion)entry_points)Anyepsreturnc                      t         t              r S t         t              r;t        t        j                  j                  t        j                                     S t         fd j                  D              S )Nc              3   P   K   | ]  }j                  |       D ]  }|   yw))groupN)select).0r   epr   s      Y/root/.hermes/venv/lib/python3.12/site-packages/opentelemetry/util/_importlib_metadata.py	<genexpr>z#_as_entry_points.<locals>.<genexpr>(   s3      SZZeZ-D')
s   #&)
isinstancer   dict	itertoolschainfrom_iterablevaluesgroups)r   s   `r   _as_entry_pointsr      s_    #{#

 #t9??88S9IJKK 

      c                  (    t        t                     S )N)r   original_entry_points r   r   _original_entry_points_cachedr#   -   s    1344r   c                  6     t               j                  di | S )Nr"   )r#   r   )paramss    r   r   r   2   s    1(*11;F;;r   )r   r
   r   r   r	   r   r   r   )__doc__r   	functoolsr   importlib.metadatar   r   r   r   r   r	   r
   r   r!   typingr   r   r#   __all__r"   r   r   <module>r+      sk        E # +   5{ 5 5<k <	r   