File: //lib/python3/dist-packages/sos/cleaner/mappings/__pycache__/__init__.cpython-312.pyc
�
    -�_g
  �                   �,   � d dl Z d dlmZ  G d� d�      Zy)�    N)�Lockc                   �T   � e Zd ZdZg Zg ZdZdZdZd� Z	d� Z
d� Zd� Zd� Z
d	� Zd
� Zd� Zy)
�SoSMapz�Standardized way to store items with their obfuscated counterparts.
    Each type of sanitization that SoSCleaner supports should have a
    corresponding SoSMap() object, to allow for easy retrieval of obfuscated
    items.
    TFc                 �\   � i | _         t        �       | _        g | _        t	        �       | _        y )N)�dataset�set�
_regexes_made�compiled_regexesr   �lock)�selfs    �?/usr/lib/python3/dist-packages/sos/cleaner/mappings/__init__.py�__init__zSoSMap.__init__   s$   � ���� �U��� "����F��	�    c                 �  � |rD|| j                   v s6|| j                  j                  �       v s| j                  rt	        |�      dk  ry| j
                  D ])  }t
        j                  ||t        j                  �      s�) y y)z�Some items need to be completely ignored, for example link-local or
        loopback addresses should not be obfuscated
        �   TF)	�	skip_keysr   �values�ignore_short_items�len�ignore_matches�re�match�I)r   �item�skips      r
   �ignore_itemzSoSMap.ignore_item%   sm   � � �t�t�~�~�-�����9L�9L�9N�1N��+�+��D�	�Q����'�'� 	�D��x�x��d�B�D�D�)��	� r   c                 �   � | j                  |�      r|S | j                  5  | j                  |�      | j                  |<