HEX
Server: Apache
System: Linux ns517114.ip-158-69-26.net 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: urgentelectrical (1063)
PHP: 8.2.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.12/site-packages/setools/diff/__pycache__/mlsrules.cpython-312.pyc
�

���i�����ddlmZddlmZddlmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZdd	lmZdd
lmZddlmZedd�
�Gd�de��ZGd�de�ZGd�de
e�Zy)�)�defaultdict)�	dataclass�)�MLSRule�MLSRuletype�Range�)�DiffResultDescriptor)�
Difference�DifferenceResult�Wrapper)�RangeWrapper)�class_wrapper_factory)�type_or_attr_wrapper_factory)�RuleListT)�frozen�orderc�0�eZdZUdZeed<eed<eed<y)�ModifiedMLSRulez+Difference details for a modified MLS rule.�rule�
added_default�removed_defaultN)�__name__�
__module__�__qualname__�__doc__r�__annotations__r���</usr/lib64/python3.12/site-packages/setools/diff/mlsrules.pyrrs��6�
�M����rrc��eZdZUdZdd�Zeee�Zeee�Zee	e�Z
dZee
efed<dZee
efed<dd�Zdd�Zy)	�MLSRulesDifferencez;Determine the difference in MLS rules between two policies.Nc�
�|jjd|j�d|j���|j�|j
�|j
�|j�Jd��|j
�Jd��|j|j|jtjt�|j|j
tjt��\}}}tt�}|D]a\}}t|j�t|j�k7s�2|j!t||j|j���c||_||_||_y)zGGenerate the difference in range_transition rules between the policies.z-Generating range_transition differences from z to Nz+Left MLS rules did not load, this is a bug.z,Right MLS rules did not load, this is a bug.)�log�info�left_policy�right_policy�_left_mls_rules�_right_mls_rules�_create_mls_rule_lists�	_set_diff�_expand_generatorr�range_transition�MLSRuleWrapper�listrr�default�append�added_range_transitions�removed_range_transitions�modified_range_transitions)�self�added�removed�matched�modified�	left_rule�
right_rules       r �diff_range_transitionsz)MLSRulesDifference.diff_range_transitions!sl��	
���
�
�;�D�<L�<L�;M�N��#�#�$�
&�	'����'�4�+@�+@�+H��'�'�)��#�#�/�^�1^�^�/��$�$�0�`�2`�`�0�"&�.�.��"�"�4�#7�#7��8T�8T�#U�#1�
3��"�"�4�#8�#8��9U�9U�#V�#1�
3�#4���w����(�*��%,�!�I�z��I�-�-�.�,�z�?Q�?Q�2R�R�����	�0:�0B�0B�09�0A�0A�!C�D�	&-�(-��$�)0��&�*2��'rr(r)c�F�tt�|_|jj	d|j
���|j
j
�D]*}|j|jj|��,tt�|_	|jj	d|j���|jj
�D]*}|j|jj|��,|jj	d�y)z$Create rule lists for both policies.zBuilding MLS rule lists from z"Completed building MLS rule lists.N)rr/r(r$�debugr&�mlsrules�ruletyper1r)r'�r5rs  r r*z)MLSRulesDifference._create_mls_rule_listsMs��� +�4�0��������6�t�7G�7G�6H�I�J��$�$�-�-�/�D�� � ����/�6�6�t�<�0�!,�D� 1��������6�t�7H�7H�6I�J�K��%�%�.�.�0�D��!�!�$�-�-�0�7�7��=�1�	
�����;�<rc�b�|jjd�|`|`|`d|_d|_y)z%Reset diff results on policy changes.zResetting MLS rule differencesN)r$r>r2r3r4r(r)�r5s r �_reset_diffzMLSRulesDifference._reset_diff]s7�������7�8��(��*��+� $��� $��r)�returnN)rrrrr<r
rr2r3rr4r(rrrr)r*rDrrr r"r"s~��E�3�B<�2�7�;�<R�S�� =� 4�W� =�>T� U��!F�!5�o�!F�G]�!^��7;�O�X�k�7�2�3�:�7;��h�{�G�3�4�;�
=� 	%rr"c�6�eZdZdZdZdeddfd�Zd�Zd�Zd	�Z	y)
r.z'Wrap MLS rules to allow set operations.)r@�source�target�tclassrrENc���||_t|j�|_t|j�|_t	|j
�|_t
|�|_y�N)�originrrGrHrrI�hash�keyrAs  r �__init__zMLSRuleWrapper.__init__osD�����2�4�;�;�?���2�4�;�;�?���+�D�K�K�8�����:��rc��|jSrK�rNrCs r �__hash__zMLSRuleWrapper.__hash__vs���x�x�rc�4�|j|jkSrKrQ�r5�others  r �__lt__zMLSRuleWrapper.__lt__ys���x�x�%�)�)�#�#rc��|j|jk(xr4|j|jk(xr|j|jk(SrK)rGrHrIrTs  r �__eq__zMLSRuleWrapper.__eq__|sC���{�{�e�l�l�*�(��K�K�5�<�<�'�(��K�K�5�<�<�'�	(r)
rrrr�	__slots__rrOrRrVrXrrr r.r.is,��1�:�I��W�����$�(rr.N)�collectionsr�dataclassesr�	policyreprrr�descriptorsr
�
differencerrr
�mlsr�objclassr�typesr�typingrrr"r.rrr �<module>rcsk��$�!�3�3�-�=�=��+�/���$�d�#��&��$��I%��I%�X(�W�W�%�(r