
    i                        % S SK r S SKrS SKJr  S SKJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJrJrJr  S SKJr  S S	KJr  S S
KJr  S\4S jrS\S\4S jr\" 5       r\\S'    " S S5      r " S S5      r " S S5      rg)    N)dedent)AnyOptional)version)deprecation_warning)Hydra)create_config_search_path.detect_calling_file_or_module_from_stack_framedetect_task_name)GlobalHydra)	Singleton)HydraExceptionreturnc                      [         [        R                  ;   a+  [        R                  " [        R                  [            5      $ g N)r   r   
_instancescopydeepcopy     O/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/hydra/initialize.pyget_gh_backupr      s-    i***}}Y11+>??r   
_gh_backupc                 d    U c  [         R                  [        	 g U [         R                  [        '   g r   )r   r   r   r   s    r   restore_gh_from_backupr      s&      -,6	[)r   _UNSPECIFIED_c                       \ rS rSrSr\SS\4S\\   S\\   S\S\\   S	S4
S
 jjr	S\
S\
S	S4S jrS\
S\
S\
S	S4S jrS	\4S jrSrg)
initialize%   a
  
Initializes Hydra and add the config_path to the config search path.
config_path is relative to the parent of the caller.
Hydra detects the caller type automatically at runtime.

Supported callers:
- Python scripts
- Python modules
- Unit tests
- Jupyter notebooks.
:param config_path: path relative to the parent of the caller
:param job_name: the value for hydra.job.name (By default it is automatically detected based on the caller)
:param caller_stack_depth: stack depth of the caller, defaults to 1 (direct caller).
N   config_pathjob_namecaller_stack_depthversion_baser   c                    [        5       U l        [        R                  " U5        U[        L aE  [        R
                  " S5      (       a  S nO'U[        L a  Sn[        [        SU S35      SS9  SnOSnUb/  [        R                  R                  U5      (       a  [        S5      e[        US	-   5      u  pgUc	  [        XgS
9n[        R                  " UUUUS9  g )Nz1.2zOhttps://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/changes_to_hydra_main_config_pathz`                    config_path is not specified in hydra.initialize().
                    See z for more information.   )message
stacklevel.z,config_path in initialize() must be relativer!   )calling_filecalling_moduler+   r,   r"   r#   )r   r   r   setbaser   base_at_leastr   r   ospathisabsr   r
   r   r    create_main_hydra_file_or_module)selfr"   r#   r$   r%   urlr+   r,   s           r   __init__initialize.__init__5   s     (/%-'$$U++".g#"37
  ! "!"rww}}['A'A !OPP'U"(
$ ')H 	..%)#		
r   argskwargsc                     g r   r   r4   r8   r9   s      r   	__enter__initialize.__enter__b       r   exc_typeexc_valexc_tbc                 .    [        U R                  5        g r   r   r   r4   r?   r@   rA   s       r   __exit__initialize.__exit__e       t/r   c                     g)Nzhydra.initialize()r   r4   s    r   __repr__initialize.__repr__h   s    #r   r   )__name__
__module____qualname____firstlineno____doc__r   r   strintr6   r   r<   rE   rJ   __static_attributes__r   r   r   r   r   %   s    " &3"&"#&3+
c]+
 3-+
  	+

 sm+
 
+
Zs c d 0 0s 0C 0D 0$# $r   r   c                   z    \ rS rSrSrS\4S\S\S\\   4S jjrS\	S	\	S
S4S jr
S\	S\	S\	S
S4S jrS
\4S jrSrg)initialize_config_modulel   a#  
Initializes Hydra and add the config_module to the config search path.
The config module must be importable (an __init__.py must exist at its top level)
:param config_module: absolute module name, for example "foo.bar.conf".
:param job_name: the value for hydra.job.name (default is 'app')
appconfig_moduler#   r%   c                     [        5       U l        [        R                  " U5        [        R
                  " S U SU 3S US9  g )Nr*   r-   )r   r   r   r.   r   r3   )r4   rX   r#   r%   s       r   r6   !initialize_config_module.__init__t   s>     (/%..+_AhZ8		
r   r8   r9   r   Nc                     g r   r   r;   s      r   r<   "initialize_config_module.__enter__   r>   r   r?   r@   rA   c                 .    [        U R                  5        g r   rC   rD   s       r   rE   !initialize_config_module.__exit__   rG   r   c                     g)Nz hydra.initialize_config_module()r   rI   s    r   rJ   !initialize_config_module.__repr__   s    1r   r   rL   rM   rN   rO   rP   r   rQ   r   r6   r   r<   rE   rJ   rS   r   r   r   rU   rU   l   s{     &3	

 
 sm	
"s c d 0 0s 0C 0D 02# 2r   rU   c            	       ~    \ rS rSrSrS\4S\S\S\\   SS4S	 jjrS
\	S\	SS4S jr
S\	S\	S\	SS4S jrS\4S jrSrg)initialize_config_dir   a>  
Initializes Hydra and add an absolute config dir to the to the config search path.
The config_dir is always a path on the file system and is must be an absolute path.
Relative paths will result in an error.
:param config_dir: absolute file system path
:param job_name: the value for hydra.job.name (default is 'app')
rW   
config_dirr#   r%   r   Nc                     [        5       U l        [        R                  " U5        [        R
                  R                  U5      (       d  [        S5      e[        US9n[        R                  " X$S9  g )Nz@initialize_config_dir() requires an absolute config_dir as input)search_path_dir)	task_nameconfig_search_path)r   r   r   r.   r0   r1   r2   r   r	   r   create_main_hydra2)r4   re   r#   r%   csps        r   r6   initialize_config_dir.__init__   sX     (/%
 ww}}Z(( R  (
C  8Lr   r8   r9   c                     g r   r   r;   s      r   r<   initialize_config_dir.__enter__   r>   r   r?   r@   rA   c                 .    [        U R                  5        g r   rC   rD   s       r   rE   initialize_config_dir.__exit__   rG   r   c                     g)Nzhydra.initialize_config_dir()r   rI   s    r   rJ   initialize_config_dir.__repr__   s    .r   r   ra   r   r   r   rc   rc      s     &3	MM M sm	M
 
M(s c d 0 0s 0C 0D 0/# /r   rc   )r   r0   textwrapr   typingr   r   hydrar   #hydra._internal.deprecation_warningr   hydra._internal.hydrar   hydra._internal.utilsr	   r
   r   hydra.core.global_hydrar   hydra.core.singletonr   hydra.errorsr   r   r   objectr   __annotations__r   rU   rc   r   r   r   <module>r~      s~     	     C ' 
 0 * 's 7s 7s 7 Xs D$ D$N 2  2F$/ $/r   