+
    	:i  c                   s   ^ RI t ^ RIt^ t^t^t^t^t^t. RmOtR]R]R]R]R]R]/t	 ! R R	4      t
 ! R
 R]
4      t ! R R]
4      tRnR ltRoR ltRpR ltR t ! R R]4      t ! R R]4      t ! R R]4      t ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R  R!]4      t ! R" R#]4      t ! R$ R%]4      t ! R& R']4      t ! R( R)]4      t ! R* R+]4      t ! R, R-]4      t ! R. R/]4      t  ! R0 R1]4      t! ! R2 R3]4      t" ! R4 R5]4      t# ! R6 R7]4      t$ ! R8 R9]4      t% ! R: R;]4      t& ! R< R=]4      t' ! R> R?]4      t( ! R@ RA]4      t) ! RB RC]4      t* ! RD RE]4      t+ ! RF RG]4      t, ! RH RI]4      t- ! RJ RK]4      t. ! RL RM]4      t/ ! RN RO]4      t0RP t1 ! RQ RR]4      t2 ! RS RT]4      t3 ! RU RV]4      t4 ! RW RX]4      t5 ! RY RZ]4      t6 ! R[ R\]4      t7 ! R] R^]4      t8 ! R_ R`]4      t9 ! Ra Rb]4      t: ! Rc Rd]4      t; ! Re Rf]4      t< ! Rg Rh4      t= ! Ri Rj4      t> ! Rk Rl4      t?R# )q    Nsourcetargetobject
permissionroledestinationc                   s*   a  ] tR t^4t o RR ltRtV tR# )
PolicyBaseNc                s0    R V n         R V n        RV n        R # )NF)parentcommentgen_cilselfr      &&7/usr/lib/python3.14/site-packages/sepolgen/refpolicy.py__init__ZPolicyBase.__init__5   s        )r	   r
   r   N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell__Z__classdict__   @r   r   r   4   s      r   r   c                   s   a  ] tR t^:t o RtRR ltR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )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                >    \         P                  W4       . V n        R # r   )r   r   childrenr   r   r   r   ZNode.__init__K   s    D)r   c                s,    \        V P                  4      # r   )Ziterr   r      &r   __iter__ZNode.__iter__O   s    DMM""r   c                .    \        R  \        V 4      4      # )c                 "    \        V \        4      # r   )
isinstancer   xr   r   <lambda>ZNode.nodes.<locals>.<lambda>X       
1d 3r   Zfilterwalktreer   r   r   nodesZ
Node.nodesW       3Xd^DDr   c                r    )c                 r!   r   )r"   Moduler#   r   r   r%   ZNode.modules.<locals>.<lambda>[       
1f 5r   r'   r   r   r   modulesZNode.modulesZ       5x~FFr   c                r    )c                 r!   r   )r"   	Interfacer#   r   r   r%   Z!Node.interfaces.<locals>.<lambda>^       
1i 8r   r'   r   r   r   
interfacesZNode.interfaces]       8(4.IIr   c                r    )c                 r!   r   )r"   Templater#   r   r   r%   Z Node.templates.<locals>.<lambda>a       
1h 7r   r'   r   r   r   	templatesZNode.templates`       7$HHr   c                r    )c                 r!   r   )r"   SupportMacrosr#   r   r   r%   Z%Node.support_macros.<locals>.<lambda>d       
1m <r   r'   r   r   r   support_macrosZNode.support_macrosc       <htnMMr   c                r    )c                 r!   r   )r"   ModuleDeclarationr#   r   r   r%   Z*Node.module_declarations.<locals>.<lambda>i   s    
1.? @r   r'   r   r   r   module_declarationsZNode.module_declarationsh   s    @(4.QQr   c                r    )c                 r!   r   )r"   InterfaceCallr#   r   r   r%   Z&Node.interface_calls.<locals>.<lambda>l   r8   r   r'   r   r   r   interface_callsZNode.interface_callsk   r:   r   c                r    )c                 r!   r   )r"   AVRuler#   r   r   r%   ZNode.avrules.<locals>.<lambda>o   r,   r   r'   r   r   r   avrulesZNode.avrulesn   r.   r   c                r    )c                 r!   r   )r"   	AVExtRuler#   r   r   r%   Z!Node.avextrules.<locals>.<lambda>r   r0   r   r'   r   r   r   
avextrulesZNode.avextrulesq   r2   r   c                r    )c                 r!   r   )r"   TypeRuler#   r   r   r%   Z Node.typerules.<locals>.<lambda>u   r4   r   r'   r   r   r   	typerulesZNode.typerulest   r6   r   c                r    )c                 r!   r   )r"   	TypeBoundr#   r   r   r%   Z!Node.typebounds.<locals>.<lambda>x   r0   r   r'   r   r   r   
typeboundsZNode.typeboundsw   r2   r   c                .    \        R \        V 4      4      # )zAIterate over all of the TypeAttribute children of this Interface.c                 r!   r   )r"   TypeAttributer#   r   r   r%   Z%Node.typeattributes.<locals>.<lambda>|   r8   r   r'   r   r   r   typeattributesZNode.typeattributesz       <htnMMr   c                rG   )zAIterate over all of the RoleAttribute children of this Interface.c                 r!   r   )r"   RoleAttributer#   r   r   r%   Z%Node.roleattributes.<locals>.<lambda>   r8   r   r'   r   r   r   roleattributesZNode.roleattributes~   rJ   r   c                r    )c                 r!   r   )r"   Requirer#   r   r   r%   ZNode.requires.<locals>.<lambda>   s    
1g 6r   r'   r   r   r   requiresZNode.requires   s    6GGr   c                r    )c                 r!   r   )r"   Roler#   r   r   r%   ZNode.roles.<locals>.<lambda>   r&   r   r'   r   r   r   rolesZ
Node.roles   r*   r   c                r    )c                 r!   r   )r"   	RoleAllowr#   r   r   r%   Z"Node.role_allows.<locals>.<lambda>   r0   r   r'   r   r   r   role_allowsZNode.role_allows   r2   r   c                r    )c                 r!   r   )r"   RoleTyper#   r   r   r%   Z!Node.role_types.<locals>.<lambda>   r4   r   r'   r   r   r   
role_typesZNode.role_types   r6   r   c                    V P                   '       d2   \        V P                   4      R ,           V P                  4       ,           # V P                  4       # 
r	   str	to_stringr   r   r   __str__ZNode.__str__   8    <<<t||$t+dnn.>>>>>##r   c                \    R V P                   P                  : RV P                  4       : R2# Z<(z)>Z	__class__r   rZ   r   r   r   __repr__ZNode.__repr__       !^^44dnn6FGGr   c                    R #   r   r   r   rZ   ZNode.to_string       r   c                    Wn         R # r   r
   r   r
   r   r   set_gen_cilZNode.set_gen_cil       r   )r   r
   r   )r   r   r   r   __doc__r   r   r)   r-   r1   r5   r9   r<   r>   r@   rB   rD   rF   rI   rL   rN   rP   rR   rT   r[   ra   rZ   rk   r   r   r   r   r   r   r   :   s      #EGJIN
RNGJIJNNHEJI$H r   r   c                   sB   a  ] tR t^t o RR ltR tR tR tR tRt	V t
R# )	LeafNc                0    \         P                  W4       R # r   )r   r   r   r   r   r   ZLeaf.__init__   s    D)r   c                rU   rV   rX   r   r   r   r[   ZLeaf.__str__   r\   r   c                r]   r^   r`   r   r   r   ra   ZLeaf.__repr__   rb   r   c                rc   rd   rf   r   r   r   rZ   ZLeaf.to_string   rg   r   c                rh   r   ri   rj   r   r   rk   ZLeaf.set_gen_cil   rl   r   ri   r   )r   r   r   r   r   r[   ra   rZ   rk   r   r   r   r   r   rn   rn      s$     *$H r   rn   c              #  s  "   V'       d   RpM^ pV ^ 3.p\        V4      ^ 8  d   VP                  V4      w  rgV'       d   Wg3x  MVx  \        V\        4      '       g   KM  . p\        VP                  4      ^,
          p	V	^ 8  d^   Ve$   \        VP                  V	,          V4      '       d,   VP                  VP                  V	,          V^,           34       V	^,          p	Kd  VP                  V4       K  R# 5i)a}  Iterate over a Node and its Children.

