3 Kl�f�} � @ sb d dl Z d dlZd ZdZdZdZdZdZddd d ddgZeeeeeed �Z G dd� d�Z G dd� de �ZG dd� de �Zdzdd�Z d{dd�Zd}dd�Zdd� ZG d d!� d!e�ZG d"d#� d#e�ZG d$d%� d%e�ZG d&d'� d'�ZG d(d)� d)e�ZG d*d+� d+e�ZG d,d-� d-e�ZG d.d/� d/e�ZG d0d1� d1e�ZG d2d3� d3e�ZG d4d5� d5e�ZG d6d7� d7e�ZG d8d9� d9e�ZG d:d;� d;e�ZG d<d=� d=e�Z G d>d?� d?e�Z!G d@dA� dAe�Z"G dBdC� dCe�Z#G dDdE� dEe�Z$G dFdG� dGe�Z%G dHdI� dIe�Z&G dJdK� dKe�Z'G dLdM� dMe�Z(G dNdO� dOe�Z)G dPdQ� dQe�Z*G dRdS� dSe�Z+G dTdU� dUe�Z,G dVdW� dWe�Z-G dXdY� dYe�Z.G dZd[� d[e�Z/G d\d]� d]e�Z0d^d_� Z1G d`da� dae�Z2G dbdc� dce�Z3G ddde� dee�Z4G dfdg� dge�Z5G dhdi� die�Z6G djdk� dke�Z7G dldm� dme�Z8G dndo� doe�Z9G dpdq� dqe�Z:G drds� dse�Z;G dtdu� du�Z<G dvdw� dw�Z=G dxdy� dy�Z>dS )~� N� � � � � �source�target�object� permission�role�destination)r r r r r r c @ s e Zd Zddd�ZdS )� PolicyBaseNc C s d | _ d | _d S )N)�parent�comment)�selfr � r �/usr/lib/python3.6/refpolicy.py�__init__5 s zPolicyBase.__init__)N)�__name__� __module__�__qualname__r r r r r r 4 s r c @ s� e Zd ZdZd/dd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� ZdS )0�Nodea� Base class objects produced from parsing the reference policy. The Node class is used as the base class for any non-leaf object produced by parsing the reference policy. This object should contain a reference to its parent (or None for a top-level object) and 0 or more children. The general idea here is to have a very simple tree structure. Children are not separated out by type. Instead the tree structure represents fairly closely the real structure of the policy statements. The object should be iterable - by default over all children but subclasses are free to provide additional iterators over a subset of their childre (see Interface for example). Nc C s t j| |� g | _d S )N)r r �children)r r r r r r J s z Node.__init__c C s t | j�S )N)�iterr )r r r r �__iter__N s z Node.__iter__c C s t dd� t| ��S )Nc S s t | t�S )N)� isinstancer )�xr r r �<lambda>W s zNode.nodes.<locals>.<lambda>)�filter�walktree)r r r r �nodesV s z Node.nodesc C s t dd� t| ��S )Nc S s t | t�S )N)r �Module)r r r r r Z s zNode.modules.<locals>.<lambda>)r r )r r r r �modulesY s zNode.modulesc C s t dd� t| ��S )Nc S s t | t�S )N)r � Interface)r r r r r ] s z!Node.interfaces.<locals>.<lambda>)r r )r r r r � interfaces\ s zNode.interfacesc C s t dd� t| ��S )Nc S s t | t�S )N)r �Template)r r r r r ` s z Node.templates.<locals>.<lambda>)r r )r r r r � templates_ s zNode.templatesc C s t dd� t| ��S )Nc S s t | t�S )N)r � SupportMacros)r r r r r c s z%Node.support_macros.<locals>.<lambda>)r r )r r r r �support_macrosb s zNode.support_macrosc C s t dd� t| ��S )Nc S s t | t�S )N)r �ModuleDeclaration)r r r r r h s z*Node.module_declarations.<locals>.<lambda>)r r )r r r r �module_declarationsg s zNode.module_declarationsc C s t dd� t| ��S )Nc S s t | t�S )N)r � InterfaceCall)r r r r r k s z&Node.interface_calls.<locals>.<lambda>)r r )r r r r �interface_callsj s zNode.interface_callsc C s t dd� t| ��S )Nc S s t | t�S )N)r �AVRule)r r r r r n s zNode.avrules.<locals>.<lambda>)r r )r r r r �avrulesm s zNode.avrulesc C s t dd� t| ��S )Nc S s t | t�S )N)r � AVExtRule)r r r r r q s z!Node.avextrules.<locals>.<lambda>)r r )r r r r � avextrulesp s zNode.avextrulesc C s t dd� t| ��S )Nc S s t | t�S )N)r �TypeRule)r r r r r t s z Node.typerules.<locals>.<lambda>)r r )r r r r � typeruless s zNode.typerulesc C s t dd� t| ��S )Nc S s t | t�S )N)r � TypeBound)r r r r r w s z!Node.typebounds.<locals>.<lambda>)r r )r r r r � typeboundsv s zNode.typeboundsc C s t dd� t| ��S )zAIterate over all of the TypeAttribute children of this Interface.c S s t | t�S )N)r � TypeAttribute)r r r r r { s z%Node.typeattributes.<locals>.<lambda>)r r )r r r r �typeattributesy s zNode.typeattributesc C s t dd� t| ��S )zAIterate over all of the RoleAttribute children of this Interface.c S s t | t�S )N)r � RoleAttribute)r r r r r s z%Node.roleattributes.<locals>.<lambda>)r r )r r r r �roleattributes} s zNode.roleattributesc C s t dd� t| ��S )Nc S s t | t�S )N)r �Require)r r r r r � s zNode.requires.<locals>.<lambda>)r r )r r r r �requires� s z Node.requiresc C s t dd� t| ��S )Nc S s t | t�S )N)r �Role)r r r r r � s zNode.roles.<locals>.<lambda>)r r )r r r r �roles� s z Node.rolesc C s t dd� t| ��S )Nc S s t | t�S )N)r � RoleAllow)r r r r r � s z"Node.role_allows.<locals>.<lambda>)r r )r r r r �role_allows� s zNode.role_allowsc C s t dd� t| ��S )Nc S s t | t�S )N)r �RoleType)r r r r r � s z!Node.role_types.<locals>.<lambda>)r r )r r r r � role_types� s zNode.role_typesc C s( | j rt| j �d | j� S | j� S d S )N� )r �str� to_string)r r r r �__str__� s zNode.__str__c C s d| j j| j� f S )Nz<%s(%s)>)� __class__r rC )r r r r �__repr__� s z Node.__repr__c C s dS )N� r )r r r r rC � s zNode.to_string)N)r r r �__doc__r r r r"