+
        >)                       a  R t"0 t ^ RIHt ^ RIHt ^RIHtHtHtH	t	H
t
 ^RIHt ^RIHtHtHtHt ^RIHt ]! ]4      t] ^ k ]! ]4      t] ^k ]! RRR7       ! R	 R
]4      4       t]! RRR7       ! R R]4      4       t]! RRR7       ! R R]4      4       tR R ltR R l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 # )!    )defaultdict)	dataclass)CategoryLevel	LevelDeclRangeSensitivity)DiffResultDescriptor)
DifferenceDifferenceResultSymbolWrapperWrapper)SymbolCacheT)frozenorderc                   0   a  ] tR t^t o RtV 3R ltRtV tR# )ModifiedCategoryz+Difference details for a modified category.c                z   < V ^8  d   Qh/ S[ ;R&   S[S[,          ;R&   S[S[,          ;R&   S[S[,          ;R&   # )   categoryadded_aliasesremoved_aliasesmatched_aliases)r   setstr)format__classdict__s   "7/usr/lib64/python3.14/site-packages/setools/diff/mls.py__annotate__ModifiedCategory.__annotate__   sE     
   s8  X  X      N__name__
__module____qualname____firstlineno____doc____annotate_func____static_attributes____classdictcell__r   s   @r   r   r      s      6  r!   r   c                   0   a  ] tR t^t o RtV 3R ltRtV tR# )ModifiedSensitivityz.Difference details for a modified sensitivity.c                z   < V ^8  d   Qh/ S[ ;R&   S[S[,          ;R&   S[S[,          ;R&   S[S[,          ;R&   # )r   sensitivityr   r   r   )r	   r   r   )r   r   s   "r   r    ModifiedSensitivity.__annotate__   sE     
   s8  X  X r!   r"   Nr#   r,   s   @r   r.   r.      s      9  r!   r.   c                   0   a  ] tR t^)t o RtV 3R ltRtV tR# )ModifiedLevelDeclz4Difference details for a modified level declaration.c                z   < V ^8  d   Qh/ S[ ;R&   S[S[,          ;R&   S[S[,          ;R&   S[S[,          ;R&   # )r   leveladded_categoriesremoved_categoriesmatched_categories)r   r   r   )r   r   s   "r   r   ModifiedLevelDecl.__annotate__)   sE     
   (m#  H%  H% r!   r"   Nr#   r,   s   @r   r3   r3   )   s      ?  r!   r3   c                F    V ^8  d   QhR\         R\        \         ,          /# )r   r   return)r   r   )r   s   "r   r   r   4   s      x M(4K r!   c                     \         V P                  ,          V ,          #   \         d+    \        T 4      pT\         T P                  ,          T &   Tu # i ; i)zo
Wrap category from the specified policy.

This caches results to prevent duplicate wrapper
objects in memory.
)_cats_cachepolicyKeyErrorr   )r   cs   & r   category_wrapper_factoryrA   4   sL    8??+H55 (#12HOO$X.     2AAc                F    V ^8  d   QhR\         R\        \         ,          /# )r   r0   r;   )r	   r   )r   s   "r   r   r   C   s      [ ];=W r!   c                     \         V P                  ,          V ,          #   \         d+    \        T 4      pT\         T P                  ,          T &   Tu # i ; i)zr
Wrap sensitivity from the specified policy.

This caches results to prevent duplicate wrapper
objects in memory.
)_sens_cacher>   r?   r   )r0   r@   s   & r   sensitivity_wrapper_factoryrF   C   sP    ;--.{;; +&78K&&'4rB   c                      a  ] tR t^Rt o RtV 3R lR lt]],          ! ]4      t]],          ! ]4      t	]]
,          ! ]4      tV 3R lR ltRtV tR# )CategoriesDifferencez<Determine the difference in categories between two policies.c                   < V ^8  d   QhRR/# r   r;   Nr"   )r   r   s   "r   r   !CategoriesDifference.__annotate__V   s     S S Sr!   c           	     P   V P                   P                  RV P                   RV P                   24       V P	                  R V P                  P                  4        4       R V P                  P                  4        4       4      w  V n        V n        p\        \        ,          ! 4       V n
        V Fq  w  r#V P	                  VP                  4       VP                  4       RR7      w  rEpV'       g   V'       g   KJ  V P                  P                  \        VVVV4      4       Ks  	  R# )z;Generate the difference in categories between the policies.z%Generating category differences from  to c              3   8   "   T F  p\        V4      x  K  	  R # 5iNrA   .0r@   s   & r   	<genexpr>7CategoriesDifference.diff_categories.<locals>.<genexpr>]   s     P2OQ%a((2O   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   rP   rQ   s   & r   rS   rT   ^   s     Q2PQ%a((2PrU   FunwrapN)loginfoleft_policyright_policy	_set_diff
