+
    ,i  c                   s    ^ RI Ht ^ RIHt ^RIHtHtHt ^RIH	t	H
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# )i    LoggerAny)CriteriaDescriptorCriteriaSetDescriptorCriteriaPermissionSetDescriptor)	policyreputilc                   sj   a  ] tR t^t o Rt]],          ! R4      tRtV 3R lR lt	R t
V 3R ltRtV tR	# )

MatchAliasz'Mixin for matching an object's aliases.alias_regexFc                $   < V ^8  d   QhRS[ RR/#    logreturnNr    Zformat__classdict__   "5/usr/lib64/python3.14/site-packages/setools/mixins.py__annotate__MatchAlias.__annotate__   s     9 9f 9 9    c                `    VP                  RV P                  : RV P                  : 24       R# )z+Emit log debugging info for alias matching.zself.alias=z, self.alias_regex=N)debugaliasr
   selfr      &&r   _match_alias_debugZMatchAlias._match_alias_debug   s'    		[TZZM!5D$4$4#678r   c                s    V P                   '       g   R# \        P                  ! VP                  4       V P                   V P                  4      # )zg
Match the alias criteria

Parameter:
obj     An object with an alias generator method named "aliases"
T)r   r   match_in_setaliasesr
   r   Zobjr   r   _match_aliasZMatchAlias._match_alias   s5     zzz  

D<L<LMMr   c                &   < V ^8  d   Qh/ S[ ;R&   # )r   r
   boolr   r   r   r   r      s     
  r    N)__name__
__module____qualname____firstlineno____doc__r   strr   r
   r   r!   __annotate_func____static_attributes____classdictcell__r      @r   r	   r	      s3     1s#M2EK9 9N  r   r	   c                   s@  a  ] tR t^(t o Rt]]P                  ,          ! RR4      tRt	]]P                  ,          ! RR4      tRt]]P                  ,          ! RR4      tRt]]P                   ,          ! R	R
7      tRtRtRtRtV 3R lR ltV 3R lR ltV 3R ltRtV tR# )MatchContexta  
Mixin for matching contexts.

Class attributes:
user            The user to match in the context.
user_regex      If true, regular expression matching
                will be used on the user.
role            The role to match in the context.
role_regex      If true, regular expression matching
                will be used on the role.
type_           The type to match in the context.
type_regex      If true, regular expression matching
                will be used on the type.
range_          The range to match in the context.
range_subset    If true, the criteria will match if it
                is a subset of the context's range.
range_overlap   If true, the criteria will match if it
                overlaps any of the context's range.
range_superset  If true, the criteria will match if it
                is a superset of the context's range.
range_proper    If true, use proper superset/subset
                on range matching operations.
                No effect if not using set operations.

