§
    +P„jU  ã                  óÀ   — d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
ZddlZe	j        Z ed¦  «        Z ej        dd¬	¦  «        dd„¦   «         Zddddœdd„Zdd„ZdS )zTest utils.é    )Úannotations)ÚCallableÚIterableÚOptionalÚTypeVar)Únumpy_utilsNÚ_FnTÚmoduleT)ÚscopeÚautouseÚreturnÚNonec                 óF   — t           j                             d¬¦  «         dS )zËEnable numpy behavior (for `tensorflow`).

  Note: The fixture has to be explicitly declared in the `_test.py`
  file where it is used. This can be done by assigning
  `set_tnp = enp.testing.set_tnp`.
  T)Úprefer_float32N)ÚlazyÚtnpÚ"experimental_enable_numpy_behavior© ó    úV/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/etils/enp/testing.pyÚset_tnpr      s#   € õ „(×-Ò-¸TÐ-ÑBÔBÐBÐBÐBr   F)Ú	with_noneÚrestrictÚskipr   Úboolr   úOptional[Iterable[str]]r   úCallable[[_FnT], _FnT]c                ót  ‡‡— d„ d„ d„ d„ dœ}t          |||¬¦  «        Št          ‰g |¬¦  «        Šˆˆfd„|                     ¦   «         D ¦   «         }| rd|d	<   t          j                             d
t          |                     ¦   «         ¦  «        t          |                     ¦   «         ¦  «        ¬¦  «        S )a\  Parametrize over the numpy modules.

  Args:
    with_none: If `True`, also yield `None` among the values (to test `list`)
    restrict: If given, only test the given module (e.g. `restrict=['jnp']`)
    skip: If given, skip the given module from test (e.g. `skip=['torch']`)

  Returns:
    The fixture to apply to the `def test_xyz()` function
  c                 ó   — t           S ©N)Únpr   r   r   ú<lambda>z!parametrize_xnp.<locals>.<lambda>;   s   € •B€ r   c                 ó   — t           j        S r    )r   Újnpr   r   r   r"   z!parametrize_xnp.<locals>.<lambda><   ó   € •T”X€ r   c                 ó   — t           j        S r    )r   r   r   r   r   r"   z!parametrize_xnp.<locals>.<lambda>=   r%   r   c                 ó   — t           j        S r    )r   Útorchr   r   r   r"   z!parametrize_xnp.<locals>.<lambda>>   s   € •t”z€ r   )r!   r$   r   r(   )ÚdefaultÚvalidc                ó<   •— i | ]\  }}|‰v¯	|‰v ¯| |¦   «         “ŒS r   r   )Ú.0ÚkÚvÚkeepr   s      €€r   ú
<dictcomp>z#parametrize_xnp.<locals>.<dictcomp>G   s9   ø€ ð ð ð Ù��A°A¸T°M°MÀaÈ4ÀiÀi€aˆˆ‰ŒÀiÀiÀir   NÚno_npÚxnp)Úids)Ú_normalize_setÚitemsÚpytestÚmarkÚparametrizeÚlistÚvaluesÚkeys)r   r   r   Úname_to_modulesr/   s     ` @r   Úparametrize_xnpr=   *   sù   øø€ ð" ˆJØÐØÐØ!Ð!ð	ð €/õ 
Ø˜¨ð
ñ 
ô 
€$õ 
˜ b°Ð	@Ñ	@Ô	@€$ðð ð ð ð Ø(×.Ò.Ñ0Ô0ðñ ô €/ð ð $à#€O�GÑå	Œ×	 Ò	 ØÝ
ˆ?×!Ò!Ñ#Ô#Ñ$Ô$Ý
ˆ×#Ò#Ñ%Ô%Ñ
&Ô
&ð 
!ñ 
ô 
ð r   r:   úIterable[str]r)   r*   úset[str]c                ó¬   — t          | t          ¦  «        r| gn| } t          | €|n| ¦  «        } | t          |¦  «        z
  x}rt          d|› �¦  «        ‚| S )NzUnexpected numpy module: )Ú
isinstanceÚstrÚsetÚ
ValueError)r:   r)   r*   Úextra_elementss       r   r4   r4   V   sh   € õ " &­#Ñ.Ô.Ð:ˆFˆ8ˆ8°F€&Ý˜&˜.ˆwˆw¨fÑ5Ô5€&Ø¥ U¡¤Ñ+Ð,€^ð CÝ
ÐA°ÐAÐAÑ
BÔ
BÐBØ	€-r   )r   r   )r   r   r   r   r   r   r   r   )r:   r>   r)   r>   r*   r>   r   r?   )Ú__doc__Ú
__future__r   Útypingr   r   r   r   Ú	etils.enpr   Únumpyr!   r6   r   r	   Úfixturer   r=   r4   r   r   r   ú<module>rL      sý   ðð Ð à "Ð "Ð "Ð "Ð "Ð "à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8à !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ø €€€àÔ€à€wˆv�„€ð €„�h¨Ð-Ñ-Ô-ðCð Cð Cñ .Ô-ðCð Ø(,Ø$(ð	)ð )ð )ð )ð )ð )ðXð ð ð ð ð r   