The walktree function iterates over a tree containing Nodes and
leaf objects. The iteration can perform a depth first or a breadth
first traversal of the tree (controlled by the depthfirst
parameter. The passed in node will be returned.

This function will only work correctly for trees - arbitrary graphs
will likely cause infinite looping.
Ni)lenZpopr"   r   r   appendextend)
nodeZ
depthfirst	showdepthtypeZindexZstackZcurdepthitemsis
   &&&&      r   r(   r(      s      AYKE
e*q.YYu%
*I c4  ECLL!A%Aq&<:cll1ot#D#DLL#,,q/519!=>QLL# s   AC9"BC9c              #  sV   "   V  F  pVe   \        W!4      '       g   K  Vx  K   	  R# 5i)a  Iterate over the direct children of a Node.

The walktree function iterates over the children of a Node.
Unlike walktree it does note return the passed in node or
the children of any Node objects (that is, it does not go
beyond the current level in the tree).
N)r"   )rs   ru   r$      && r   walknoderz      s%      <:a..G s   )
)c                s    \        V 4      pRpV^8  d   \        R4      hRP                  V 4      pV^8X  d   V# V^ ,          R,           V,           R,           V^,          ,           # )zConvert a set (or any sequence type) into a string representation
formatted to match SELinux space separated list conventions.

For example the list ['read', 'write'] would be converted into:
'{ read write }'
re   z"cannot convert 0 len set to string rp   
ValueErrorjoin)scontlrY      &&  r   list_to_space_strr      s_     	AA
C1u=>>
((1+CAv
Aw}s"S(4722r   c                 s^    \        V 4      pV^8  d   \        R4      hRP                  V 4      # )i   z(cannot convert 0 len set to comma string, r|   )r   r      & r   list_to_comma_strr      s,    AA1uCDD99Q<r   c                   6   a  ] tR tRt o RR ltR tR tRtV tR# )IdSeti   Nc                sz    V'       d   \         P                  W4       M\         P                  V 4       R V n        R# FN)setr   
compliment)r   listr   r   r   ZIdSet.__init__  s$    LL$LLr   c                *    \        \        V 4      4      # r   )r   sortedr   r   r   to_space_strZIdSet.to_space_str       ..r   c                r   r   )r   r   r   r   r   to_comma_strZIdSet.to_comma_str  r   r   )r   r   )	r   r   r   r   r   r   r   r   r   r   r   r   r   r      s      // /r   r   c                   sD   a  ] tR tRt o RtR	R ltR tR tR
R ltRt	V t
R# )SecurityContexti  z;An SELinux security context with optional MCS / MLS fields.Nc                s    \         P                  W4       RV n        RV n        RV n        RV n        Ve   V P                  V4       R# R# )zCreate a SecurityContext object, optionally from a string.

Parameters:
   [context] - string representing a security context. Same format
      as a string passed to the from_string method.
re   N)rn   r   userr   ru   levelfrom_string)r   contextr      &&&r   r   ZSecurityContext.__init__  sE     	d#			
W% r   c                s   \         P                  ! V4      pV^ ,          ^ 8X  d
   V^,          pVP                  R4      p\        V4      ^8  d   \	        RV,          4      hV^ ,          V n        V^,          V n        V^,          V n        \        V4      ^8  d    RP                  VR,          4      V n	        R# RV n	        R# )zParse a string representing a context into a SecurityContext.

The string should be in the standard format - e.g.,
'user:role:type:level'.

Raises ValueError if the string is not parsable as a security context.
:z)context string [%s] not in a valid format:i   NNN)
selinuxZselinux_trans_to_raw_contextZsplitrp   r}   r   r   ru   r~   r   )r   r   Zrawfieldsr   r   r   ZSecurityContext.from_string  s     227;q6Q;!fGs#v;?H7RSS1I	1I	1I	v;?&*-DJDJr   c                s    V P                   VP                   8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # )zCompare two SecurityContext objects - all fields must be exactly the
the same for the comparison to work. It is possible for the level fields
to be semantically the same yet syntactically different - in this case
this function will return false.
)r   r   ru   r   )r   otherr   r   __eq__ZSecurityContext.__eq__9  si     yyEJJ& ) )yyEJJ&) )yyEJJ&) ) zzU[[(	)r   c                s@   V P                   V P                  V P                  .pV P                  fC   Vf-   \        P
                  ! 4       ^8X  d   VP                  R4       M-VP                  V4       MVP                  V P                  4       RP                  V4      # )am  Return a string representing this security context.

By default, the string will contain a MCS / MLS level
potentially from the default which is passed in if none was
set.

Arguments:
   default_level - the default level to use if self.level is an
     empty string.

Returns:
   A string representing the security context in the form
      'user:role:type:level'.
Zs0r   )r   r   ru   r   r   Zis_selinux_mls_enabledrq   r~   )r   Zdefault_levelr   ry   r   rZ   ZSecurityContext.to_stringD  su     ))TYY		2::$113q8MM$'m,MM$**%xxr   )r   r   ru   r   NNr   )r   r   r   r   rm   r   r   r   rZ   r   r   r   r   r   r   r     s!     E&4	)   r   r   c                   s.   a  ] tR tRt o RtRR ltRtV tR# )ObjectClassi^  a  SELinux object class and permissions.