user_regexZlookup_userF
role_regexZlookup_role
type_regexZlookup_typeZlookup_range)Zlookup_functionc                    < V ^8  d   QhRS[ /# r   r   r    r   r   r   r   MatchContext.__annotate__O   s     C C Cr   c                s   VP                  RV P                  : RV P                  : 24       VP                  RV P                  : RV P                  : 24       VP                  RV P
                  : RV P                  : 24       VP                  RV P                  : RV P                  : R	V P                  : R
V P                  : RV P                  : 2
4       R# )z-Emit log debugging info for context matching.z
self.user=z, self.user_regex=z
self.role=z, self.role_regex=zself.type_=z, self.type_regex=zself.range_=z, self.range_subset=z, self.range_overlap=z, self.range_superset=z, self.range_proper=N)r   userr2   roler3   type_r4   range_range_subsetrange_overlaprange_supersetrange_properr   r   r   _match_context_debugZ!MatchContext._match_context_debugO   s    		ZTYYL 34??"456		ZTYYL 34??"456		[TZZM!4DOO#567		\T[[N"7T%6%6$88N4;M;M:O P*((**?T->->,@B 	Cr   c                s:   < V ^8  d   QhRS[ P                  RS[/# )r   contextr   )r   ZContextr$   r   r   r   r   r7   W   s!     $ $i&7&7 $D $r   c                s   V P                   '       d?   \        P                  ! VP                   V P                   V P                  4      '       g   R# V P                  '       d?   \        P                  ! VP                  V P                  V P
                  4      '       g   R# V P                  '       d?   \        P                  ! VP                  V P                  V P                  4      '       g   R# V P                  '       d`   \        P                  ! VP                  V P                  V P                  V P                  V P                  V P                  4      '       g   R# R# )z
Match the context criteria.

Parameter:
obj     An object with context attributes "user", "role",
        "type_" and "range_".
FT)r8   r   match_regexr2   r9   r3   r:   r4   r;   Zmatch_ranger<   r=   r>   r?   )r   rA   r   r   _match_contextZMatchContext._match_contextW   s     999T--		! ! 999T--		! ! :::d..

! ! ;;;t//!!""##!! #  # r   c                sn   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   # )r   r2   r3   r4   r=   r<   r>   r?   r#   r   r   r   r   r7   (   sj     8 9 < = @ A D E F G H  I J K r   r%   N)r&   r'   r(   r)   r*   r   r   ZUserr8   r2   ZRoler9   r3   ZTyper:   r4   ZRanger;   r=   r<   r>   r?   r@   rC   r,   r-   r.   r/   r0   r   r1   r1   (   s     2 inn-lMJDJinn-lMJDJy~~.|]KEJ	0PFML NLC C$ $_  r   r1   c                   sn   a  ] tR t^~t o Rt]],          ! R4      tRtRt	V 3R lR lt
R tV 3R ltRtV tR	# )
	MatchNamez=Mixin for matching an object's name with alias dereferencing.
name_regexFc                r   r   r    r   r   r   r   MatchName.__annotate__   s     L LV L Lr   c                s|    VP                  RV P                  : RV P                  : RV P                  : 24       R# )z)Log debugging messages for name matching.z
self.name=z, self.name_regex=z, self.alias_deref=N)r   namerE   alias_derefr   r   r   _match_name_debugZMatchName._match_name_debug   s3    		ZTYYL 34??"44Ht7G7G6IJKr   c                s~   V P                   '       g   R# V P                  '       dn   \        P                  ! WP                   V P                  4      ;'       g;    \        P
                  ! VP                  4       V P                   V P                  4      # \        P                  ! WP                   V P                  4      # )z&Match the object to the name criteria.T)rG   rH   r   rB   rE   r   r   r    r   r   _match_nameZMatchName._match_name   s    yyy##CDOOD M M!!#++-DOOLM ##CDOODDr   c                2   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   # )r   rE   rH   r#   r   r   r   r   rF   ~   s     
    r   r%   N)r&   r'   r(   r)   r*   r   r+   rG   rE   rH   rI   rJ   r,   r-   r.   r/   r0   r   rD   rD   ~   s:     Gc"<0DJKL L
E  r   rD   c                   s   a  ] tR t^t o Rt]]P                  ,          ! RR4      tRt	V 3R lR lt
R tV 3R ltR	tV tR
# )MatchObjClassz%Mixin for matching an object's class.tclass_regexZlookup_classFc                r   r   r    r   r   r   r   MatchObjClass.__annotate__   s     ; ;V ; ;r   c                r   )0Emit log debugging info for permission matching.zself.tclass=z, self.tclass_regex=N)r   tclassrM   r   r   r   _match_object_class_debugZ'MatchObjClass._match_object_class_debug   s'    		\T[[N"7T%6%6$89:r   c                s    V P                   '       g   R# V P                  '       d8   \        V P                   P                  \	        VP                   4      4      4      # VP                   V P                   9   # )zm
Match the object class criteria

Parameter:
obj     An object with an object class attribute named "tclass"
T)rP   rM   r$   Zsearchr+   r    r   r   _match_object_classZ!MatchObjClass._match_object_class   sQ     {{{**3szz?;<<::,,r   c                r"   )r   rM   r#   r   r   r   r   rN      s     
  r   r%   N)r&   r'   r(   r)   r*   r   r   ZObjClassrP   rM   rQ   rR   r,   r-   r.   r/   r0   r   rL   rL      s:     /"9#5#56~~VFL; ;-  r   rL   c                   sf   a  ] tR t^t o Rt]! RR7      tRtRtRt	V 3R lR lt
R tV 3R ltR	tV tR
# )MatchPermissionz+Mixin for matching an object's permissions.perms_regex)rE   Fc                r5   r6   r    r   r   r   r   MatchPermission.__annotate__   s     + +f +r   c           
     s    VP                  RV P                  : RV P                  : RV P                  : RV P                  : 24       R# )rO   zself.perms=z, self.perms_regex=z, self.perms_equal=z, self.perms_subset=N)r   permsrT   perms_equalperms_subsetr   r   r   _match_perms_debugZ"MatchPermission._match_perms_debug   sK    		[TZZM!5D$4$4#66J9I9I8K L(&&(* 	+r   c                s   V P                   '       g   R# V P                  '       d   VP                   V P                   8  # \        P                  ! VP                   V P                   V P                  V P
                  4      # )zq
Match the permission criteria

Parameter:
obj     An object with a permission set class attribute named "perms"
T)rV   rX   r   Zmatch_regex_or_setrW   rT   r    r   r   _match_permsZMatchPermission._match_perms   s_     zzz99

****399djj$BRBR+/+;+;= =r   c                s>   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   # )r   rW   rT   rX   r#   r   r   r   r   rU      s,     
      r   r%   N)r&   r'   r(   r)   r*   r   rV   rW   rT   rX   rY   rZ   r,   r-   r.   r/   r0   r   rS   rS      s7     5+}EEKKL+ +
=  r   rS   c                   sH   a  ] tR t^t o RtR tV 3R lR ltV 3R ltRtV t	R# )NetworkXGraphEdgez)Mixin enabling use in NetworkX functions.c                s    \        V\        4      '       d7   \        VP                  ^4      !   Uu. uF  q P	                  V4      NK  	  up# V P	                  V4      # u upi )r   )Z
isinstanceZsliceZrangeZindices_index_to_item)r   ZkeyZis   && r   __getitem__ZNetworkXGraphEdge.__getitem__   sU     c5!!49CKKN4KL4Kq''*4KLL&&s++ Ms   Ac                r5   )r   index)Zintr   r   r   r   NetworkXGraphEdge.__annotate__   s     ] ]C ]r   c                sj    V^ 8X  d   V P                   # V^8X  d   V P                  # \        RV 24      h)z'Return source or target based on index.z4Invalid index (NetworkXGraphEdge only has 2 items): )sourcetargetZ
IndexError)r   r^   r   r   r\   Z NetworkXGraphEdge._index_to_item   s9    A:;;aZ;;STYSZ[\\r   c                rK   )r   r`   ra   r   r   r   r   r   r_      s      K	 
 K r   r%   N)
r&   r'   r(   r)   r*   r]   r\   r,   r-   r.   r/   r0   r   r[   r[      s      3
,] ]  r   r[   N)Zloggingr   Ztypingr   Zdescriptorsr   r   r   Z r   r   r	   r1   rD   rL   rS   r[   r%   r   r   <module>rb      s\      c c N N4S SlE E2- -8= =B] ]r   