File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/entrypoints.cpython-310.pyc
Back
o ;jM � @ sf d dl Z d dlZd dlZd dlZd dlmZ e�e�Zddd�dd�Z e dd �dd d��Z dd � ZdS )� N)�importlib_metadata� F��maxsize�typedc s � ��fdd�}|S )z� This decorator is the same in behavior as functools.lru_cache with the exception that it times out after the provided ``timeout_seconds`` c sB t j��d�� �� �� _t�� � j � _t �� �� fdd��}|S )Nr c s4 t �� }|� jkr� �� |� j � _� | i |��S �N)�time� monotonic� expiration�cache_clear�delta)�args�kwargs�now��f� �J/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/entrypoints.py�_wrapped s z3timed_lru_cache.<locals>._wrapper.<locals>._wrapped)� functools� lru_cacher r r r �wraps)r r �r �timeout_secondsr r r �_wrapper s z!timed_lru_cache.<locals>._wrapperr )r r r r r r r �timed_lru_cache s r g �?)r c C s� g }t �� }z|j| d�D ]}|d ur|j|krq |�|� q W |S tyM |�� D ]\}}|| kr5q,|D ]}|d urC|j|krCq7|�|� q7q,Y |S w )N)�group)r �entry_points�select�name�append�AttributeError�items)r r Zentry_points_listingr �entry_pointZentry_point_groupZentry_points_listr r r �iter_entry_points$ s* �����r$ c C s t j| jjd | jjd�S )Nr )r �version)�types�SimpleNamespace�dist�metadatar% )r# r r r �!name_and_version_from_entry_point; s �r* r )r �loggingr r&