
    :ja                     :    d Z ddlZddlmZ e G d d             Zy)z5
Configuration settings for regex engine components.
    N)	dataclassc                      e Zd ZU dZ e ej                  dd            Zeed<    e ej                  dd            Z	eed<    e ej                  dd	            Z
eed
<    ej                  dd      j                         dk(  Zeed<    ej                  dd      j                         dk(  Zeed<    ej                  dd      j                         dk(  Zeed<    e ej                  dd            Zeed<    e ej                  dd            Zeed<    e ej                  dd            Zeed<   d Zd Zed d       Zy)!RefineEngineConfigz*Configuration for regex engine components.REGEX_MAX_QUERIES	100000000max_queriesREGEX_MAX_DEPTH3	max_depthREGEX_MAX_QUANTIFIER_LENGTH150max_quantifier_lengthREGEX_ENABLE_RECURSION_LIMITfalsetrueenable_recursion_limitREGEX_ENABLE_VALUE_THRESHOLDenable_value_thresholdREGEX_ENABLE_RESOURCE_LIMITenable_resource_limitREGEX_MAX_RECURSION_DEPTH10max_recursion_depthREGEX_MIN_ENUMERATION_VALUEz0.01min_enumeration_valueREGEX_MAX_RESOURCE_COSTz50.0max_resource_costc                 $    | j                          y)z3Validate configuration values after initialization.N)	_validate)selfs    4/root/.openclaw/workspace/harvester/refine/config.py__post_init__z RefineEngineConfig.__post_init__   s        c                 R   | j                   | j                  | j                  | j                  d}|j	                         D ]+  \  }}t        |t              r|dk  st        d| d|        | j                  | j                  d}|j	                         D ]1  \  }}t        |t        t        f      r|dk  s"t        d| d|        | j                  | j                  | j                  d}|j	                         D ]&  \  }}t        |t              rt        d| d|        y	)
zValidate configuration values.)r   r   r   r   r   zConfiguration 'z#' must be a positive integer, got: )r   r   z"' must be a positive number, got: )r   r   r   z' must be a boolean, got: N)r   r   r   r   items
isinstanceint
ValueErrorr   r   floatr   r   r   bool)r    integer_fields
field_namevaluefloat_fieldsboolean_fieldss         r!   r   zRefineEngineConfig._validate    sN     ++%)%?%?#'#;#;	
 "0!5!5!7 	kJeS)UaZ ?:,>abgah!ijj	k &*%?%?!%!7!7
 ".!3!3!5 	jJec5\2eqj ?:,>`af`g!hii	j '+&A&A&*&A&A%)%?%?

 "0!5!5!7 	bJeT* ?:,>XY^X_!`aa	br#   c                      |        }|j                         D ],  \  }}t        ||      rt        |||        t        d|        |j	                          |S )z
        Create configuration instance with optional overrides.

        Args:
            **overrides: Configuration field overrides

        Returns:
            RegexEngineConfig: Configuration instance with overrides applied
        zUnknown configuration field: )r%   hasattrsetattrr(   r   )cls	overridesconfigkeyr-   s        r!   create_with_overridesz(RefineEngineConfig.create_with_overrides@   se      $//+ 	HJCvs#U+ #@!FGG		H 	r#   N)returnr   )__name__
__module____qualname____doc__r'   osgetenvr   __annotations__r   r   lowerr   r*   r   r   r   r)   r   r   r"   r   classmethodr7    r#   r!   r   r      sT   4 9299%8+FGKG#4c:;Is;!$YRYY/Le%T!U3U $-299-KW#U#[#[#]ag#gDg#,299-KW#U#[#[#]ag#gDg"+")),I7"S"Y"Y"[_e"e4e"9299-H$#OPP#(3PRX)Y#Z5Z$YRYY/H&%QRuRb@  r#   r   )r<   r=   dataclassesr   r   rB   r#   r!   <module>rD      s.    
 ! L L Lr#   