+
    ,i  c                   s   ^ RI t ^ RIHtHt ^ RIHt ^ RIt^RIHtH	t	H
t
  ! R R4      t ! R R4      t]P                  ! R	]R
7      t ! R R]]P                  ],          4      t]P                  ! R]	R
7      t ! R R]],          4      tR# )i    N)ABCabstractmethodIterable)PolicyObjectPolicySymbolSELinuxPolicyc                   s   a  ] tR t^t o RtV 3R lR lt]R 4       t]P                  R 4       t]R 4       t	]	P                  R 4       t	V 3R lR	 lt
]V 3R
 lR l4       t]RR l4       tRtV tR# )
Differencez&Base class for all policy differences.c                s*   < V ^8  d   QhRS[ RS[ RR/# )   left_policyright_policyreturnN)r   Zformat__classdict__   ">/usr/lib64/python3.14/site-packages/setools/diff/difference.py__annotate__Difference.__annotate__   s#     ) )M ) )SW )    c                s\    \         P                  ! \        4      V n        Wn        W n        R # N)loggingZ	getLogger__name__logr	   r
   )selfr	   r
      &&&r   __init__ZDifference.__init__   s     $$X.&(r   c                    V P                   # r   )_left_policyr      &r   r	   Difference.left_policy   s       r   c                n    V P                   P                  R V 24       Wn        V P                  4        R# )zPolicy diff left policy set to N)r   infor   _reset_diffr   Zpolicy   &&r   r	   r      s,    7x@A"r   c                r   r   )_right_policyr   r   r   r
   Difference.right_policy$   s    !!!r   c                r   )z Policy diff right policy set to N)r   r    r$   r!   r"   r#   r   r
   r%   (   s,    8AB#r   c                s   < V ^8  d   QhRR/# )r   r   N r   r   r   r   r   1   s     " "T "r   c                s    \         h)z%Reset diff results on policy changes.)ZNotImplementedErrorr   r   r   r!   ZDifference._reset_diff1   s    !!r   c                s&   < V ^8  d   QhRS[ RS[ /# )r   	rule_listr   r   r   r   r   r   r   6   s     3 3X 3 3r   c              #  sb   "   V  F$  pVP                  4        F  pV! V4      x  K  	  K&  	  R# 5i)z4Generator that yields a wrapped, expanded rule list.N)Zexpand)r'   Zwrapper_classZunexpanded_ruleZexpanded_rules   &&  r   _expand_generatorZDifference._expand_generator5   s/       )O!0!7!7!9#M22 ":  )s   -/Nc                s|   \        V 4      p\        V4      pWT,
          pWE,
          p\        4       p\        WG,
          VR7      p	\        WV,
          VR7      p
\        W4       F  w  rVP                  W34       K  	  V'       d6   \        R V 4       4      \        R V 4       4      \        R V 4       4      3# WgV3# )az  
Standard diff of two sets.

Parameters:
left        An iterable
right       An iterable

Return:
tuple       (added, removed, matched)

added       Set of items in right but not left
removed     Set of items in left but not right
matched     Set of items in both left and right.  This is
            in the form of tuples with the matching item
            from left and right
keyc              3   8   "   T F  qP                   x  K  	  R # 5ir   origin.0Zi   & r   	<genexpr>'Difference._set_diff.<locals>.<genexpr>q   s     5Axx   c              3   r+   r   r,   r.   r0   r   r1   r2   r   s     4mHHmr3   c              3   sV   "   T F  w  rVP                   VP                   3x  K!  	  R # 5ir   r,   )r/   leftrights   &  r   r1   r2   s   s     S]MTT[[%,,/]s   '))ZsetZsortedZzipZadd)r4   r5   r*   ZunwrapZ
left_itemsZright_itemsZadded_itemsZremoved_itemsZmatched_itemsZleft_matched_itemsZright_matched_itemss   &&&&       r   	_set_diffZDifference._set_diff?   s    & Y
%j!."0 #Z%?cJ$k&?cJ
 1GKD tm,	 H 5554m44S]SST T }<<r   )r   r$   r	   r   r
   )NT)r   
