+
    	:iw  c                   s    R t . R
Ot^ t^t^t]],          tR]R]R]R]/t]R]R]R]R/t ! R R4      t ! R R4      t	R	# )z
This module provides knowledge object classes and permissions. It should
be used to keep this knowledge from leaking into the more generic parts of
the policy generation.
ZnZrZwZbc                   s0   a  ] tR t^Mt o RtR tR tRtV tR# )PermMapa  A mapping between a permission and its information flow properties.

PermMap represents the information flow properties of a single permission
including the direction (read, write, etc.) and an abstract representation
of the bandwidth of the flow (weight).
c                s*    Wn         W n        W0n        R # N)permdirweight)selfr   r   r   s   &&&&9/usr/lib/python3.14/site-packages/sepolgen/objectmodel.py__init__ZPermMap.__init__T   s    	    c                sl    R V P                   \        V P                  ,          V P                  3,          # )z'<sepolgen.objectmodel.PermMap %s %s %d>)r   
dir_to_strr   r   r      &r   __repr__ZPermMap.__repr__Y   s0    8DII;Edhh;O;?;;<H H 	Hr   )r   r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classdictcell__Z__classdict__   @r   r    r    M   s     
H Hr   r    c                   sH   a  ] tR t^^t o RtR tR tR tR tR t	R t
RtV tR	# )
PermMappingszThe information flow properties of a set of object classes and permissions.

PermMappings maps one or more classes and permissions to their PermMap objects
describing their information flow characteristics.
c                s8    / V n         ^V n        \        V n        R# )i   N)classesdefault_weight	FLOW_BOTHdefault_dirr
   r   r   r   ZPermMappings.__init__d   s    $r   c           	     s(   RpV EF  pVP                  4       p\        V4      ^ 8X  g   \        V4      ^8X  g   V^ ,          R8X  d   KD  V^ ,          R8X  dI   V^,          pWPP                  9   d   \        R4      h/ V P                  V&   V P                  V,          pK  \        V4      ^8w  d   \        R4      hVf   \        R4      h\	        V^ ,          \
        V^,          ,          \        V^,          4      4      pWbVP                  &   EK  	  R# )zcRead the permission mappings from a file. This reads the format used
by Apol in the setools suite.
NZ#Zclasszduplicate class in perm mapz!error in object class permissionszpermission outside of class)ZsplitZlenr   Z
ValueErrorr    
str_to_dirZintr   )r   fdZcurZlineZfieldsZcpms   &&     r   	from_fileZPermMappings.from_filei   s     DZZ\F6{a3v;!#3vayC7GayG#1I$$%BCC"%Qll1ov;!#$%HII;$%BCCVAY
6!9(=s6!9~N!BGG! r   c                s6    V P                   V,          V,          # )zGet the permission map for the object permission.

Returns:
  PermMap representing the permission
Raises:
  KeyError if the object or permission is not defined
)r   )r   objr   s   &&&r   getZPermMappings.get   s     ||C &&r   c                s     V P                   V,          V,          pV#   \         d$    \        Y P                  T P                  4      u # i ; i)zGet the permission map for the object permission or a default.

getdefault is the same as get except that a default PermMap is
returned if the object class or permission is not defined. The
default is FLOW_BOTH with a weight of 5.
)r   ZKeyErrorr    r   r   )r   r   r   r   s   &&& r   
getdefaultZPermMappings.getdefault   sN    	Hc"4(B 	  	H4!1!143F3FGG	Hs    +AAc                sj    \         pV F&  pV P                  W4      pW5P                  ,          pK(  	  V# r   )	FLOW_NONEr!   r   )r   r   permsr   r   r      &&&   r   getdefault_directionZ!PermMappings.getdefault_direction   s1    D+B,C  
r   c                sb    ^ pV F&  pV P                  W4      pW5P                  ,          pK(  	  V# )i    )r!   r   )r   r   r#   Ztotalr   r   r$   r   getdefault_distanceZ PermMappings.getdefault_distance   s2    D+BYYE  r   )r   r   r   N)r   r   r   r   r   r   r   r    r!   r%   r&   r   r   r   r   r   r   r   ^   s-     
%
"8' r   r   N)	Zsocketr   ZprocessZfileZlnk_fileZ	fifo_fileZdbusZ
capabilityZunix_stream_socket)
r   Zimplicitly_typed_objectsr"   Z	FLOW_READZ
FLOW_WRITEr   r   r	   r    r   ) r   r   <module>r'      st   ((H 8 		
#	 Yiz3T
3	Cc9sT
H H"K Kr   