
    zTif              	           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         Z G d dee         Zdedee   fdZddedz  defdZddedz  dededdfdZedk(  r e        yy)z4Common utility functions for various Bio submodules.    N)Any)Callable)cast)Optional)Protocol)TypeVarF.)boundc                   (    e Zd ZU edz  ed<   eed<   y)_FunctionWithPreviousNprevious__call__)__name__
__module____qualname__int__annotations__r	        =/home/agent/.local/lib/python3.12/site-packages/Bio/_utils.pyr   r      s    DjKr   r   funcreturnc                 B    t        t        t           |       }d|_        |S )z<Decorate a function as having an attribute named 'previous'.N)r   r   r	   r   )r   function_with_previouss     r   r   r      s$    !"7":DA&*#!!r   	start_dirc                 d   | sd} t         j                  j                  |       }	 t         j                  j                  t         j                  j	                  |d            rzt         j                  j                  t         j                  j	                  |d            r=t         j                  j                  t         j                  j	                  |d            S t         j                  j                  |      \  }}||k(  rn|}t        dt         j                  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.

    .BioTestsz"Not within Biopython source tree: )ospathabspathisdirjoinsplit
ValueError)r   targetnewtmps       r   find_test_dirr*   $   s      	WW__Y'F
77==fe45"''--GGLL);
 77??277<<#@AA 77==(SS=  
,RWW__Y-G,JK r   
target_dirargskwargsc                    ddl }d|j                  i}|j                  |       t        j                  j                  t        j                        }t        d       	 t        j                  t        |               |j                  |i | t        j                  |       t        d       y# t        j                  |       w xY w)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-   r1   doctest_attributescur_dirs         r   run_doctestr:   G   s     +89I9I)Jf%ggoobii(G	
 
z*+4!34 		&M 	s   0B. .C__main__)N)__doc__r    typingr   collections.abcr   r   r   r   r   objectr	   r   r   strr*   r:   r   r   r   r   <module>rA      s    ; 	  $     CxV,-HQK 
" "'<Q'? " S4Z  3  FC$J c S T ( zM r   