This class is a basic representation of an SELinux object
class - it does not represent separate common permissions -
just the union of the common and class specific permissions.
It is meant to be convenient for policy generation.
Nc                sZ    \         P                  W4       Wn        \        4       V n        R # r   )rn   r   namer   permsr   r   r   r   r   r   ZObjectClass.__init__f  s    d#	W
r   r   r   re   N)r   r   r   r   rm   r   r   r   r   r   r   r   r   ^  s      r   r   c                   sP   a  ] tR tRt o RtRR ltR tR tRR ltR t	R	 t
R
tV tR# )XpermSetik  a  Extended permission set.

This class represents one or more extended permissions
represented by numeric values or ranges of values. The
.complement attribute is used to specify all permission
except those specified.

Two xperm set can be merged using the .extend() method.
c                s     Wn         . V n        R # r   
complementranges)r   r   r   r   r   ZXpermSet.__init__u  s    $r   c                sX   V P                   P                  4        ^ pV\        V P                   4      8  d   V^,           \        V P                   4      8  d   V P                   V^,           ,          ^ ,          V P                   V,          ^,          ^,           8:  d   V P                   V,          ^ ,          \        V P                   V,          ^,          V P                   V^,           ,          ^,          4      3V P                   V&   V P                   V^,            K   V^,          pEK  R# )z0Ensure that ranges are not overlapping.
        N)r   Zsortrp   Zmax)r   rx   r   r   Z__normalize_rangesZXpermSet.__normalize_rangesy  s     	#dkk""a%#dkk**;;q1u%a(DKKN1,=,AA&*kk!nQ&7T[[^A=N=A[[Q=OPQ=R:T &UDKKNAE*FA #r   c                sp    V P                   P                  VP                   4       V P                  4        R# )z%Add ranges from an xperm set
        N)r   rr   _XpermSet__normalize_rangesr   r   r   r   rr   ZXpermSet.extend  s&     	188$!r   Nc                sj    Vf   TpV P                   P                  W34       V P                  4        R# )z7Add value of range of values to the xperm set.
        N)r   rq   r   )r   ZminimumZmaximumr   r   addZXpermSet.add  s/     ?GG-.!r   c                s   V P                   '       g   R # V P                  '       d   RMR p\        V P                   4      ^8X  db   V P                   ^ ,          ^ ,          V P                   ^ ,          ^,          8X  d+   V\        V P                   ^ ,          ^ ,          4      ,           # \	        R V P                   4      pV: RRP                  V4      : R2# )re   z~ c                 s    V ^ ,          V ^,          8X  d   \        V ^ ,          4      # \        V ^ ,          4      : R\        V ^,          4      : 2# )r    Z-hexr#   r   r   r%   Z$XpermSet.to_string.<locals>.<lambda>  s<    !A$!A$,S1Y^s1Q4yRUVWXYVZR[<^^r   z{ r{   z })r   r   rp   r   mapr~   r   ZcomplZvals   &  r   rZ   ZXpermSet.to_string  s    {{{R t{{q T[[^A%6$++a.:K%K3t{{1~a0111^`d`k`kl"CHHTN33r   c                s    V P                   '       g   R # V P                  '       d   RMRp\        R V P                   4      pRV^ ,          : RP                  V4      : V^,          : R2# )re   )c                 s    V ^ ,          V ^,          8X  d   \        V ^ ,          4      # R\        V ^ ,          4      : R\        V ^,          4      : R2# )r    z(range r{   r   r   r#   r   r   r%   Z(XpermSet.to_string_cil.<locals>.<lambda>  sA    !A$!A$,S1Yf,sSTUVSWyZ]^_`a^bZc<ffr   r_   r{   )znot (r   re   re   )r   r   r   r~   r   r   r   to_string_cilZXpermSet.to_string_cil  sP    {{{"&///xfhlhshst"1Xsxx~uQxx@@r   r   )Fr   )r   r   r   r   rm   r   r   rr   r   rZ   r   r   r   r   r   r   r   r   k  s/      ""4A Ar   r   c                   4   a  ] tR tRt o RtRR ltR tRtV tR# )rH   i  zSSElinux typeattribute statement.

This class represents a typeattribute statement.
Nc                \    \         P                  W4       R V n        \        4       V n        R# r   )rn   r   ru   r   
attributesr   r   r   r   ZTypeAttribute.__init__  s    d#	'r   c                s   V P                   '       dD   R pV P                   F/  pVRV,          ,          pVRV: RV P                  : R2,          pK1  	  V# RV P                  : RV P                  P                  4       : R2# )re   z(typeattribute %s)
(typeattributeset r{   )
ztypeattribute ;)r
   r   ru   r   r   r   ar   r   rZ   ZTypeAttribute.to_string  sk    <<<A__+a//Q		BB % H  .2YY8T8T8VWWr   )r   ru   r   	r   r   r   r   rm   r   rZ   r   r   r   r   r   rH   rH     s     "
X Xr   rH   c                   r   )rK   i  zSSElinux roleattribute statement.

