a
    "h2                     @   sn   d dl Z d dlZd dlZd dlZd dlmZ dd Zdd Zdd Z	dddZ
dd Zdadd Zdd ZdS )    N)supportc                 C   s   t | d }t|d\} }t| d\}} t|d\}}g }|rN|d|  |r`|d|  | r|rx|d|   n|d| |d    |sd| S |d d	 }d
|S )Ng     @@i  <   z%s hourz%s minz%s secz%.1f secz%s ms    )mathceildivmodappendjoin)ZsecondsmsZminutesZhoursparts r   >/opt/python-3.9.21/usr/lib/python3.9/test/libregrtest/utils.pyformat_duration   s"    r   c                 C   s>   | sd S t | D ](\}}tj|\}}|dkr|| |< qd S )Nz.py)	enumerateospathsplitext)namesidxnamebasenameextr   r   r   removepy!   s    r   c                 C   s$   | dkrd| |f S d| |f S d S )N   z%d %sz%d %ssr   )nZwordr   r   r   count*   s    r   F      c                 C   s:   d| }t tjddd t| D |||d|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                 s   s   | ]}t |V  qd S N)str).0eltr   r   r   	<genexpr>;       zprintlist.<locals>.<genexpr>)initial_indentsubsequent_indent)fileN)printtextwrapfillr
   sorted)xwidthindentr'   Zblanksr   r   r   	printlist1   s    r/   c                 C   s   t |  d S r   )r   print_warning)msgr   r   r   r0   @   s    r0   c                 C   s<   dt _td tj}ztjt_t|  W |t_n|t_0 d S )NTzUnraisable exception)r   Zenvironment_alteredr0   sysstderr
__stderr__orig_unraisablehook)Z
unraisableZ
old_stderrr   r   r   regrtest_unraisable_hookG   s    
r6   c                   C   s   t jatt _d S r   )r2   unraisablehookr5   r6   r   r   r   r   setup_unraisable_hookS   s    r8   )r   r   N)r   Zos.pathr   r2   r)   testr   r   r   r   r/   r0   r5   r6   r8   r   r   r   r   <module>   s   	
