File: //usr/lib/python3/dist-packages/uaclient/entitlements/__pycache__/__init__.cpython-310.pyc
o
�~c< � @ s� d dl Z d dlZd dlmZmZmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
d dlmZ d dlmZ d d lmZmZ d d
lmZ d dlmZ d dlmZmZ d d
lmZ d dlmZ eeeeej ej!eeeeg
Z"de de#fdd�Z$ d/de de%de%dee# fdd�Z&de dee# dee# fdd�Z'e j(G dd� de j)��Z*de dee# fdd�Z+de dee# fd d!�Z,de d"ee
d#e*d$ee#e%f d%ee# f
d&d'�Z-de d#e*dee# fd(d)�Z.d*ee# de fd+d,�Z/de de%dej0fd-d.�Z1dS )0� N)�Dict�List�Type)�messages)�UAConfig)�fips)�
UAEntitlement)�CommonCriteriaEntitlement)�CISEntitlement)�ESMAppsEntitlement�ESMInfraEntitlement)�LivepatchEntitlement)�RealtimeKernelEntitlement)�ROSEntitlement�ROSUpdatesEntitlement)�EntitlementNotFoundError)�is_config_value_true�cfg�namec C s* t D ]}||| d�jv r| S qt|��)a Returns a UAEntitlement class based on the provided name.
The return type is Optional[Type[UAEntitlement]].
It cannot be explicit because of the Python version on Xenial (3.5.2).
:param cfg: UAConfig instance
:param name: The name of the entitlement to return
:param not_found_okay: If True and no entitlement with the given name is
found, then returns None.
:raise EntitlementNotFoundError: If not_found_okay is False and no
entitlement with the given name is found, then raises this error.
�r )�ENTITLEMENT_CLASSES�valid_namesr )r r �entitlement� r �@/usr/lib/python3/dist-packages/uaclient/entitlements/__init__.py�entitlement_factory s
�r F�
allow_beta� all_names�returnc sl t � jd�}||O }t}|sdd� |D �}|r+g }|D ]}|�|� d�j� qt|�S t� fdd�|D ��S )a Return a list of valid (non-beta) services.
:param cfg: UAConfig instance
:param allow_beta: if we should allow beta services to be marked as valid
:param all_names: if we should return all the names for a service instead
of just the presentation_name
zfeatures.allow_betac S s g | ]}|j s|�qS r )�is_beta��.0r r r r �
<listcomp>A s ��z"valid_services.<locals>.<listcomp>r c s g | ]}|� d �j �qS )r )�presentation_namer r r r r"