__module____qualname____firstlineno____doc__r   Zpropertyr	   Zsetterr
   r!   Zstaticmethodr(   r6   __static_attributes____classdictcell__r      @r   r   r      s     0) ) ! !  
 " "  " " 3 3 5= 5=r   r   c                   s    ] tR t^xtRtRtR# )DifferenceResultz!Base class for difference resultsr&   N)r   r7   r8   r9   r:   r;   r&   r   r   r?   r?   x   s    +r   r?   T)Zboundc                   s   a  ] tR t^t o RtRtV 3R lR ltR t]R 4       t	]R 4       t
]R 4       tR tV 3R	 ltR
tV tR# )Wrapperz/Abstract base class for policy object wrappers.c                s*   < V ^8  d   QhRS[ RS[RR/# )r   r-   r*   r   Nr@   Zintr   r   r   r   Wrapper.__annotate__   s"      q s t r   c                s    Wn         W n        R # r   r-   r*   )r   r-   r*   r   r   r   ZWrapper.__init__   s    r   c                sb    R V P                   P                   R\        V P                  4       R2# )Z<z
(Wrapping z)>)	__class__r   Zreprr-   r   r   r   __repr__ZWrapper.__repr__   s,    4>>**+:d4;;6G5HKKr   c                    R # r   r&   r   r   r   __hash__ZWrapper.__hash__       r   c                rG   r   r&   r   Zotherr#   r   __eq__ZWrapper.__eq__   rI   r   c                rG   r   r&   rJ   r#   r   __lt__ZWrapper.__lt__   rI   r   c                s    W8X  * # r   r&   rJ   r#   r   __ne__ZWrapper.__ne__   s      r   c                s2   < V ^8  d   Qh/ S[ ;R&   S[;R&   # )r   r-   r*   rB   r   r   r   r   rC      s      I	 
 
H r   )r*   r-   NrD   )r   r7   r8   r9   r:   	__slots__r   rF   r   rH   rK   rL   rM   __annotate_func__r;   r<   r=   r>   r   rA   rA      sg     9
 "I L      !;  r   rA   Sc                   sd   a a ] tR t^t oRtRtV3R lV 3R lltR tR tR t	V3R lt
RtVtV ;t# )	SymbolWrapperzx
General wrapper for policy symbols, e.g. types, roles
to provide a diff-specific equality operation based
on its name.
c                s$   < V ^8  d   QhRS[ RR/# )r   symbolr   N)rP   r   r   r   r   SymbolWrapper.__annotate__   s        q  T  r   c                sp   < \         SV `  V\        VP                  4      4       VP                  V n        R # r   )Zsuperr   Zhashname)r   rR   rE   s   &&r   r   ZSymbolWrapper.__init__   s&    fkk!23KK	r   c                r   r   r)   r   r   r   rH   ZSymbolWrapper.__hash__   s    xxr   c                s4    V P                   VP                   8  # r   rT   rJ   r#   r   rL   ZSymbolWrapper.__lt__   s    yy5::%%r   c                s4    V P                   VP                   8H  # r   rU   rJ   r#   r   rK   ZSymbolWrapper.__eq__   s    yyEJJ&&r   c                s&   < V ^8  d   Qh/ S[ ;R&   # )r   rT   )Zstrr   r   r   r   rS      s      I r   rU   )r   r7   r8   r9   r:   rN   r   rH   rL   rK   rO   r;   r<   Z__classcell__)rE   r   s   @@r   rQ   rQ      s1      I   &'-  r   rQ   )r   Zabcr    r   Zcollections.abcr   ZtypingZ	policyrepr   r   r   r   r?   ZTypeVarr@   ZGenericrA   rP   rQ   r&   r   r   <module>rV      s|     # $  A Ag= g=T	 	 NN3l+!c6>>!$ !B NN3l+'GAJ 'r   