This class represents a roleattribute statement.
Nc                r   r   )rn   r   r   r   rL   r   r   r   r   ZRoleAttribute.__init__  s    d#	#gr   c                s   V P                   '       dD   R pV P                   F/  pVRV,          ,          pVRV: RV P                  : R2,          pK1  	  V# RV P                  : RV P                  P	                  4       : R2# )re   z(roleattribute %s)
z(roleattributeset r{   r   zroleattribute r   )r
   rL   ru   r   r   r   r   r   rZ   ZRoleAttribute.to_string  so    <<<A((+a//Q		BB ) H  .2YY8K8K8X8X8Z[[r   )r   rL   r   r   r   r   r   rK   rK     s     &
\ \r   rK   c                   0   a  ] tR tRt o RR ltR tRtV tR# )rO   i  Nc                r   r   rn   r   r   r   typesr   r   r   r   ZRole.__init__      d#	W
r   c                s   V P                   '       dE   R V P                  ,          pV P                   F  pVRV P                  : RV: R2,          pK!  	  V# RpV P                   F  pVRV P                  : RV: R2,          pK!  	  V# )z
(role %s)

(roletype r{   r   re   role  types ;
)r
   r   r   r   r   Ztr   r   rZ   ZRole.to_string  sj    <<<		)AZZTYY::  HAZZdii;;  Hr   r   r   r   r   r   r   r   r   rZ   r   r   r   r   r   rO   rO     s     

 
r   rO   c                   r   )Typei  Nc                sx    \         P                  W4       Wn        \        4       V n        \        4       V n        R # r   )rn   r   r   r   r   aliasesr   r   r   r   ZType.__init__  s%    d#	'wr   c                sL   V P                   '       dt   R V P                  ,          pV P                   F  pVRV: RV P                  : R2,          pK!  	  V P                   F  pVRV: RV P                  : R2,          pK!  	  V# RV P                  ,          p\	        V P                  4      ^ 8  d)   VRV P                  P                  4       ,          ,           p\	        V P                  4      ^ 8  d)   VRV P                  P                  4       ,          ,           pVR,           # )	z
(type %s)
(typealiasactual r{   r   r   ztype %szalias %s, %sr   )r
   r   r   r   rp   r   r   r   r   r   rZ   ZType.to_string  s    <<<		)A\\AtyyAA "__Q		BB %HDII%A4<< 1$
T\\%>%>%@@@4??#a'!=!=!???s7Nr   )r   r   r   r   r   r   r   r   r   r     s      r   r   c                   r   )	TypeAliasi  Nc                r   r   )rn   r   ru   r   r   r   r   r   r   ZTypeAlias.__init__  s    d#	wr   c                s   V P                   '       dD   R pV P                   F/  pVRV,          ,          pVRV: RV P                  : R2,          pK1  	  V# RV P                  : RV P                  P                  4       : R2# )re   z(typealias %s)
r   r{   r   z
typealias z alias r   )r
   r   ru   r   r   r   r   rZ   ZTypeAlias.to_string	  sk    <<<A\\'!++AtyyAA " H  04yy$,,:S:S:UVVr   )r   ru   r   r   r   r   r   r   r     s     
W Wr   r   c                   r   )	Attributei  Nc                <    \         P                  W4       Wn        R # r   rn   r   r   r   r   r   r   ZAttribute.__init__      d#	r   c                r    V P                   '       d   R V P                  ,          # RV P                  ,          # )zattribute %s;z(typeattribute %s)r
   r   r   r   r   rZ   ZAttribute.to_string  s)    <<<"TYY..'$))33r   r   r   r   r   r   r   r   r          4 4r   r   c                   r   )Attribute_Rolei  Nc                r   r   r   r   r   r   r   ZAttribute_Role.__init__  r   r   c                r   )z(roleattribute %s)zattribute_role %s;r   r   r   r   rZ   ZAttribute_Role.to_string#  s)    <<<'$))33'$))33r   r   r   r   r   r   r   r   r     r   r   r   c                   sP   a  ] tR tRt o Rt^ t^t^t^tR	R lt	R t
R tR tRtV tR# )
r?   i,  a  SELinux access vector (AV) rule.

The AVRule class represents all varieties of AV rules including
allow, dontaudit, and auditallow (indicated by the flags self.ALLOW,
self.DONTAUDIT, and self.AUDITALLOW respectively).

The source and target types, object classes, and perms are all represented
by sets containing strings. Sets are used to make it simple to add
strings repeatedly while avoiding duplicates.

No checking is done to make certain that the symbols are valid or
consistent (e.g., perms that don't match the object classes). It is
even possible to put invalid types like '$1' into the rules to allow
storage of the reference policy interfaces.
Nc                s    \         P                  W4       \        4       V n        \        4       V n        \        4       V n        \        4       V n        V P                  V n        V'       d   V P                  V4       R # R # r   )
rn   r   r   	src_types	tgt_typesobj_classesr   ALLOW	rule_typefrom_av)r   avr   r   r   r   ZAVRule.__init__A  sR    d# 7W
LL r   c                    V P                   V P                  8X  d   R # V P                   V P                  8X  d   R# V P                   V P                  8X  d   R# V P                   V P                  8X  d   R# R# )ZallowZ	dontauditZ
auditallowZ
neverallowN)r   r   	DONTAUDIT
AUDITALLOW
NEVERALLOWr   r   r   __rule_type_strZAVRule.__rule_type_strK  sS    >>TZZ'^^t~~-^^t.^^t. /r   c                s   V P                   P                  VP                  4       VP                  VP                  8X  d   V P                  P                  R4       M%V P                  P                  VP                  4       V P
                  P                  VP                  4       V P                  P                  VP                  4       R# )z9Add the access from an access vector to this allow
rule.
r   N)	r   r   src_typetgt_typer   r   	obj_classr   update)r   r   r   r   r   ZAVRule.from_avU  s     	2;;';;"++%NNv&NNr{{+R\\*

"((#r   c                s2   V P                   '       d   RpV P                   Fn  pV P                   F[  pV P                   FH  pVRV P	                  4       : RV: RV: RV: RRP                  V P                  4      : R2,          pKJ  	  K]  	  Kp  	  V# V P	                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P                  P                  4       : R2
# )zReturn a string representation of the rule
that is a valid policy language representation (assuming
that the types, object class, etc. are valid).
re   r_   r{    (z)))r   r   )r
   r   r   r   _AVRule__rule_type_strr~   r   r   r   r   srctgtZobj   &    r   rZ   ZAVRule.to_stringa  s    
 <<<A~~>>C#//t7K7K7M7:C7:xx

