Sindbad~EG File Manager
3
�^� � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ G dd� d�Z G dd � d e �Z
G d
d� de�ZG dd
� d
e�ZG dd� de�Z
G dd� de�ZG dd� d�ZdS )z�
SETools descriptors.
These classes override how a class's attributes are get/set/deleted.
This is how the @property decorator works.
See https://docs.python.org/3/howto/descriptor.html
for more details.
� N)�ABC�abstractmethod)�defaultdict)�WeakKeyDictionaryc @ s, e Zd ZdZd dd�Zd
dd�Zdd� ZdS )�CriteriaDescriptora�
Single item criteria descriptor.
Keyword Parameters:
name_regex The name of instance's regex setting attribute;
used as name_regex below. If unset,
regular expressions will never be used.
lookup_function The name of the SELinuxPolicy lookup function,
e.g. lookup_type or lookup_boolean.
default_value The default value of the criteria. The default
is None.
enum_class The class of enumeration which supports a
lookup class method.
Read-only instance attribute use (obj parameter):
policy The instance of SELinuxPolicy
name_regex This attribute is read to determine if
the criteria should be looked up or
compiled into a regex. If the attribute
does not exist, False is assumed.
Nc C s$ || _ || _|| _|| _t� | _d S )N)�regex�
default_value�lookup_function�
enum_classr � instances)�selfZ
name_regexr r r
� r
�#/usr/lib64/python3.6/descriptors.py�__init__C s
zCriteriaDescriptor.__init__c C s |d kr| S | j j|| j�S )N)r �
setdefaultr )r �obj�objtyper
r
r �__get__R s zCriteriaDescriptor.__get__c C s� |sd | j |<