
    Vh                         d Z ddlZddlmZ ddlZddlZddlmZ ddl	m
Z
 ddlmZ defd	Zddej        e         d
ej        e         fdZdS )z=Internal utilities, likely shouldn't be called from outside.
    N)Path   )fatal)DecoratedMain)import_or_fatalmain_modulec                    t          d          }g }|                                D ]a}|                                rK|dz                                  r4||  dz                                  r|                    |j                   bt          |          dk    rt          d           d S t          |          dk    r|d         S t          dd                    |           d	           d S )
N.z__init__.pyz.pyr   zCould not find a training package. Use -P, or set DORA_PACKAGE to set the package. Use --main_module or set DORA_MAIN_MODULE to set the module to be excecuted inside the defined package.r   zFound multiple candidates: z, z. Use -P, or set DORA_PACKAGE to set package being searched. Use --main_module or set DORA_MAIN_MODULE to set the module being searched inside the package.)	r   iterdiris_direxistsappendnamelenr   join)r   cwd
candidateschilds       Q/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/dora/_utils.py_find_packager      s   
s))CJ . .<<>> 	.u}4<<>> 	.;++++3355 .!!%*---
:! 9 	: 	: 	: 	: 	: 
ZA		!} $DIIj,A,A $ $ $ 	% 	% 	% 	% 	%    packagec                    | !t           j                            d          pd} |0t           j                            d          }|t          |           }|dz   | z   }t          j                            dt          t          d          	                                                     t          |          }	 |j        }n## t          $ r t          d| d           Y nw xY wt          |t                    st          | d           |S )NDORA_MAIN_MODULEtrainDORA_PACKAGEr
   r   z"Could not find function `main` in z).main was not decorated with `dora.main`.)osenvirongetr   syspathinsertstrr   resolver   mainAttributeErrorr   
isinstancer   )r   r   module_namemoduler%   s        r   get_mainr*   '   s   jnn%788CG*..00?#K00GC-+-KHOOAs499,,..//000[))FC{ C C CA;AAABBBBBC dM** IGGGHHHKs   :C C"!C")NN)__doc__r   pathlibr   r    typingtplogr   r%   r   utilsr   r#   r   Optionalr*    r   r   <module>r3      s     				       



                 " " " " " "%s % % % %( "+c* BK<L      r   