Your IP : 18.224.44.249


Current Path : /lib64/python2.7/site-packages/sepolgen/
Upload File :
Current File : //lib64/python2.7/site-packages/sepolgen/output.pyo

�
��^c@s�dZddlmZddlmZejrBddlmZnddd��YZd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
S(si
Classes and functions for the output of reference policy modules.

This module takes a refpolicy.Module object and formats it for
output using the ModuleWriter object. By separating the output
in this way the other parts of Madison can focus solely on
generating policy. This keeps the semantic / syntactic issues
cleanly separated from the formatting issues.
i(t	refpolicy(tutil(tcmptModuleWritercBseZd�Zd�ZRS(cCs(d|_d|_t|_t|_dS(N(tNonetfdtmoduletTruetsorttrequires(tself((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt__init__&s			cCsf||_|jr"t|j�nx=tj|jdt�D]#\}}|jdt|��q;WdS(Nt	showdepths%s
(RRtsort_filterRtwalktreeRtwritetstr(R
RRtnodetdepth((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyR,s
		%(t__name__t
__module__RR(((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyR%s	cCs�tj|�}|j�tj|�}|j�t|�t|�kr_t|d|d�Sx@t||�D]/}|d|dkrot|d|d�SqoWdS(Nii(Rtset_to_listRtlenRtzip(txtytxltyltv((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt
id_set_cmp=s

cCs�t|j|j�}|dk	r%|St|j|j�}|dk	rJ|St|j|j�}|dk	ro|Stt|j�t|j��S(Ni(Rt	src_typest	tgt_typestobj_classesRRtperms(tatbtret((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt
avrule_cmpKscCsH|jd|jdkr5t|jd|jd�St|j|j�S(Ni(targsRtifname(R"R#((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt
ifcall_cmpZscCs�t|tj�rNt|tj�r1t||�St|jdg|j�Sn9t|tj�rmt||�St|j|jdg�SdS(Ni(	t
isinstanceRt
InterfaceCallR(RR&RtAVRuleR%(R"R#((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pytrule_cmp`s

cCst|j|j�S(N(Rtrole(R"R#((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt
role_type_cmplscCs.d�}x|j�D]}||�qWdS(s/Sort and group the output for readability.
    cSs6g}x4|j�D]&}|j|�|jtj��qWx!|j�D]}|j|�qJW|jtj��g}|j|j��|j|j��|jdt	j
t��d}g}x�|D]�}t
|tj�r�|jd}nt	j|j�}||krd|r.|jtj��n|}tj�}	|	jjd|�|j|	�n|j|�q�W|j|�g}
|
j|j��|
jdt	j
t��t|
�r�tj�}	|	jjd�|j|	�n|j|
�x-|jD]"}||kr|j|�qqW||_dS(Ntkeyis============= %s ==============s"============= ROLES ==============(tmodule_declarationstappendRtCommentR	textendtavrulestinterface_callsRRt
cmp_to_keyR,RR)R*R&tfirstRtlinest
role_typesR.Rtchildren(Rtctmodtrequiretrulestcurt	sep_rulestruleRtcommenttrastchild((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt	sort_nodersL



N(tnodes(RRER((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyR
os	<N((
t__doc__tRRtPY3RRRR%R(R,R.R
(((s5/usr/lib64/python2.7/site-packages/sepolgen/output.pyt<module>s