
    h                     x    d dl Z d dlZd dlZd dlZd dlmZ d Zd Zd Z	ddZ
d	 Zdad
 Zd Zdad Zd Zd ZdS )    N)supportc                    t          j        | dz            }t          |d          \  } }t          | d          \  }} t          |d          \  }}g }|r|                    d|z             |r|                    d|z             | r9|r|                    d| z             n|                    d| |dz  z   z             |sd|z  S |d d	         }d
                    |          S )Ng     @@i  <   z%s hourz%s minz%s secz%.1f secz%s ms    )mathceildivmodappendjoin)secondsmsminuteshourspartss        -/usr/lib/python3.11/test/libregrtest/utils.pyformat_durationr      s   	7S=	!	!BT""KGRgr**GWGR((NE7E (Y&''' )X'((( = 	=LLG+,,,, LLwd':;<<< |"1"IE88E??    c                     | sd S t          |           D ]2\  }}t          j                            |          \  }}|dk    r|| |<   3d S )Nz.py)	enumerateospathsplitext)namesidxnamebasenameexts        r   removepyr   !   s`     u%% " "	T((..#%<<!E#J" "r   c                 *    | dk    rd| |fz  S d| |fz  S )N   z%d %sz%d %ss )nwords     r   countr%   *   s)    Avv!T""1d)##r   F      c           
          d|z  }t          t          j        d                    d t	          |           D                       |||          |           dS )zPrint the elements of iterable x to stdout.

    Optional arg width (default 70) is the maximum line length.
    Optional arg indent (default 4) is the number of blanks with which to
    begin each line.
    r   c              3   4   K   | ]}t          |          V  d S N)str).0elts     r   	<genexpr>zprintlist.<locals>.<genexpr>;   s(       ? ?cS ? ? ? ? ? ?r   )initial_indentsubsequent_indent)fileN)printtextwrapfillr   sorted)xwidthindentr1   blankss        r   	printlistr:   1   sq     6\F	(- ? ?VAYY ? ? ???'-I I I     r   c                 .    t          j        |            d S r*   )r   print_warning)msgs    r   r<   r<   @   s    #r   c                 P   dt           _        t          j        d           t          j        }	 t          j                     t           j        j        t          _        t          |            t          j                                         |t          _        d S # |t          _        w xY w)NTzUnraisable exception)	r   environment_alteredr<   sysstderrflush_std_streamsorig_stderrorig_unraisablehookflush)
unraisable
old_stderrs     r   regrtest_unraisable_hookrH   G   s    "&G0111J !###*6
J'''



Z
s   AB B%c                  @    t           j        at          t           _        d S r*   )r@   unraisablehookrD   rH   r"   r   r   setup_unraisable_hookrK   U   s    ,1Cr   c                 j   dt           _        t          j        d| j        j                    t
          j        }	 t          j                     t           j        j        t
          _        t          |            t
          j        
                                 |t
          _        d S # |t
          _        w xY w)NTzUncaught thread exception: )r   r?   r<   exc_type__name__r@   rA   rB   rC   orig_threading_excepthookrE   )argsrG   s     r   regrtest_threading_excepthookrQ   ^   s    "&GP8NPPQQQJ !###*6
!$'''



Z
s   AB$ $B2c                  4    dd l } | j        at          | _        d S )Nr   )	threading
excepthookrO   rQ   )rS   s    r   setup_threading_excepthookrU   l   s%     ) 48Ir   c                  >   t           j                                        D ]} t          | d          r| `t           j        t           j        t           j        t           j        fD ]}||	                                 	 t           j        d         }|j
                                         n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d         }|j                                         n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d	         }	|	j                                         n# t          $ r Y nw xY w	 t           j        d
         }
|
                                 n# t          $ r Y nw xY w	 t           j        d         }d |_        n# t          $ r Y nw xY w	 t           j        d         }|                                 n# t          $ r Y nw xY w	 t           j        d         }|j        D ]} |             d S # t          $ r Y d S w xY w)N__warningregistry__zdistutils.dir_utilre	_strptimezurllib.parsezurllib.request	linecache	mimetypesfilecmpstructdoctestctypestyping)r@   modulesvalueshasattrrW   stdoutrA   
__stdout__
__stderr__rE   _path_createdclearKeyErrorpurge_regex_cacheclear_cache
urlcleanup
clearcache_default_mime_types_cache_clearcachemaster_reset_cache	_cleanups)modstreamdistutils_dir_utilrX   rY   urllib_parseurllib_requestrZ   r[   r\   r]   r^   r_   r`   fs                  r   clear_cachesr{   s   s   {!!## ( (3-.. 	(' :sz3>3>J  LLNNN1 [)=> 	(..0000    
[ 	



    
'K,	 	$$&&&&    
#{>2 	  """"    
$%56 	!!####    
K,	 	    
(K,	 	%%''''    
+i( 	    
X& 	    
+i(     
X& 	    
X& ! 	 	AACCCC	 	    s   <B( (
B54B59C   
C-,C-1D 
D*)D*.E 
E"!E"&F 
FFG 
GGG= =
H
	H
H: :
III2 2
I?>I?J 
J*)J*.K 
K"!K"&L 
LL)r&   r'   N)r   os.pathr   r@   r3   testr   r   r   r%   r:   r<   rD   rH   rK   rO   rQ   rU   r{   r"   r   r   <module>r~      s      



         2" " "$ $ $            2 2 2 !      9 9 9a a a a ar   