a qéqeQ ã@s|ddlmZddlmZmZddlmZddlmZddl m Z m Z Gdd „d eƒZ Gd d „d e ƒZ Gd d „d e eƒZdS)é)Ú NamedTupleé)ÚContextÚ Ibendportconé)ÚContextWrapper)ÚDiffResultDescriptor)Ú DifferenceÚWrapperc@s*eZdZUdZeed<eed<eed<dS)ÚModifiedIbendportconz/Difference details for a modified ibendportcon.ZruleZ added_contextZremoved_contextN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚ__annotations__r©rrú?/usr/lib64/python3.9/site-packages/setools/diff/ibendportcon.pyr s r c@sDeZdZdZedƒZedƒZedƒZddœdd„Zddœdd„Z dS) ÚIbendportconsDifferencez?Determine the difference in ibendportcons between two policies.Údiff_ibendportconsN)ÚreturncCsŒ|j d |¡¡| dd„|j ¡Dƒdd„|j ¡Dƒ¡\|_|_}g|_ |D]4\}}t |j ƒt |j ƒkrR|j   t ||j |j ƒ¡qRdS)z>Generate the difference in ibendportcons between the policies.zLGenerating ibendportcon differences from {0.left_policy} to {0.right_policy}css|]}t|ƒVqdS©N©ÚIbendportconWrapper©Ú.0ÚnrrrÚ 'óz=IbendportconsDifference.diff_ibendportcons..css|]}t|ƒVqdSrrrrrrr(rN)ÚlogÚinfoÚformatZ _set_diffZ left_policyZ ibendportconsZ right_policyÚadded_ibendportconsÚremoved_ibendportconsÚmodified_ibendportconsrÚcontextÚappendr )ÚselfZmatched_ibendportconsZ left_ibepZ right_ibeprrrrs ÿÿþÿ  ÿz*IbendportconsDifference.diff_ibendportconscCs"|j d¡d|_d|_d|_dS)z%Reset diff results on policy changes.z"Resetting ibendportcon differencesN)rÚdebugr!r"r#©r&rrrÚ _reset_diff6s z#IbendportconsDifference._reset_diff) r r rrrr!r"r#rr)rrrrrs rc@s<eZdZdZdZeddœdd„Zdd„Zd d „Zd d „Z dS) rz/Wrap ibendportcon statements for diff purposes.©ÚnameÚportN)ÚoconrcCs$||_|j|_|j|_t|ƒ|_dSr)Úoriginr+r,ÚhashÚkey)r&r-rrrÚ__init__DszIbendportconWrapper.__init__cCs|jSr)r0r(rrrÚ__hash__JszIbendportconWrapper.__hash__cCs |j|jkSr)r.©r&ÚotherrrrÚ__lt__MszIbendportconWrapper.__lt__cCs|j|jko|j|jkSrr*r3rrrÚ__eq__Ps  ÿzIbendportconWrapper.__eq__) r r rrÚ __slots__rr1r2r5r6rrrrr>s rN)ÚtypingrZ policyreprrr$rZ descriptorsrÚ differencer r r rrrrrrÚs    (