o
    RŀgB                  	   @   s   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ed	ed
e	f dZ
G dd dee
 Zde
dee
 fddZddee defddZddee dededdfddZedkrne  dS dS )z4Common utility functions for various Bio submodules.    N)Any)Callable)cast)Optional)Protocol)TypeVarF.)boundc                   @   s"   e Zd ZU ee ed< eed< dS )_FunctionWithPreviousprevious__call__N)__name__
__module____qualname__r   int__annotations__r    r   r   >/var/www/html/myenv/lib/python3.10/site-packages/Bio/_utils.pyr
      s   
 r
   funcreturnc                 C   s   t tt | }d|_|S )z<Decorate a function as having an attribute named 'previous'.N)r   r
   r   r   )r   function_with_previousr   r   r   r      s   r   	start_dirc                 C   s   | sd} t j| }	 t jt j|dr,t jt j|dr,t jt j|dS t j|\}}||kr9n|}qtdt j| )a   Find the absolute path of Biopython's Tests directory.

    Arguments:
    start_dir -- Initial directory to begin lookup (default to current dir)

    If the directory is not found up the filesystem's root directory, an
    exception will be raised.

    .TBioTestsz"Not within Biopython source tree: )ospathabspathisdirjoinsplit
ValueError)r   targetnewtmpr   r   r   find_test_dir$   s    
r%   
target_dirargskwargsc              	   O   sx   ddl }d|ji}|| tjtj}td ztt	|  |j
|i | W t| nt| w td dS )z%Run doctest for the importing module.r   NoptionflagszRunning doctests...Done)doctestELLIPSISupdater   r   r   curdirprintchdirr%   testmod)r&   r'   r(   r+   default_kwargscur_dirr   r   r   run_doctestG   s   

r4   __main__)N)__doc__r   typingr   r   r   r   r   r   objectr   r
   r   strr%   r4   r   r   r   r   r   <module>   s     #