7KM M  0 * & H(,(<(<(>(,(C(C(E(,(C(C(E(,(8(8(E(E(G(,

(?(?(A	C Cr   )r   r   r   r   r   r   )r   r   r   r   rm   r   r   r   r   r   r   r   rZ   r   r   r   r   r   r?   r?   ,  s;      EIJJ 
$C Cr   r?   c                   sV   a  ] tR tRt o Rt^ t^t^t^tR
R lt	R t
R tR tR tR	tV tR# )rA   iv  aR  Extended permission access vector rule.

The AVExtRule class represents allowxperm, dontauditxperm,
auditallowxperm, and neverallowxperm rules.

The source and target types, and object classes are represented
by sets containing strings. The operation is a single string,
e.g. 'ioctl'. Extended permissions are represented by an XpermSet.
Nc                s   \         P                  W4       \        4       V n        \        4       V n        \        4       V n        V P                  V n        \        4       V n	        W n
        V'       d   V P                  W4       R # R # r   )rn   r   r   r   r   r   
ALLOWXPERMr   r   xperms	operationr   )r   r   opr   s   &&&&r   r   ZAVExtRule.__init__  sW    d# 7jLL  r   c                r   )Z
allowxpermZdontauditxpermZauditallowxpermZneverallowxpermNr   r   DONTAUDITXPERMAUDITALLOWXPERMNEVERALLOWXPERMr   r   r   r   ZAVExtRule.__rule_type_str  sY    >>T__,^^t222#^^t333$^^t333$ 4r   c                r   )ZallowxZ
dontauditxZauditallowxZneverallowxNr   r   r   r   __rule_type_str_cilZAVExtRule.__rule_type_str_cil  sY    >>T__,^^t222^^t333 ^^t333  4r   c                s   V P                   P                  VP                  4       VP                  VP                  8X  d   V P                  P                  R 4       M%V P                  P                  VP                  4       V P
                  P                  VP                  4       W n        VP                  V,          V n        R# )r   N)	r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   ZAVExtRule.from_av  s|    2;;';;"++%NNv&NNr{{+R\\*iimr   c                sh   V P                   '       d   RpV P                   F{  pV P                   Fh  pV P                   FU  pVRV P	                  4       : RV: RV: RV P
                  : RV: RV P                  P                  4       : R2,          pKW  	  Kj  	  K}  	  V# V P                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P
                  : RV P                  P                  4       : R2# )zReturn a string representation of the rule that is
a valid policy language representation (assuming that
the types, object class, etc. are valid).
re   r_   r{   r   z))r   r   )r
   r   r   r   _AVExtRule__rule_type_str_cilr   r   r   _AVExtRule__rule_type_strr   rZ   r   r   r   rZ   ZAVExtRule.to_string  s    
 <<<A~~>>C#//8P8P8R8;S8<8;8<8Q8Q8S	U U  0 * & H+/+?+?+A+/>>+F+F+H+/>>+F+F+H+/+;+;+H+H+J+/>>+/;;+@+@+BD Dr   )r   r   r   r   r   r   )NNN)r   r   r   r   rm   r   r   r   r   r   r   r   r   rZ   r   r   r   r   r   rA   rA   v  s@      JNOO	!%!$D Dr   rA   c                   sL   a  ] tR tRt o Rt^ t^t^tR	R ltR t	R t
R tRtV tR# )
rC   i  zSELinux type rules.

This class is very similar to the AVRule class, but is for representing
the type rules (type_trans, type_change, and type_member). The major
difference is the lack of perms and only and sing destination type.
Nc                s    \         P                  W4       \        4       V n        \        4       V n        \        4       V n        R V n        V P                  V n        R# r   )	rn   r   r   r   r   r   	dest_typeTYPE_TRANSITIONr   r   r   r   r   ZTypeRule.__init__  s>    d# 7--r   c                z    V P                   V P                  8X  d   R # V P                   V P                  8X  d   R# R# )Ztype_transitionZtype_changeZtype_memberr   r   TYPE_CHANGEr   r   r   r   ZTypeRule.__rule_type_str  s/    >>T111$^^t///  r   c                r   )ZtypetransitionZ
typechangeZ
typememberr   r   r   r   r   ZTypeRule.__rule_type_str_cil  s/    >>T111#^^t///r   c                s    V P                   '       dx   R V P                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P
                  P                  4       : RV P                  : R2# V P                  4       : RV P                  P                  4       : RV P                  P                  4       : RV P
                  P                  4       : RV P                  : R2
# )r_   r{   r   r   r   )r
   _TypeRule__rule_type_str_cilr   r   r   r   r   _TypeRule__rule_type_strr   r   r   rZ   ZTypeRule.to_string  s    <<<)-)A)A)C)-)D)D)F)-)D)D)F)-)9)9)F)F)H)-	9 9 )-(<(<(>(,(C(C(E(,(C(C(E(,(8(8(E(E(G(,	8 8r   )r   r   r   r   r   r   )r   r   r   r   rm   r   r   ZTYPE_MEMBERr   r   r   rZ   r   r   r   r   r   rC   rC     s4      OKK.! 8 8r   rC   c                   r   )rE   i  zKSElinux typebound statement.

This class represents a typebound statement.
Nc                r   r   )rn   r   ru   r   r   r   r   r   r   ZTypeBound.__init__  s    d#	r   c                s    V P                   '       d4   R pV P                   F  pVRV P                  : RV: R2,          pK!  	  V# RV P                  : RV P                  P                  4       : R2# )re   z(typebounds r{   r   ztypebounds r   )r
   r   ru   r   r   r   r   rZ   ZTypeBound.to_string  sY    <<<A^^TYY:: $H	  +/))T^^5P5P5RSSr   )r   ru   r   r   r   r   r   rE   rE     s     !
T Tr   rE   c                   r   )rQ   i  Nc                sl    \         P                  W4       \        4       V n        \        4       V n        R # r   )rn   r   r   	src_roles	tgt_rolesr   r   r   r   ZRoleAllow.__init__  s     d#r   c                s   V P                   '       d=   R pV P                   F(  pV P                   F  pVRV: RV: R2,          pK  	  K*  	  V# RV P                  P                  4       : RV P                  P                  4       : R2# )re   z(roleallow r{   r   zallow r   )r
   r   r   r   )r   r   r   r      &   r   rZ   ZRoleAllow.to_string  su    <<<A~~>>CS99A * & H  &*^^%@%@%B%)^^%@%@%BD Dr   )r   r   r   r   r   r   r   rQ   rQ     s     !
	D 	Dr   rQ   c                   r   )rS   i  Nc                r   r   r   r   r   r   r   ZRoleType.__init__  r   r   c                s    R pV P                    FO  pV P                  '       d   VRV P                  : RV: R2,          pK3  VRV P                  : RV: R2,          pKQ  	  V# )re   r   r{   r   r   r   r   )r   r
   r   r   r   r   rZ   ZRoleType.to_string#  sK    A|||TYY::dii;;	 
 r   r   r   r   r   r   r   rS   rS     s     
 r   rS   c                   r   )r;   i,  Nc                sZ    \         P                  W4       R V n        R V n        RV n        R# re   FN)rn   r   r   version	refpolicyr   r   r   r   ZModuleDeclaration.__init__-  s#    d#	r   c                s    V P                   '       d   R # V P                  '       d    RV P                  : RV P                  : R2# RV P                  : RV P                  : R2# )re   zpolicy_module(r   r   zmodule r{   r   )r
   r  r   r  r   r   r   rZ   ZModuleDeclaration.to_string3  sD    <<<~~~26))T\\JJ  +/))T\\BBr   )r   r  r  r   r   r   r   r   r;   r;   ,  s     C Cr   r;   c                   r   )Conditionali<  Nc                r   r   r   r   	cond_exprr   r   r   r   ZConditional.__init__=      d#r   c                >    R \        V P                  RR7      ,          # )z[If %s]r   r   r   r  r   r   r   rZ   ZConditional.to_stringA  s    ,T^^(KKKr   r  r   r   r   r   r   r  r  <  s     L Lr   r  c                   r   )BooliD  Nc                sL    \         P                  W4       R V n        RV n        R# r   )rn   r   r   stater   r   r   r   ZBool.__init__E  s    d#	