categoriesr6   r7   listr   modified_categoriesaliasesappend)selfr8   left_categoryright_categoryr   r   r   s   &      r   diff_categories$CategoriesDifference.diff_categoriesV   s    	3D4D4D3ET$J[J[I\]	_ NR^^P$2B2B2M2M2OPQ$2C2C2N2N2PQNSJt68J $((8#9#; -?)M ?Cnn%%')?)?)A% ?M ?Q;MO ((//0@ANAPAP1R S .@r!   c                   < V ^8  d   QhRR/# rJ   r"   )r   r   s   "r   r   rK   u   s     % %T %r!   c                H    V P                   P                  R4       V =V =V =R# )%Reset diff results on policy changes.zResetting category differencesN)rY   debugr6   r7   r`   rc   s   &r   _reset_diff CategoriesDifference._reset_diffu   s%    78!#$r!   )r6   r`   r7   N)r$   r%   r&   r'   r(   rf   r
   r   r6   r7   r   r`   rm   r*   r+   r,   s   @r   rH   rH   R   sQ     FS S0 ,H5oF-h7H./?@Q
% %r!   rH   c                      a  ] tR t^}t o RtV 3R lR lt]],          ! ]4      t]],          ! ]4      t	]]
,          ! ]4      tV 3R lR ltRtV tR# )SensitivitiesDifferencez?Determine the difference in sensitivities between two policies.c                   < V ^8  d   QhRR/# rJ   r"   )r   r   s   "r   r   $SensitivitiesDifference.__annotate__   s     Y YD Yr!   c           	     P   V P                   P                  RV P                   RV P                   24       V P	                  R V P                  P                  4        4       R V P                  P                  4        4       4      w  V n        V n        p\        \        ,          ! 4       V n
        V Fq  w  r#V P	                  VP                  4       VP                  4       RR7      w  rEpV'       g   V'       g   KJ  V P                  P                  \        VVVV4      4       Ks  	  R# )z>Generate the difference in sensitivities between the policies.z(Generating sensitivity differences from rM   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   rF   rR   ss   & r   rS   =SensitivitiesDifference.diff_sensitivities.<locals>.<genexpr>   s     Z9YA,Q//9YrU   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   ru   rv   s   & r   rS   rx      s     [9ZA,Q//9ZrU   FrW   N)rY   rZ   r[   r\   r]   sensitivitiesadded_sensitivitiesremoved_sensitivitiesr_   r.   modified_sensitivitiesra   rb   )rc   matched_sensitivities	left_sens
right_sensr   r   r   s   &      r   diff_sensitivities*SensitivitiesDifference.diff_sensitivities   s    	6t7G7G6HTM^M^L_`	b NNZ9I9I9W9W9YZ[9J9J9X9X9Z[] 	T $"<>S
 '++>&?&A#%:!I ?Cnn!!#Z%7%7%9% ?M ?I;MO ++223FyGTGVGV4X Y &;r!   c                   < V ^8  d   QhRR/# rJ   r"   )r   r   s   "r   r   rr      s     ( (T (r!   c                H    V P                   P                  R4       V =V =V =R# rj   z!Resetting sensitivity differencesN)rY   rk   r{   r|   r}   rl   s   &r   rm   #SensitivitiesDifference._reset_diff   s%    :;$&'r!   )r{   r}   r|   N)r$   r%   r&   r'   r(   r   r
   r	   r{   r|   r.   r}   rm   r*   r+   r,   s   @r   rp   rp   }   sT     IY Y2 /{;<NO0=>PQ12EFGYZ
( (r!   rp   c                      a  ] tR t^t o RtV 3R lR lt]],          ! ]4      t]],          ! ]4      t	]]
,          ! ]4      tV 3R lR ltRtV tR# )LevelDeclsDifferencez8Determine the difference in levels between two policies.c                   < V ^8  d   QhRR/# rJ   r"   )r   r   s   "r   r   !LevelDeclsDifference.__annotate__   s     [ [T [r!   c           	     d   V P                   P                  RV P                   RV P                   24       V P	                  R V P                  P                  4        4       R V P                  P                  4        4       4      w  V n        V n        p\        \        ,          ! 4       V n
        V F{  w  r#V P	                  R VP                  4        4       R VP                  4        4       4      w  rEpV'       g   V'       g   KV  V P                  P                  \        W$WV4      4       K}  	  R# )z7Generate the difference in levels between the policies.z'Generating level decl differences from rM   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   LevelDeclWrapperrv   s   & r   rS   3LevelDeclsDifference.diff_levels.<locals>.<genexpr>   s     H.G!!$$.GrU   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   r   rv   s   & r   rS   r      s     I.H!!$$.HrU   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   rP   rQ   s   & r   rS   r      s     N6M)!,,6MrU   c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   rP   rQ   s   & r   rS   r      s     O6N)!,,6NrU   N)rY   rZ   r[   r\   r]   levelsadded_levelsremoved_levelsr_   r3   modified_levelsr^   rb   )rc   matched_levels
left_levelright_levelr6   r7   r8   s   &      r   diff_levels LevelDeclsDifference.diff_levels   s    	5d6F6F5GtDL]L]K^_	a NNHd.>.>.E.E.GHId.?.?.F.F.HIK 	?4.
  $$568'5#J HL~~Nj6K6K6MNOk6L6L6NOHQD2D  #5#5$$++,=2D-Z [ (6r!   c                   < V ^8  d   QhRR/# rJ   r"   )r   r   s   "r   r   r      s     ! !T !r!   c                H    V P                   P                  R4       V =V =V =R# r   )rY   rk   r   r   r   rl   s   &r   rm    LevelDeclsDifference._reset_diff   s%    :; r!   )r   r   r   N)r$   r%   r&   r'   r(   r   r
   r   r   r   r3   r   rm   r*   r+   r,   s   @r   r   r      sN     B[ [0 (	2;?L))4[AN*+<=kJO
! !r!   r   c                   L   a  ] tR t^t o RtR	tV 3R lR ltR tR tR t	Rt
V tR# )
r   z-Wrap level declarations to allow comparisons.c                $   < V ^8  d   QhRS[ RR/# r   r5   r;   N)r   )r   r   s   "r   r   LevelDeclWrapper.__annotate__   s      i D r!   c                f    Wn         \        VP                  4      V n        \        V4      V n        R # rO   )originrF   r0   hashkeyrc   r5   s   &&r   __init__LevelDeclWrapper.__init__   s%    6u7H7HI;r!   c                    V P                   # rO   )r   rl   s   &r   __hash__LevelDeclWrapper.__hash__   s    xxr!   c                4    V P                   VP                   8H  # rO   r0   rc   others   &&r   __eq__LevelDeclWrapper.__eq__   s     5#4#444r!   c                4    V P                   VP                   8  # rO   r   r   s   &&r   __lt__LevelDeclWrapper.__lt__   s    %"3"333r!   )r   r   r0   Nr   r$   r%   r&   r'   r(   	__slots__r   r   r   r   r*   r+   r,   s   @r   r   r      s+     7 I 
5
4 4r!   r   c                   L   a  ] tR t^t o RtR	tV 3R lR ltR tR tR t	Rt
V tR# )
LevelWrapperz!Wrap levels to allow comparisons.c                $   < V ^8  d   QhRS[ RR/# r   )r   )r   r   s   "r   r   LevelWrapper.__annotate__   s     W We W Wr!   c                    Wn         \        VP                  4      V n        \        R  VP	                  4        4       4      V n        R# )c              3   8   "   T F  p\        V4      x  K  	  R # 5irO   rP   rQ   s   & r   rS   (LevelWrapper.__init__.<locals>.<genexpr>   s     VCUa6q99CUrU   N)r   rF   r0   r   r^   r   s   &&r   r   LevelWrapper.__init__   s5    6u7H7HIV5CSCSCUVVr!   c                ,    \        V P                  4      # rO   r   r   rl   s   &r   r   LevelWrapper.__hash__       DKK  r!   c                     V P                   VP                   8H  ;'       d    V P                  VP                  8H  #   \         d     R # i ; iFr0   r^   AttributeErrorr   s   &&r   r   LevelWrapper.__eq__   sP    	##u'8'88 4 45#3#334 	 	   < < A
Ac                     V P                   VP                   8  ;'       d    V P                  VP                  8  #   \         d     R # i ; ir   r   r   s   &&r   r   LevelWrapper.__lt__  sP    	##e&7&77 3 3%"2"223 	 	r   )r^   r   r0   N)r0   r^   r   r,   s   @r   r   r      s-     +-IW W
! r!   r   c                   L   a  ] tR tRt o RtR
tV 3R lR ltR tR tR t	Rt
V tR	# )RangeWrapperi  z
Wrap ranges to allow comparisons.

This only compares the low and high levels of the range.
It does not detect additions/removals/modifications
to levels between the low and high levels of the range.
c                $   < V ^8  d   QhRS[ RR/# )r   range_r;   N)r   )r   r   s   "r   r   RangeWrapper.__annotate__  s     . .u . .r!   c                z    Wn         \        VP                  4      V n        \        VP                  4      V n        R # rO   )r   r   lowhigh)rc   r   s   &&r   r   RangeWrapper.__init__  s'    

+ -	r!   c                ,    \        V P                  4      # rO   r   rl   s   &r   r   RangeWrapper.__hash__  r   r!   c                     V P                   VP                   8H  ;'       d    V P                  VP                  8H  #   \         d     R # i ; ir   r   r   r   r   s   &&r   r   RangeWrapper.__eq__   sJ    	88uyy( ( (		UZZ'( 	 	r   c                     V P                   VP                   8  ;'       d    V P                  VP                  8  #   \         d     R # i ; ir   r   r   s   &&r   r   RangeWrapper.__lt__)  sJ    	88eii' ' '		EJJ&' 	 	r   )r   r   r   N)r   r   r   r,   s   @r   r   r     s/       I. .
! r!   r   c                    V ^8  d   Qh/ ^ \         9   d   \        \        ,          ;R&   ^\         9   d   \        \        ,          ;R&   # )r   r=   rE   )__conditional_annotations__r   r   r	   )r   s   "r   r   r      s6     # # 7 6[" 6 $ : 9[% 9 $r!   N)#r   collectionsr   dataclassesr   	policyrepr   r   r   r   r	   descriptorsr
   
differencer   r   r   r   typingr   dictr=   rE   r   r.   r3   rA   rF   rH   rp   r   r   r   r   r   )r   s   @r   <module>r      s	   $ # ! F F - L L %0%6 6(3D(9 9 $d#'  $ $d#*  $ $d#&( & $&(%: (%V)(j )(X(!: (!V4wy) 4.75> B$75> $r!   