gdZ ddlZddlmZddlZddlZddlZddlZddlm Z ddl m Z ejdZ Gdd e Zy#e$rd\ZZYFwxYw) a/This plugin will run tests using the hotshot profiler, which is part of the standard library. To turn it on, use the ``--with-profile`` option or set the NOSE_WITH_PROFILE environment variable. Profiler output can be controlled with the ``--profile-sort`` and ``--profile-restrict`` options, and the profiler output file may be changed with ``--profile-stats-file``. See the `hotshot documentation`_ in the standard library documentation for more details on the various output options. .. _hotshot documentation: http://docs.python.org/library/hotshot.html N)stats)NN)Plugin)tolistz nose.pluginscXeZdZdZdZdZdZdZeeZdZ dZ dZ d Z d Z d Zy) ProfilezC Use this plugin to run tests using the hotshot profiler. NFc :|jsytj||||jddd|j dddd |jd dd d |j d d|jdddd|j ddy)z&Register commandline options. Nz--profile-sortstore profile_sortNOSE_PROFILE_SORT cumulativeSORTz"Set sort order for profiler output)actiondestdefaultmetavarhelpz--profile-stats-fileprofile_stats_fileFILENOSE_PROFILE_STATS_FILEz;Profiler stats file; default is a new temp file on each run)rrrrrz--profile-restrictappendprofile_restrictRESTRICTNOSE_PROFILE_RESTRICTz?Restrict profiler output. See help for pstats.Stats for details) availableroptions add_optionget)selfparserenvs @/opt/hc_python/lib/python3.12/site-packages/nose/plugins/prof.pyrzProfile.options!s~~ tVS)*7"%''*=|"L"(C  E 03"("%''*C"D 2  3 .x1","%''*A"B 5  6ctduSN)hotshot)clss r!rzProfile.available8s d""r"c|jsy|jtj|j|_y)z5Create profile stats file and load profiler. N)r _create_pfiler%rpfileprofrs r!beginz Profile.begin<s1~~  OODJJ/ r"c:|jsd|_ytj|||||_|j r|j |_d|_nd|_d|_d|_|j|_ t|j|_ y)zConfigure plugin. FNT)renabledr configureconfrr)clean_stats_filefilenor sortrrrestrict)rrr0s r!r/zProfile.configureDs~~ DL w-  % % 33DJ$)D !DJ$(D ! (( w778 r"c~jsytjd|zj|ffd }|S)z6Wrap entire test run in :func:`prof.runcall`. Nzpreparing test %scJj|j||yr$)r(runcall)resultr*testrs r!run_and_profilez,Profile.prepareTest..run_and_profile\s    LLv &r")rlogdebugr*)rr9r:s` r! prepareTestzProfile.prepareTestVs:~~  %,-)- 'r"c\tjd|jjt j |j }|j|jt|d}|r|j}||_ ntj}|t_ |jr:tjd|j|j|jn|j|r||_ y|t_ y#|r||_ w|t_ wxYw)z Output profiler report. zprinting profiler reportstreamz"setting profiler restriction to %sN)r;r<r*closerloadr) sort_statsr3hasattrr?sysstdoutr4 print_stats)rr? prof_stats compat_25tmps r!reportzProfile.reportas ,- ZZ + dii( J1 ##C &J **CCJ !}} > N& && 6&&($' !  $' !  s (ADD+ch|jsy |jj|jrM|j r t j|j  t j|jyy#t$rYewxYw#t$rYr_sc   $g')f) NGU s A AA