r   c                sp    R V P                   ,          pVP                  '       d
   VR,           # VR,           # )zbool %s ZtrueZfalser   r  r   r   r   rZ   ZBool.to_stringJ  s-    "777v:w;r   r  r   r   r   r   r   r  r  D  s     
 r   r  c                   r   )
InitialSidiQ  Nc                L    \         P                  W4       R V n        RV n        R# r   )rn   r   r   r   r   r   r   Z__initZInitialSid.__initR      d#	r   c                    V P                   '       d)   R V P                  : R\        V P                  4      : R2# RV P                  : R\        V P                  4      : 2# )z(sid r{   r   zsid )r
   r   rY   r   r   r   r   rZ   ZInitialSid.to_stringW  sB    <<<$(IIs4<</@AA  #'))S->??r   )r   r   r   )r   r   r   r   Z_InitialSid__initrZ   r   r   r   r   r   r  r  Q  s     
@ @r   r  c                   r   )GenfsConi]  Nc                Z    \         P                  W4       R V n        R V n        RV n        R# r   )rn   r   
filesystempathr   r   r   r   r   ZGenfsCon.__init__^  s#    d#	r   c                    V P                   '       d7   R V P                  : RV P                  : R\        V P                  4      : R2# RV P                  : RV P                  : R\        V P                  4      : 2# )z
(genfscon r{   r   z	genfscon )r
   r  r  rY   r   r   r   r   rZ   ZGenfsCon.to_stringd  sN    <<<,0OOTYYDLLHYZZ  +///499c$,,FWXXr   )r   r  r  r   r   r   r   r   r  r  ]  s     Y Yr   r  c                   s<   a  ] tR tRt o ^t^t^tRR ltR tRt	V t
R# )FilesystemUseij  Nc                sn    \         P                  W4       V P                  V n        R V n        RV n        R# r   )rn   r   XATTRru   r  r   r   r   r   r   ZFilesystemUse.__init__o  s'    d#JJ	r   c                s<   R pV P                   '       d   V P                  V P                  8X  d   RpM;V P                  V P                  8X  d   RpMV P                  V P                  8X  d   RpRV: RV P
                  : R\        V P                  4      : R2# V P                  V P                  8X  d   RpM;V P                  V P                  8X  d   RpMV P                  V P                  8X  d   R	pV: RV P
                  : R\        V P                  4      : R
2# )re   zfsuse xattr zfsuse trans zfsuse task r_   r{   r   zfs_use_xattr zfs_use_trans zfs_use_task r   )r
   ru   r  TRANSTASKr  rY   r   r   r   r   rZ   ZFilesystemUse.to_stringu  s    <<<yyDJJ&"djj("dii'!#$doos4<<7HIIyyDJJ&#djj(#dii'""#T__c$,,6GHHr   )r   r  ru   r   )r   r   r   r   r  r  r  r   rZ   r   r   r   r   r   r  r  j  s%     EEDI Ir   r  c                   r   )PortConi  Nc                r  r   )rn   r   	port_typeport_numberr   r   r   r   r   ZPortCon.__init__  s$    d#r   c                r  )z	(portcon r{   r   zportcon )r
   r  r  rY   r   r   r   r   rZ   ZPortCon.to_string  sU    <<<+/>>4;K;KSQUQ]Q]M^__  *.9I9I3t||K\]]r   )r   r  r  r   r   r   r   r   r  r    s     ^ ^r   r  c                   r   )NodeConi  Nc                r  r   )rn   r   startendr   r   r   r   r   ZNodeCon.__init__  s#    d#
r   c                r  )z	(nodecon r{   r   znodecon )r
   r  r   rY   r   r   r   r   rZ   ZNodeCon.to_string  sN    <<<+/::txxT\\ARSS  *.TXXs4<<?PQQr   )r   r   r  r   r   r   r   r   r  r    s     R Rr   r  c                   r   )NetifConi  Nc                sZ    \         P                  W4       R V n        RV n        RV n        R# r   )rn   r   	interfaceinterface_contextpacket_contextr   r   r   r   ZNetifCon.__init__  s%    d#!%"r   c                s    V P                   '       d@   R V P                  : R\        V P                  4      : R\        V P                  4      : R2# RV P                  : R\        V P                  4      : R\        V P                  4      : 2# )z
