a qqe@sPddlmZmZddlmZddlmZmZGdddeZGdddeZ d S) ) NamedTupleSet)DiffResultDescriptor) Difference SymbolWrapperc@s6eZdZUdZeeed<eeed<eeed<dS)ModifiedCommonz8Difference details for a modified common permission set. added_perms removed_perms matched_permsN)__name__ __module__ __qualname____doc__rstr__annotations__rr:/usr/lib64/python3.9/site-packages/setools/diff/commons.pyr s   rc@sDeZdZdZedZedZedZddddZddddZ dS) CommonDifferencezV Determine the difference in common permission sets between two policies. diff_commonsN)returncCs|jd||dd|jDdd|jD\|_|_}t |_ |D]<\}}|j|j |j dd\}}}|s~|rTt ||||j |<qTdS)z8Generate the difference in commons between the policies.zFGenerating common differences from {0.left_policy} to {0.right_policy}css|]}t|VqdSNr.0crrr &z0CommonDifference.diff_commons..css|]}t|VqdSrrrrrrr'rF)unwrapN) loginfoformatZ _set_diffZ left_policyZcommonsZ right_policy added_commonsremoved_commonsdictmodified_commonsZpermsr)selfZmatched_commonsZ left_commonZ right_commonr r r rrrrs$  zCommonDifference.diff_commonscCs"|jdd|_d|_d|_dS)z%Reset diff results on policy changes.zResetting common differencesN)rdebugr"r#r%)r&rrr _reset_diff:s zCommonDifference._reset_diff) r r rrrr"r#r%rr(rrrrrs rN) typingrrZ descriptorsr differencerrrrrrrrs