o =?h@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 )mathZceildivmodappendjoin)ZsecondsZmsZminutesZhourspartsr =/opt/alt/python310/lib64/python3.10/test/libregrtest/utils.pyformat_durations"  r cCs>|sdSt|D]\}}tj|\}}|dkr|||<qdS)Nz.py) enumerateospathsplitext)namesidxnamebasenameZextr r r removepy!srcCs |dkr d||fSd||fS)Nz%d %sz%d %ssr )nZwordr r r count*s  rFcCs: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).0eltr r r ;szprintlist..)Zinitial_indentZsubsequent_indent)fileN)printtextwrapZfillr sorted)xwidthindentr!Zblanksr r r printlist1s  r(cCst|dSr)r print_warning)msgr r r r)@sr)cCs0tjdur tjtjdurtjdSdSr)sysstdoutflushstderrr r r r flush_std_streamsGs   r/cCsJdt_tdtj}zttjt_t|tjW|t_dS|t_w)NTzUnraisable exception) renvironment_alteredr)r+r.r/ __stderr__orig_unraisablehookr-)Z unraisable old_stderrr r r regrtest_unraisable_hookNs r4cCstjatt_dSr)r+unraisablehookr2r4r r r r setup_unraisable_hook\s r6cCsTdt_td|jjtj}zttjt_t |tj W|t_dS|t_w)NTzUncaught thread exception: ) rr0r)exc_type__name__r+r.r/r1orig_threading_excepthookr-)argsr3r r r regrtest_threading_excepthookes r;cCsddl}|jat|_dS)Nr) threading excepthookr9r;)r<r r r setup_threading_excepthookss r>cCs`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)r+modulesvalueshasattrr?r,r. __stdout__r1r-KeyErrorZ _path_createdclearpurgeZ _regex_cacheZ clear_cacheZ urlcleanup clearcacheZ_default_mime_types_cacheZ _clearcacheZmasterZ _reset_cacheZ _cleanupsrZ gc_collect)modstreamZdistutils_dir_utilr@rAZ urllib_parseZurllib_requestrBrCrDrErFrGrHfr r r clear_cacheszs                 rU)rrN)rZos.pathrr+r#testrr rrr(r)r2r/r4r6r9r;r>rUr r r r s$