File manager - Edit - /usr/lib/python3/dist-packages/uaclient/entitlements/__pycache__/__init__.cpython-310.pyc
Back
o KHvd" � @ 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"d1de de#de#fdd�Z$ d2de de%de%dee# fdd�Z&de dee# dee# fdd�Z'e j(G dd� de j)��Z*de dee# fd d!�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/d0�Z1dS )3� N)�Dict�List�Type)�messages)�UAConfig)�fips)� UAEntitlement)�CommonCriteriaEntitlement)�CISEntitlement)�ESMAppsEntitlement�ESMInfraEntitlement)�LivepatchEntitlement)�RealtimeKernelEntitlement)�ROSEntitlement�ROSUpdatesEntitlement)�EntitlementNotFoundError)�is_config_value_true� �cfg�name�variantc C sR t D ]"}|| d�}||jv r$|s| S ||jv r |j| S t|��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_names�variantsr )r r r �entitlement�ent� 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>G s ��z"valid_services.<locals>.<listcomp>r c s g | ]}|� d �j �qS )r )�presentation_namer$ r r r r&