
    j^                     N    d dl mZmZ ddlmZmZ  G d dej                        Zy)    )ListAny   )recursive_anonymizerrulesc                   \     e Zd ZdZd	deej                     def fdZde	de
de	fdZ xZS )
RulesAnonymizerzAn anonymizer that applies a list of rules sequentially to text data.

    This class takes a list of Rule objects and applies them to
    anonymize sensitive information in text.
    anonymizer_rules	max_depthc                 2    t         |   |       || _        y)zInitialize the RulesAnonymizer with a list of rules.

        Args:
            anonymizer_rules: List of Rule objects to apply for anonymization.
            max_depth: Maximum recursion depth for nested data structures.
        N)super__init__r   )selfr
   r   	__class__s      y/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/anonymizer/rules_anonymizer.pyr   zRulesAnonymizer.__init__   s     	#%
    datakwargsreturnc                 N    |}| j                   D ]  }|j                  |      } |S )zApply all rules sequentially to the input text.

        Args:
            data: The text to anonymize.

        Returns:
            The anonymized text after applying all rules.
        )r   apply)r   r   r   resultrules        r   anonymize_textzRulesAnonymizer.anonymize_text   s*     JJDZZ'F r   )
   )__name__
__module____qualname____doc__r   r   Ruleintr   strr   r   __classcell__)r   s   @r   r	   r	      s>    &ejj)9 &c &3 # # r   r	   N)typingr   r    r   r   RecursiveAnonymizerr	    r   r   <module>r(      s     )*>> r   