选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´iŽrã@sÊdZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z gd¢ZGdd „d eeƒZe d d �Gd d „d ƒƒZe d d �Gdd„dƒƒZGdd„dƒZGdd„dƒZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zed"k�rÆddlZz ddlZWne�y,Yn0Gd#d$„d$ej ƒZ!e"ej#ƒd%k�r\ej#d%Z$ndZ$zPe!e$ƒZ%ej#d&d…D]Z&e% 'e&¡�qxe(d'e%j)d(�e% *¡e(d)e%j)d(�Wne+�yÄYn0dS)*z3Class for printing reports on profiled python code.éN)ÚEnum)Ú cmp_to_key)Ú dataclass)ÚDict)ÚStatsÚSortKeyÚFunctionProfileÚ StatsProfilec@s8eZdZdZdZdZdZdZdZdZ dZ d Z d d „Z d S) r)ÚcallsÚncalls)Ú cumulativeÚcumtime)ÚfilenameÚmoduleÚlineÚnameÚnflÚpcallsÚstdname)ÚtimeÚtottimecGs@|d}t ||¡}||_|dd…D]}||j|<q&||_|S©Nré)ÚstrÚ__new__Ú_value_Ú_value2member_map_Z _all_values)ÚclsÚvaluesÚvalueÚobjZ other_value©r!ú/usr/lib64/python3.9/pstats.pyr/s  zSortKey.__new__N) Ú__name__Ú __module__Ú __qualname__ZCALLSZ CUMULATIVEZFILENAMEZLINEÚNAMEZNFLZPCALLSZSTDNAMEZTIMErr!r!r!r"r$srT)Z unsafe_hashc@sFeZdZUeed<eed<eed<eed<eed<eed<eed<dS) rr rÚpercall_tottimer Úpercall_cumtimeÚ file_nameÚ line_numberN)r#r$r%ÚintÚ__annotations__Úfloatrr!r!r!r"r9s rc@s*eZdZUdZeed<eeefed<dS)r z0Class for keeping track of an item in inventory.Útotal_ttÚ func_profilesN) r#r$r%Ú__doc__r-r,rrrr!r!r!r"r Cs r c@sàeZdZdZddœdd„Zdd„Zdd „Zd d „Zd d „Zdd„Z ddddddddddddddœ Z dd„Z dd„Z dd„Z d d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd9d3d4„Zd5d6„Zd7d8„ZdS):raÛThis class is used for creating reports from data generated by the Profile class. It is a "friend" of that class, and imports data either by direct access to members of Profile class, or by reading in a dictionary that was emitted (via marshal) from the Profile class. The big change from the previous Profiler (in terms of raw functionality) is that an "add()" method has been provided to combine Stats from several distinct profile runs. Both the constructor and the add() method now take arbitrarily many file names as arguments. All the print methods now take an argument that indicates how many lines to print. If the arg is a floating point number between 0 and 1.0, then it is taken as a decimal percentage of the available lines to be printed (e.g., .1 means print 10% of all available lines). If it is an integer, it is taken to mean the number of lines of data that you wish to have printed. The sort_stats() method now processes some additional options (i.e., in addition to the old -1, 0, 1, or 2 that are respectively interpreted as 'stdname', 'calls', 'time', and 'cumulative'). It takes either an arbitrary number of quoted strings or SortKey enum to select the sort order. For example sort_stats('time', 'name') or sort_stats(SortKey.TIME, SortKey.NAME) sorts on the major key of 'internal function time', and on the minor key of 'the name of the function'. Look at the two tables in sort_stats() and get_sort_arg_defs(self) for more examples. All methods return self, so you can string together commands like: Stats('foo', 'goo').strip_dirs().sort_stats('calls'). print_stats(5).print_callers(5) N)ÚstreamcGsF|ptj|_t|ƒsd}n|d}|dd…}| |¡|j|ŽdSr)ÚsysÚstdoutr1ÚlenÚinitÚadd)Úselfr1ÚargsÚargr!r!r"Ú__init__ks   zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_tƒ|_i|_ i|_ |  |¡z |  ¡Wn6t yŠtd|jrv|jdnd|jd�‚Yn0dS)NrzInvalid timing data %séÿÿÿÿÚ©Úfile)Ú all_calleesÚfilesÚfcn_listr.Ú total_callsÚ prim_callsÚ max_name_lenÚsetÚ top_levelÚstatsÚ sort_arg_dictÚ load_statsÚget_top_level_statsÚ ExceptionÚprintr1)r7r9r!r!r"r5us(   ÿÿz Stats.initcCsÈ|duri|_dSt|tƒrŒt|dƒ�}t |¡|_Wdƒn1sH0Yz"t |¡}t  |j ¡d|}Wn Yn0|g|_ n t |dƒr¬|  ¡|j|_i|_|jsÄtd|j|fƒ‚dS)NÚrbz Ú create_statsz.Cannot create or construct a %r object from %r)rGÚ isinstancerÚopenÚmarshalÚloadÚosÚstatrÚctimeÚst_mtimer@ÚhasattrrNÚ TypeErrorÚ __class__)r7r9ÚfZ file_statsr!r!r"rIˆs*  *   ÿzStats.load_statscCs€|j ¡D]p\}\}}}}}|j|7_|j|7_|j|7_d|vrZ|j |¡tt|ƒƒ|j kr tt|ƒƒ|_ q dS)N)ZjprofilerZprofiler) rGÚitemsrBrCr.rFr6r4Úfunc_std_stringrD)r7ÚfuncÚccÚncÚttÚctÚcallersr!r!r"rJžs zStats.get_top_level_statscGsì|s|St|ƒD]Ö}t|ƒt|ƒkr,t|ƒ}|j|j7_|j|j7_|j|j7_|j|j7_|jD]}|j |¡qr|j |j kr˜|j |_ d|_ |j   ¡D]<\}}||j vrÆ|j |}nddddif}t ||ƒ|j |<q¨q|S©Nr)ÚreversedÚtyperr@rBrCr.rFr6rDrArGr[Úadd_func_stats)r7Úarg_listÚitemr]rTZ old_func_statr!r!r"r6¨s(     z Stats.addcCs<t|dƒ�}t |j|¡Wdƒn1s.0YdS)z:Write the profile data to a file we know how to load back.ÚwbN)rPrQÚdumprG)r7rrZr!r!r"Ú dump_statsÂs zStats.dump_stats)))rr;z call count)))ér;zcumulative time))©érz file name))©érz line number))©érz function name))rqrmrozname/file/line)))rr;zprimitive call count)))érz standard name)))ér;z internal time) r r r r rrrrrrrrrcCst|jsni|_}i}|j ¡D]>\}}|}|r|s4q||vrFd||<q|||<|dd…}q*q|D] }||=qb|jS)z)Expand all abbreviations that are unique.rNr;)rHÚsort_arg_dict_defaultr[)r7ÚdictZbad_listÚwordÚtupÚfragmentr!r!r"Úget_sort_arg_defsÙs  zStats.get_sort_arg_defscGs\|sd|_|St|ƒdkrBt|dtƒrBdddddœ|dg}n:t|ƒdkr||dd…D] }t|ƒt|dƒkrZtd ƒ‚qZ| ¡}d }d |_d }|D]B}t|tƒrª|j }|||d}|j|||d7_d }q–g}|j   ¡D]4\}\} } } } } |  | | | | f|t |ƒ|f¡qè|jtt|ƒjƒd �g|_}|D]}|  |d¡�qB|S)Nrrrr rr )r;rrrtrtzCan't have mixed argument typer!r<z, )Úkeyr;)rAr4rOr+rerXrzÚ sort_typerrrGr[Úappendr\ÚsortrÚ TupleCompÚcompare)r7Zfieldr9Z sort_arg_defsZ sort_tupleZ connectorrwZ stats_listr]r^r_r`rarbrAÚtupler!r!r"Ú sort_statsìsFýý    ÿ zStats.sort_statscCs|jr|j ¡|S©N)rAÚreverse©r7r!r!r"Ú reverse_orders zStats.reverse_ordercCsî|j}i|_}d}| ¡D]�\}\}}}}} t|ƒ} tt| ƒƒ|krRtt| ƒƒ}i} |  ¡D]\} } | | t| ƒ<q^| |vršt|| ||||| fƒ|| <q||||| f|| <q|j}tƒ|_}|D]}| t|ƒ¡qÄ||_ d|_ d|_ |Src) rGr[Úfunc_strip_pathr4r\rfrFrEr6rDrAr?)r7ZoldstatsZnewstatsrDr]r^r_r`rarbZnewfuncZ newcallersÚfunc2ÚcallerZold_topZnew_topr!r!r"Ú strip_dirss0   þ  zStats.strip_dirsc Cst|jr dSi|_}|j ¡D]P\}\}}}}}||vr@i||<| ¡D]$\}} ||vr`i||<| |||<qHqdSrƒ)r?rGr[) r7r?r]r^r_r`rarbrˆr‰r!r!r"Ú calc_callees5s zStats.calc_calleescCs|}t|tƒrnzt |¡}Wn(tjyD|d|7}||fYS0g}|D]}| t|ƒ¡rN| |¡qNnzt|ƒ}t|t ƒr¶d|kr”dkr¶nnt ||dƒ}|d|…}n2t|t ƒrèd|krÔ|krènn|}|d|…}t|ƒt|ƒk�r|dt|ƒt|ƒ|f7}||fS)Nz# ggð?gà?rz6 List reduced from %r to %r due to restriction <%r> ) rOrÚreÚcompileÚerrorÚsearchr\r}r4r-r+)r7ZselÚlistÚmsgZnew_listZrexr]Úcountr!r!r"Úeval_print_amountHs.  "" ÿzStats.eval_print_amountc Cs|jr|jdd…n t|j ¡ƒ}|s0tdiƒStt|jƒƒ}i}t||ƒ}|D]²}|j|\}}}} } |\} } } ||kr‚t|ƒnt|ƒdt|ƒ}tt|ƒƒ}|dkr®dntt||ƒƒ}tt| ƒƒ}|dkrÖdntt| |ƒƒ}t |||||| | ƒ}||| <qP|S)a?This method returns an instance of StatsProfile, which contains a mapping of function names to instances of FunctionProfile. Each FunctionProfile instance holds information related to the function's profile such as how long the function took to run, how many times it was called, etc... Nrú/r;) rAr�rGÚkeysr r-Úf8r.rr)r7Z func_listr.r/Z stats_profiler]r^r_r`rarbr)r*Ú func_namer rr'r r(Z func_profiler!r!r"Úget_stats_profilebs2"   $  ù zStats.get_stats_profilecCs¾|j}|jr*|jdd…}d|jd}nt|j ¡ƒ}d}|D]}| |||¡\}}q@t|ƒ}|sld|fSt||j d�|t|jƒkr²d}|D] }tt |ƒƒ|kr�tt |ƒƒ}q�|d|fS)Nz Ordered by: Ú z! Random listing order was used rr=rt) rDrAr|r�rGr•r“r4rLr1r\)r7Zsel_listÚwidthZ stat_listr‘Z selectionr’r]r!r!r"Úget_print_list…s$zStats.get_print_listcGsò|jD]}t||jd�q|jr,t|jd�d}|jD]}t|t|ƒ|jd�q6t||jdd|jd�|j|jkrˆtd|jd|jd�td|j|jd�t|jd�| |¡\}}|rî|  ¡|D]}|  |¡qÆt|jd�t|jd�|S)Nr=ú zfunction callsú ©Úendr>z(%d primitive calls)zin %.3f seconds) r@rLr1rFÚfunc_get_function_namerBrCr.r›Ú print_titleÚ print_line)r7ÚamountrÚindentr]ršr�r!r!r"Ú print_stats�s(        zStats.print_statscGsz| |¡\}}|rv| ¡| |d¡|D]2}||jvrN| |||j|¡q*| ||i¡q*t|jd�t|jd�|S)Nz called...r=)r›r‹Úprint_call_headingr?Úprint_call_linerLr1)r7r£ršr�r]r!r!r"Ú print_callees´s    zStats.print_calleesc Gsh| |¡\}}|rd| |d¡|D](}|j|\}}}}} | ||| d¡q"t|jd�t|jd�|S)Nzwas called by...z<-r=)r›r¦rGr§rLr1) r7r£ršr�r]r^r_r`rarbr!r!r"Ú print_callersÃs   zStats.print_callersc Csvtd |¡||jd�d}|j ¡D]0\}}}}}|r&tt| ¡ƒƒ} t| tƒ}qXq&|rrtd|d|jd�dS)Nz Function r=Fr�z ncalls tottime cumtime) rLÚljustr1rGrÚnextÚiterrOr�) r7Ú name_sizeZ column_titleZ subheaderr^r_r`rarbrr!r!r"r¦Îs zStats.print_call_headingú->cCstt|ƒ |¡|d|jd�|s2t|jd�dSt| ¡ƒ}d}|D]¼}t|ƒ}||} t| tƒrÄ| \} } } } | | kr†d| | f}n d| f}d| dd t |ƒ¡t | ƒt | ƒ|f}|d }n$d || t |j |d ƒf}|d }t||||jd�d}qFdS) Nr�ržr=r<z%d/%dz%dz %s %s %s %srsrtrz %s(%r) %srl) rLr\rªr1Úsortedr•rOr�Úrjustr4r–rG)r7r­ÚsourceZ call_dictZarrowZclistr¤r]rrr_r^r`raZsubstatsZ left_widthr!r!r"r§Ús,     ÿ zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz- ncalls tottime percall cumtime percallr�ržzfilename:lineno(function)r=©rLr1r…r!r!r"r¡ószStats.print_titlecCsì|j|\}}}}}t|ƒ}||kr4|dt|ƒ}t| d¡d|jd�tt|ƒd|jd�|dkrxtdd|jd�ntt||ƒd|jd�tt|ƒd|jd�|dkr¾tdd|jd�ntt||ƒd|jd�tt|ƒ|jd�dS)Nr”é r�ržrrœr=)rGrrLr°r1r–r\)r7r]r^r_r`rarbÚcr!r!r"r¢÷szStats.print_line)r®)r#r$r%r0r:r5rIrJr6rkrurzr‚r†rŠr‹r“r˜r›r¥r¨r©r¦r§r¡r¢r!r!r!r"rIsH!  ó'#  rc@s eZdZdZdd„Zdd„ZdS)ra•This class provides a generic function for comparing any two tuples. Each instance records a list of tuple-indices (from most significant to least significant), and sort direction (ascending or decending) for each tuple-index. The compare functions can then be used as the function argument to the system sort() function when a list of tuples need to be sorted in the instances order.cCs ||_dSrƒ©Úcomp_select_list)r7r¶r!r!r"r:szTupleComp.__init__cCsF|jD]:\}}||}||}||kr0| S||kr|SqdSrcrµ)r7ÚleftÚrightÚindexÚ directionÚlÚrr!r!r"r€s  zTupleComp.compareN)r#r$r%r0r:r€r!r!r!r"r srcCs|\}}}tj |¡||fSrƒ)rSÚpathÚbasename)r—rrrr!r!r"r‡"s r‡cCs|dS)Nrtr!)r]r!r!r"r &sr cCsN|dd…dkrB|d}| d¡r<| d¡rz{%s}rr;z %s:%d(%s))Ú startswithÚendswith)r—rr!r!r"r\)s r\c Cs@|\}}}}}|\}}} } } |||||| || t| |ƒfS)z3Add together all the stats for two profile entries.)Ú add_callers) Útargetr±r^r_r`rarbZt_ccZt_ncZt_ttZt_ctZ t_callersr!r!r"rf:s ÿrfcCs‚i}| ¡D]\}}|||<q | ¡D]V\}}||vrtt|tƒrbtdd„t|||ƒDƒƒ||<q||||7<q&|||<q&|S)z*Combine two caller lists in a single list.css|]\}}||VqdSrƒr!)Ú.0ÚiÚjr!r!r"Ú Józadd_callers..)r[rOr�Úzip)rÅr±Z new_callersr]r‰r!r!r"rÄAs  " rÄcCsd}| ¡D] }||7}q |S)z@Sum the caller statistics to get total number of calls received.r)r)rbr_r r!r!r"Ú count_callsRs  rÌcCsd|S)Nz%8.3fr!)Úxr!r!r"r–]sr–Ú__main__c@sÞeZdZd6dd„Zdd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„ZdS)7ÚProfileBrowserNcCs6tj |¡d|_d|_tj|_|dur2| |¡dS)Nú% ) ÚcmdÚCmdr:ÚpromptrGr2r3r1Údo_read)r7Úprofiler!r!r"r:ls  zProfileBrowser.__init__c CsÄ| ¡}g}|D]ˆ}z| t|ƒ¡WqWnty<Yn0zAdd profile info from given file to current statistics object.r=r²r…r!r!r"Úhelp_add�szProfileBrowser.help_addcCs | d|¡S)Nr¨©rÛ©r7rr!r!r"Ú do_callees szProfileBrowser.do_calleescCstd|jd�| ¡dS)Nz6Print callees statistics from the current stat object.r=©rLr1rÜr…r!r!r"Ú help_callees¢szProfileBrowser.help_calleescCs | d|¡S)Nr©rárâr!r!r"Ú do_callers¦szProfileBrowser.do_callerscCstd|jd�| ¡dS)Nz6Print callers statistics from the current stat object.r=rär…r!r!r"Ú help_callers¨szProfileBrowser.help_callerscCstd|jd�dS)Nr<r=rr²râr!r!r"Údo_EOF¬szProfileBrowser.do_EOFcCstd|jd�dS©NzLeave the profile browser.r=r²r…r!r!r"Úhelp_EOF¯szProfileBrowser.help_EOFcCsdS)Nrr!râr!r!r"Údo_quit²szProfileBrowser.do_quitcCstd|jd�dSrér²r…r!r!r"Ú help_quit´szProfileBrowser.help_quitc CsÐ|r–zt|ƒ|_WnvtyL}z"t|jd|jd�WYd}~dSd}~0tyˆ}z&t|jjd||jd�WYd}~dSd}~00|d|_ n6t |j ƒdkr¾|j dd…}|  |¡ntd|jd�dS) Nrr=ú:rÐrtéþÿÿÿz1No statistics object is current -- cannot reload.r) rrGrÝrLr8r1rKrYr#rÓr4rÔ)r7rÚerrr!r!r"rÔ·s  zProfileBrowser.do_readcCs td|jd�td|jd�dS)Nz+Read in profile data from a specified file.r=z*Without argument, reload the current file.r²r…r!r!r"Ú help_readÈszProfileBrowser.help_readcCs$|jr|j ¡ntd|jd�dS)NrÖr=r)rGr†rLr1râr!r!r"Ú do_reverseÌs zProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.r=r²r…r!r!r"Ú help_reverseÒszProfileBrowser.help_reversecs’|jstd|jd�dS|j ¡‰|rRt‡fdd„| ¡DƒƒrR|jj| ¡Žn.z/Valid sort keys (unique prefixes are accepted):z%s -- %srr) rGrLr1rzÚallr×r‚rrur[)r7rr{rr!rór"Údo_sortÕs zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.r=z3(Typing `sort' without arguments lists valid keys.)r²r…r!r!r"Ú help_sortászProfileBrowser.help_sortcs‡fdd„tjDƒS)Ncsg|]}| ˆ¡r|‘qSr!)rÂ)rÆÚa©Útextr!r"Ú årÊz0ProfileBrowser.complete_sort..)rru)r7rùr8r!rør"Ú complete_sortäszProfileBrowser.complete_sortcCs | d|¡S)Nr¥rárâr!r!r"Údo_statsçszProfileBrowser.do_statscCstd|jd�| ¡dS)Nz.Print statistics from the current stat object.r=rär…r!r!r"Ú help_statsészProfileBrowser.help_statscCs$|jr|j ¡ntd|jd�dS)NrÖr=)rGrŠrLr1râr!r!r"Údo_stripís zProfileBrowser.do_stripcCstd|jd�dS)Nzs^     C