Ë
    ÃÓ^j  ã                  óf   — d Z ddlmZ ddlmZmZ ddlmZmZ ddl	m
Z
 ddlmZmZ  G d„ de«      Zy	)
aá  Module containing validation mechanisms for transform parameters.

This module provides a metaclass that enables parameter validation for transforms using
Pydantic models. It intercepts the initialization of transform classes to validate their
parameters against schema definitions, raising appropriate errors for invalid values and
providing type conversion capabilities. This validation layer helps prevent runtime errors
by catching configuration issues at initialization time.
é    )Úannotations)Ú	ParameterÚ	signature)ÚAnyÚCallable)Úwarn)Ú	BaseModelÚValidationErrorc                  ó~   ‡ — e Zd ZdZe	 	 	 	 	 	 	 	 dd„«       Ze	 	 	 	 	 	 	 	 	 	 dd„«       Zedd„«       Zd	ˆ fd„Zˆ xZ	S )
ÚValidatedTransformMetaaý  Metaclass that validates transform parameters during instantiation.

    This metaclass enables automatic validation of transform parameters using Pydantic models,
    ensuring proper typing and constraints are enforced before object creation.

    Args:
        original_init (Callable[..., Any]): Original __init__ method of the class.
        args (tuple[Any, ...]): Positional arguments passed to the __init__ method.
        kwargs (dict[str, Any]): Keyword arguments passed to the __init__ method.

    c                ó`  — t        | «      j                  }t        |j                  «       «      dd  }t	        t        ||«      «      |z  }|j                  dd«      }|j                  «       D ]<  \  }}|dk7  sŒ||vsŒ|j                  t        j                  usŒ.|j                  ||<   Œ> |||fS )Né   ÚstrictFÚself)r   Ú
parametersÚlistÚkeysÚdictÚzipÚpopÚitemsÚdefaultr   Úempty)	Úoriginal_initÚargsÚkwargsÚinit_paramsÚparam_namesÚfull_kwargsr   Úparameter_nameÚ	parameters	            úi/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/albumentations/core/validation.pyÚ_process_init_parametersz/ValidatedTransformMeta._process_init_parameters    s¸   € ô   Ó.×9Ñ9ˆÜ˜;×+Ñ+Ó-Ó.¨q¨rÐ2ˆÜ&*¬3¨{¸DÓ+AÓ&BÀVÑ&Kˆð —‘ ¨5Ó1ˆð *5×):Ñ):Ó)<ò 	@Ñ%ˆN˜Ià &Ó(Ø"¨+Ò5Ø×%Ñ%¬Y¯_©_Ò<à.7×.?Ñ.?�˜NÒ+ð	@ð ˜K¨Ð/Ð/ó    c                óŽ  — 	 |j                  «       D ��ci c]  \  }}||v sŒ||“Œ }}}||d<    | di |¤Ž}|j                  «       }|j                  dd «       |S c c}}w # t        $ r}	t	        t        |	«      «      |	‚d }	~	wt        $ r9}	|rt	        t        |	«      «      |	‚t        t        |	«      d¬«       i cY d }	~	S d }	~	ww xY w)Nr   é   ©Ú
stacklevel© )r   Ú
model_dumpr   r
   Ú
ValueErrorÚstrÚ	Exceptionr   )
Ú
schema_clsr   r   r   ÚkÚvÚschema_kwargsÚconfigÚvalidated_kwargsÚes
             r"   Ú_validate_parametersz+ValidatedTransformMeta._validate_parameters8   sÉ   € ð	$à.9×.?Ñ.?Ó.A×V¡d a¨ÀQÈ+ÒEU˜Q ™TÐVˆMÑVØ&,ˆM˜(Ñ#ÙÑ0 -Ñ0ˆFØ%×0Ñ0Ó2ÐØ× Ñ  ¨4Ô0ð $Ð#ùó Wøô
 ò 	,ÜœS ›VÓ$¨!Ð+ûÜò 	ÙÜ ¤ Q£Ó(¨aÐ/Ü”�Q“ AÕ&Ø�Iûð		ús>   ‚A! •A¢A§2A! ÁA! Á!	CÁ*A?Á?CÂ.B?Â9CÂ?Cc                óœ   — i }| j                  «       D ]6  \  }}|dv rŒ|j                  t        j                  usŒ(|j                  ||<   Œ8 |S )N>   r   r   )r   r   r   r   )r   r3   Ú
param_nameÚparams       r"   Ú_get_default_valuesz*ValidatedTransformMeta._get_default_valuesP   sX   € àÐØ!,×!2Ñ!2Ó!4ò 	=ÑˆJ˜ØÐ/Ñ/ØØ�}‰}¤I§O¡OÒ3Ø/4¯}©}Ð  Ò,ð		=ð
  Ðr$   c                ó   •‡ ‡‡‡— d‰v rdt        ‰d   t        «      rQ‰j                  d«      Š‰€d}t        |«      ‚t	        ‰«      }dˆ ˆˆˆfd„}||_        ‰j                  |_        |‰d<   t        ‰‰ �!  ‰ ‰|‰«      S )zÓThis is a custom metaclass that validates the parameters of the class during instantiation.
        It is used to ensure that the parameters of the class are valid and that they are of the correct type.
        Ú
InitSchemaÚ__init__z&__init__ not found in class definitionc                ót  •— ‰
j                  ‰||«      \  }}}‰
j                  ‰d   |||«      xs$ ‰
j                  t        ‰«      j                  «      }|D �cg c]  }||vsŒ|dk7  sŒ|‘Œ }} ‰| fi |¤Ž || _        |r2ddj                  |«      › d‰› �}	|rt        |	«      ‚t        |	d¬«       y y c c}w )Nr;   r   zArgument(s) 'z, z' are not valid for transform r&   r'   )	r#   r5   r9   r   r   Úinvalid_argsÚjoinr+   r   )r   r   r   r   r   r   r3   Úname_argr>   ÚmessageÚclsÚdctÚnamer   s             €€€€r"   Úcustom_initz3ValidatedTransformMeta.__new__.<locals>.custom_initf   sè   ø€ Ø36×3OÑ3OÐP]Ð_cÐekÓ3lÑ0�˜[¨&à#&×#;Ñ#;Ø˜Ñ%ØØØó	$ò $Rð
 ×,Ñ,¬Y°}Ó-E×-PÑ-PÓQð !ð :@Öx¨XÀ8ÐS^ÒC^ÐckÐowÓcw¢Ðx�ÐxÙ˜dÑ7Ð&6Ò7Ø$0�Ô!áØ -¨d¯i©i¸Ó.EÐ-FÐFdÐeiÐdjÐk�GÙÜ(¨Ó1Ð1Ü˜¨QÖ/ð	  ùò	  ys   Á	B5Á$B5Á*B5)r   r   r   r   r   r   ÚreturnÚNone)	Ú
issubclassr	   Úgetr+   r   Ú__signature__Ú__doc__ÚsuperÚ__new__)	rB   rD   ÚbasesrC   ÚmsgÚoriginal_sigrE   r   Ú	__class__s	   `` `   @€r"   rM   zValidatedTransformMeta.__new__Z   sˆ   ü€ ð ˜3Ñ¤:¨c°,Ñ.?ÄÔ#KØ7:·w±w¸zÓ7JˆMØÐ$Ø>�Ü  “oÐ%ä$ ]Ó3ˆL÷0ð 0ð, )5ˆKÔ%Ø"/×"7Ñ"7ˆKÔà)ˆC�
‰Oä‰w‰˜s D¨%°Ó5Ð5r$   )r   zCallable[..., Any]r   ztuple[Any, ...]r   údict[str, Any]rF   z&tuple[dict[str, Any], list[str], bool])
r.   ztype[BaseModel]r   rR   r   z	list[str]r   ÚboolrF   rR   )r   zdict[str, Parameter]rF   rR   )
rB   ú	type[Any]rD   r,   rN   ztuple[type, ...]rC   rR   rF   rT   )
Ú__name__Ú
__module__Ú__qualname__rK   Ústaticmethodr#   r5   r9   rM   Ú__classcell__)rQ   s   @r"   r   r      s    ø„ ñ
ð ð0Ø)ð0àð0ð ð0ð 
0ò	0ó ð0ð. ð$Ø#ð$à#ð$ð ð$ð ð	$ð
 
ò$ó ð$ð. ò ó ð ÷'6ñ '6r$   r   N)rK   Ú
__future__r   Úinspectr   r   Útypingr   r   Úwarningsr   Úpydanticr	   r
   Útyper   r)   r$   r"   ú<module>r`      s)   ðñõ #ç (ß  Ý ç /ôn6˜Tõ n6r$   