o *g@sddlZddlZddlZddlZddlmZddZddZddZ dd d Z d dZ da ddZ ddZddZdaddZddZddZdS)N)supportcCst|d}t|d\}}t|d\}}t|d\}}g}|r'|d||r0|d||rG|r<|d|n |d||d|sMd|S|dd }d |S) Ng@@i<z%s hourz%s minz%s secz%.1f secz%s ms )mathceildivmodappendjoin)secondsmsminuteshourspartsr-/usr/lib/python3.10/test/libregrtest/utils.pyformat_durations"  rcCs>|sdSt|D]\}}tj|\}}|dkr|||<qdS)Nz.py) enumerateospathsplitext)namesidxnamebasenameextrrrremovepy!srcCs |dkr d||fSd||fS)Nz%d %sz%d %ssr)nwordrrrcount*s  r FcCs:d|}ttjdddt|D|||d|ddS)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. rcss|]}t|VqdSN)str).0eltrrr ;szprintlist..)initial_indentsubsequent_indent)fileN)printtextwrapfillr sorted)xwidthindentr*blanksrrr printlist1s  r3cCst|dSr#)r print_warning)msgrrrr4@sr4cCs0tjdur tjtjdurtjdSdSr#)sysstdoutflushstderrrrrrflush_std_streamsGs   r:cCsJdt_tdtj}zttjt_t|tjW|t_dS|t_w)NTzUnraisable exception) renvironment_alteredr4r6r9r: __stderr__orig_unraisablehookr8) unraisable old_stderrrrrregrtest_unraisable_hookNs r@cCstjatt_dSr#)r6unraisablehookr=r@rrrrsetup_unraisable_hook\s rBcCsTdt_td|jjtj}zttjt_t |tj W|t_dS|t_w)NTzUncaught thread exception: ) rr;r4exc_type__name__r6r9r:r<orig_threading_excepthookr8)argsr?rrrregrtest_threading_excepthookes rGcCsddl}|jat|_dS)Nr) threading excepthookrErG)rHrrrsetup_threading_excepthookss rJcCs`tjD] }t|dr|`qtjtjtjtjfD] }|dur#| qztjd}Wn t y4Ynw|j ztjd}Wn t yJYnw| ztjd}Wn t y_Ynw|j ztjd}Wn t yuYnw|ztjd}Wn t yYnw|ztjd}Wn t yYnw|ztjd}Wn t yYnw|ztjd } Wn t yYnw| j ztjd } Wn t yYnw| ztjd } Wn t yYnwd| _ztjd } Wn t y Ynw| ztjd } Wn t yYn w| jD]}|q#tdS)N__warningregistry__zdistutils.dir_utilre _strptimez urllib.parsezurllib.request linecache mimetypesfilecmpstructdoctestctypestyping)r6modulesvalueshasattrrKr7r9 __stdout__r<r8KeyError _path_createdclearpurge _regex_cache clear_cache urlcleanup clearcache_default_mime_types_cache _clearcachemaster _reset_cache _cleanupsr gc_collect)modstreamdistutils_dir_utilrLrM urllib_parseurllib_requestrNrOrPrQrRrSrTfrrr clear_cacheszs                 rn)r!r"N)ros.pathrr6r,testrrrr r3r4r=r:r@rBrErGrJrnrrrrs$