(netifcon r{   r   z	netifcon )r
   r"  rY   r#  r$  r   r   r   rZ   ZNetifCon.to_string  sn    <<<,0NNC@V@V<W,/0C0C,DF F  +/..#d>T>T:U*-d.A.A*BD Dr   )r"  r#  r$  r   r   r   r   r   r!  r!    s     #D Dr   r!  c                   r   )PirqConi  Nc                r  r   )rn   r   pirq_numberr   r   r   r   r   ZPirqCon.__init__  s    d#r   c                r  )z	(pirqcon r{   r   zpirqcon )r
   r&  rY   r   r   r   r   rZ   ZPirqCon.to_string  sF    <<<(,(8(8#dll:KLL  '+&6&6DLL8IJJr   )r   r&  r   r   r   r   r   r%  r%         
K Kr   r%  c                   r   )IomemConi  Nc                r  r   )rn   r   
device_memr   r   r   r   r   ZIomemCon.__init__  s    d#r   c                r  )z
(iomemcon r{   r   z	iomemcon )r
   r)  rY   r   r   r   r   rZ   ZIomemCon.to_string  sB    <<<)-#dll:KLL  (,DLL8IJJr   )r   r)  r   r   r   r   r   r(  r(    r'  r   r(  c                   r   )	IoportConi  Nc                r  r   )rn   r   ioportr   r   r   r   r   ZIoportCon.__init__      d#r   c                r  )z(ioportcon r{   r   z
ioportcon )r
   r+  rY   r   r   r   r   rZ   ZIoportCon.to_string  sB    <<<*.++s4<<7HII  )-S5FGGr   )r   r+  r   r   r   r   r   r*  r*    s     
H Hr   r*  c                   r   )PciDeviceConi  Nc                r  r   )rn   r   devicer   r   r   r   r   ZPciDeviceCon.__init__  r,  r   c                r  )z(pcidevicecon r{   r   zpcidevicecon )r
   r.  rY   r   r   r   r   rZ   ZPciDeviceCon.to_string  sB    <<<-1[[#dll:KLL  ,0;;DLL8IJJr   )r   r.  r   r   r   r   r   r-  r-    r'  r   r-  c                   r   )DeviceTreeConi  Nc                r  r   )rn   r   r  r   r   r   r   r   ZDeviceTreeCon.__init__  r  r   c                r  )z(devicetreecon r{   r   zdevicetreecon )r
   r  rY   r   r   r   r   rZ   ZDeviceTreeCon.to_string  sB    <<<.2iiT\\9JKK  -1IIs4<<7HIIr   )r   r  r   r   r   r   r   r/  r/    s     
J Jr   r/  c                 s    \        V R R7       F=  w  rRp\        V4       F  pVR,           pK  	  \        V\        V4      ,           4       K?  	  R# )T)rt   re   Z	N)r(   ZrangeZprintrY   )Zheadrs   rv   r   rx   r   r   
print_treer0    sA    5uADA a#d)m	 6r   c                   r   )Headersi  Nc                ro   r   r   r   r   r   r   r   ZHeaders.__init__      d#r   c                rc   )z	[Headers]rf   r   r   r   rZ   ZHeaders.to_string  s    r   rf   r   r   r   r   r   r1  r1    s     $ r   r1  c                   r   )r+   i  Nc                ro   r   r2  r   r   r   r   ZModule.__init__  r3  r   c                rc   rd   rf   r   r   r   rZ   ZModule.to_string  rg   r   rf   r   r   r   r   r   r+   r+     s     $ r   r+   c                   r   )r/   i  ziA reference policy interface definition.

This class represents a reference policy interface definition.
Nc                r   r   r   r   r   r   r   r   r   ZInterface.__init__  r   r   c                (    R V P                   ,          # )z[Interface name: %s]r   r   r   r   rZ   ZInterface.to_string  s    %		11r   r   r   r   r   r   r   r/   r/     s     2 2r   r/   c                   r   )TunablePolicyi  Nc                r   r   r  r   r   r   r   ZTunablePolicy.__init__  r  r   c                r  )z[Tunable Policy %s]r  r   r	  r   r   r   rZ   ZTunablePolicy.to_string  s    $'8h'WWWr   r
  r   r   r   r   r   r6  r6    s     X Xr   r6  c                   r   )r3   i  Nc                r   r   r4  r   r   r   r   ZTemplate.__init__  r   r   c                r5  )z[Template name: %s]r   r   r   r   rZ   ZTemplate.to_string!  s    $tyy00r   r   r   r   r   r   r   r3   r3     s     1 1r   r3   c                   r   )IfDefi$  Nc                r   r   r4  r   r   r   r   ZIfDef.__init__%  r   r   c                r5  )z[Ifdef name: %s]r   r   r   r   rZ   ZIfDef.to_string)  s    !DII--r   r   r   r   r   r   r   r7  r7  $  s     . .r   r7  c                   r   )IfElsei,  Nc                r   r   r4  r   r   r   r   ZIfElse.__init__-  r   r   c                r5  )z[Ifelse name: %s]r   r   r   r   rZ   ZIfElse.to_string1  s    "TYY..r   r   r   r   r   r   r   r8  r8  ,  s     / /r   r8  c                   r   )r=   i4  Nc                sX    \         P                  W4       Wn        . V n        . V n        R # r   )rn   r   ifnameargscomments)r   r9  r   r   r   r   ZInterfaceCall.__init__5  s!    d#	r   c                s   V P                   VP                   8w  d   R # \        V P                  4      \        VP                  4      8w  d   R # \        V P                  VP                  4       F  w  r#W#8w  g   K   R # 	  R# )FT)r9  rp   r:  Zzip)r   r   r   Zbr   r   matchesZInterfaceCall.matches;  sX    ;;%,,&tyy>S_,tyy%**-CAv . r   c                s    R V P                   ,          p^ pV P                   FP  p\        V\        4      '       d   \	        V4      pMTpV^ 8w  d   VRV,          ,           pMW,           pV^,          pKR  	  VR,           # )z%s(r   r   )r9  r:  r"   r   r   )r   r   rx   r   rY   r   r   rZ   ZInterfaceCall.to_stringE  so    DKKA!T""'*Av$GFA  3wr   )r:  r;  r9  r   )	r   r   r   r   r   r<  rZ   r   r   r   r   r   r=   r=   4  s      r   r=   c                   r   )OptionalPolicyiU  Nc                ro   r   r2  r   r   r   r   ZOptionalPolicy.__init__V  r3  r   c                rc   )z[Optional Policy]rf   r   r   r   rZ   ZOptionalPolicy.to_stringY  s    "r   rf   r   r   r   r   r   r=  r=  U  s     $# #r   r=  c                   sH   a  ] tR tRt o R
R ltR tR tR tR tR t	R	t
V tR# )r7   i\  Nc                s>    \         P                  W4       R V n        R # r   )r   r   r   r   r   r   r   ZSupportMacros.__init__]  s    d#r   c                rc   )z[Support Macros]rf   r   r   r   rZ   ZSupportMacros.to_stringa  s    !r   c                s    \        4       pWP                  9   d;   V P                  V4       F#  pVP                  V P	                  V4      4       K%  	  V# VP                  V4       V# r   )r   r   by_namer   _SupportMacros__expand_permr   )r   permr   pr   r   Z__expand_permZSupportMacros.__expand_permd  sX     E88\\$'++A./ (  EE$Kr   c                s    / V n         V  FX  p\        4       pVP                   F#  pVP                  V P	                  V4      4       K%  	  W P                   VP
                  &   KZ  	  R # r   )r   r   r   r   r?  r   )r   r$   Z	exp_permsr@  r   r   Z	__gen_mapZSupportMacros.__gen_mapp  sQ    AI  !3!3D!9:  (HHQVV	 r   c                sl    V P                   '       g   V P                  4        V P                   V,          # r   r   _SupportMacros__gen_mapr   r   r   r   r>  ZSupportMacros.by_namex  s#    xxxNNxx~r   c                sb    V P                   '       g   V P                  4        WP                   9   # r   rB  rD  r   r   has_keyZSupportMacros.has_key}  s"    xxxNNxxr   )r   r   )r   r   r   r   r   rZ   r?  rC  r>  rE  r   r   r   r   r   r7   r7   \  s(     "
)
   r   r7   c                   r   )rM   i  Nc                s    \         P                  W4       \        4       V n        / V n        \        4       V n        \        4       V n        \        4       V n        R # r   )rn   r   r   r   r   rP   datausersr   r   r   r   ZRequire.__init__  s:    d#W
W
G	W
r   c                sp    V P                   P                  V\        4       4      pVP                  V4       R # r   )r   Z
setdefaultr   r   )r   r   r   rA  s   &&& r   add_obj_classZRequire.add_obj_class  s'    ''	57;	r   c                sp   . pV P                   '       dh   V P                   F  pVP                  R V,          4       K  	  V P                   F  pVP                  RV,          4       K  	  RP	                  V4      # VP                  R4       V P                   F  pVP                  RV,          4       K  	  V P
                  P                  4        F-  w  rEVP                  RV: RVP                  4       : R24       K/  	  V P                   F  pVP                  RV,          4       K  	  V P                   F  pVP                  R	V,          4       K  	  V P                   F  pVP                  R
V,          4       K  	  VP                  R4       \        V4      ^8X  d   R# RP	                  V4      # )z%(typeattributeset cil_gen_require %s)z%(roleattributeset cil_gen_require %s)rW   z	require {z		type %s;z	class r{   r   z		role %s;z		bool %s;z		user %s;}re   )r
   r   rq   rP   r~   r   rw   r   rF  rG  rp   )r   r   ru   r   r   r   Zboolr   s   &       r   rZ   ZRequire.to_string  sG   <<<

@4GH #

@4GH # 99Q<HH[!

,- #$($4$4$:$:$< 	Y8J8J8LMN %=

,- #		,- "

,- #HHSM 1v{99Q<r   )rF  r   rP   r   rG  r   )	r   r   r   r   r   rH  rZ   r   r   r   r   r   rM   rM     s     
   r   rM   c                   ,   a  ] tR tRt o R tR tRtV tR# )
ObjPermSeti  c                s0    Wn         \        4       V n        R # r   )r   r   r   rD  r   r   r   ZObjPermSet.__init__  s    	U
r   c                s\    R V P                   : RV P                  P                  4       : R2# )zdefine(`z', `z'))r   r   r   r   r   r   rZ   ZObjPermSet.to_string  s    '+yy$**2I2I2KLLr   r   Nr   r   r   r   rK  rK    s     M Mr   rK  c                   rJ  )ClassMapi  c                s    Wn         W n        R # r   r   r   )r   r   r   r   r   r   ZClassMap.__init__  s    "
r   c                sJ    V P                   R ,           V P                  ,           # )z: rM  r   r   r   rZ   ZClassMap.to_string  s    ~~$tzz11r   rM  Nr   r   r   r   rL  rL    s     2 2r   rL  c                   sB   a  ] tR tRt o R	R ltR tR tR tR tRt	V t
R# )
Commenti  Nc                s@    V'       d   Wn         M. V n         R V n        R# r   )linesr
   )r   r   r   r   r   ZComment.__init__  s    JDJr   c                s   \        V P                  4      ^ 8X  d   R# . pV P                   FG  pV P                  '       d   VP                  RV,           4       K/  VP                  RV,           4       KI  	  RP	                  V4      # )r    re   r   Z#rW   )rp   rO  r
   rq   r~   )r   Zoutliner   r   rZ   ZComment.to_string  sc     tzz?aC

<<<JJsTz*JJsTz*	 #
 99S>!r   c                s    \        VP                  4      '       d:   VP                   F'  pVR 8w  g   K  V P                  P                  V4       K)  	  R# R# r   )rp   rO  rq   )r   r   rP  ry   r   mergeZComment.merge  s=    u{{2:JJ%%d+ $ r   c                s"    V P                  4       # r   )rZ   r   r   r   r[   ZComment.__str__  s    ~~r   c                rh   r   ri   rj   r   r   rk   ZComment.set_gen_cil  rl   r   )r
   rO  r   )r   r   r   r   r   rZ   rQ  r[   rk   r   r   r   r   r   rN  rN    s#     ",  r   rN  )r   r   r   r   r   r   )TFNr   ))Z{rI  )@Zstringr   ZSRC_TYPEZTGT_TYPEZ	OBJ_CLASSZPERMSZROLEZ	DEST_TYPEZfield_to_strZstr_to_fieldr   r   rn   r(   rz   r   r   r   r   r   r   r   rH   rK   rO   r   r   r   r   r?   rA   rC   rE   rQ   rS   r;   r  r  r  r  r  r  r  r!  r%  r(  r*  r-  r/  r0  r1  r+   r/   r6  r3   r7  r8  r=   r=  r7   rM   rK  rL  rN  rf   r   r   <module>rR     s  (  " 		 THh8iuft]YQ
 a: aF: ,$ L
3"/C /N d N `$ BA BALXD X(\D \*4 $4 .W W 	4 	4	4T 	4HCT HCTND NDb08t 08dT T&D D"t C C L$ L4 
@ 
@Yt YID I@^d ^Rd RDt D
Kd 
K
Kt 
K
H 
H
K4 
K
JD 
Jd T 
2 
2XD X1t 1.D ./T /D B#T #$ D $ L* d * XM M2 2   r   