Files
aitsc/.venv/Lib/site-packages/sqlalchemy/testing/__pycache__/profiling.cpython-312.pyc

90 lines
13 KiB
Plaintext
Raw Normal View History

2025-02-23 09:07:52 +08:00
<EFBFBD>
AI<41>g<EFBFBD>(<00><01><><00>dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl
m Z ddl m Z ddl mZ ddlZdZ da d <09>ZGd
<EFBFBD>d <0B>Zdd <0C>Zej,dd <0A><01>Zy#e$rdZY<00>4wxYw)z<>Profiling support for unit and performance tests.
These are special purpose profiling methods which operate
in a more fine-grained way than nose's profiling plugin.
<EFBFBD>)<01> annotationsN<73>)<01>config)<01>
gc_collect<EFBFBD>)<01>has_compiled_extc<01>R<00>|atjrtj<00>yy<00>N)<04> _current_test<73>_profile_stats<74> force_write<74> reset_count)<01>id_s <20>FD:\wxxcx\tsccc\.venv\Lib\site-packages\sqlalchemy/testing/profiling.py<70>_start_current_testr6s!<00><00><17>M<EFBFBD><15>!<21>!<21><16>"<22>"<22>$<24>"<22>c<01>R<00>eZdZdZd d<03>Zed<04><00>Zd<05>Zd<06>Zd<07>Z d<08>Z
d <09>Z d
<EFBFBD>Z d <0B>Z y) <0A>ProfileStatsFilez<65>Store per-platform/fn profiling results in a file.
There was no json module available when this was written, but now
the file format which is very deterministically line oriented is kind of
handy in any case for diffs and merges.
Nc<01>B<00>tjduxrtjj|_|jxs.tjduxrtjj|_t jj|<01>|_ t jj|j<00>d|_ tjd<02><00>|_||_||_|j#<00>|j
r|j%<00>yy)N<><4E><EFBFBD><EFBFBD><EFBFBD>c<01>4<00>tjt<00>Sr
)<03> collections<6E> defaultdict<63>dict<63>rr<00><lambda>z+ProfileStatsFile.__init__.<locals>.<lambda>Qs<00><00>K<EFBFBD>+<2B>+<2B>D<EFBFBD>1r)r<00>options<6E>force_write_profilesr <00>write_profiles<65>write<74>os<6F>path<74>abspath<74>fname<6D>split<69> short_fnamerr<00>data<74>dump<6D>sort<72>_read<61>_write)<04>self<6C>filenamer)r(s r<00>__init__zProfileStatsFile.__init__Gs<><00><00> <12>N<EFBFBD>N<EFBFBD>$<24> &<26> N<>6<EFBFBD>><3E>><3E>+N<>+N<> <0A><18><1A>%<25>%<25>
<EFBFBD> <12>N<EFBFBD>N<EFBFBD>$<24> &<26> H<>6<EFBFBD>><3E>><3E>+H<>+H<> <0A>
<EFBFBD><18>W<EFBFBD>W<EFBFBD>_<EFBFBD>_<EFBFBD>X<EFBFBD>.<2E><04>
<EFBFBD><1D>7<EFBFBD>7<EFBFBD>=<3D>=<3D><14><1A><1A>4<>R<EFBFBD>8<><04><18><1F>+<2B>+<2B> 1<>
<EFBFBD><04> <09><19><04> <09><18><04> <09> <0C>
<EFBFBD>
<EFBFBD> <0C> <0F>:<3A>:<3A> <11>K<EFBFBD>K<EFBFBD>M<EFBFBD> rc<01><><00>tjjdztjjz}tjjdk(rFtjjj tjj <00>r|dz }djtjddD<00>cgc] }t|<02><00><02>c}<02>}tj<00>tj<00>j<00>tj<00>j<00>||g}|j!d<07>t#<00>}|j!|xrdxsd <09>dj|<04>Scc}w)
N<EFBFBD>_<>sqlite<74>_file<6C>.rr<00> dbapiunicode<64> cextensions<6E> nocextensions)r<00>db<64>name<6D>driver<65>dialect<63>_is_url_file_db<64>url<72>join<69>sys<79> version_info<66>str<74>platform<72>machine<6E>system<65>lower<65>python_implementation<6F>appendr)r,<00> dbapi_key<65>v<>
py_version<EFBFBD>platform_tokens<6E> _has_cexts r<00> platform_keyzProfileStatsFile.platform_key[s<00><00><1A>I<EFBFBD>I<EFBFBD>N<EFBFBD>N<EFBFBD>S<EFBFBD>(<28>6<EFBFBD>9<EFBFBD>9<EFBFBD>+;<3B>+;<3B>;<3B> <09> <11>9<EFBFBD>9<EFBFBD>><3E>><3E>X<EFBFBD> %<25>&<26>)<29>)<29>*;<3B>*;<3B>*K<>*K<> <12>I<EFBFBD>I<EFBFBD>M<EFBFBD>M<EFBFBD>+
<EFBFBD> <16><17> <20>I<EFBFBD><19>X<EFBFBD>X<EFBFBD>s<EFBFBD>/?<3F>/?<3F><01>!<21>/D<>E<>/D<>!<21>s<EFBFBD>1<EFBFBD>v<EFBFBD>/D<>E<>F<>
<EFBFBD> <15> <1C> <1C> <1E> <14>O<EFBFBD>O<EFBFBD> <1D> #<23> #<23> %<25> <14> *<2A> *<2A> ,<2C> 2<> 2<> 4<> <16> <15> 
<EFBFBD><0F> <18><1E><1E>~<7E>.<2E>$<24>&<26> <09><17><1E><1E>y<EFBFBD>:<3A>]<5D>M<>o<EFBFBD>N<><12>x<EFBFBD>x<EFBFBD><0F>(<28>(<28><>Fs<00><E3c<01>d<00>t}||jvxr|j|j|vSr
<00>r r'rL)r,<00>test_keys r<00> has_statszProfileStatsFile.has_statsts1<00><00> <20><08> <14><04> <09> <09> !<21> N<>d<EFBFBD>&7<>&7<>4<EFBFBD>9<EFBFBD>9<EFBFBD>X<EFBFBD>;N<>&N<>
rc<01>@<00>t}|j|}||j}d|vrgx|d<}n|d}d|vrdx|d<}n|d}t|<05>|kD}|s0|j |<01>|j
r|j <00>d}n
|d||f}|dxxdz cc<|S)N<>counts<74> current_countr<00>linenor)r r'rL<00>lenrFr r+) r,<00> callcountrO<00>per_fn<66> per_platformrRrS<00> has_count<6E>results rrZzProfileStatsFile.resultzs<><00><00> <20><08><15><19><19>8<EFBFBD>$<24><06><1D>d<EFBFBD>/<2F>/<2F>0<> <0C> <13><<3C> '<27>.0<EFBFBD> 0<>L<EFBFBD><18> "<22>V<EFBFBD>!<21>(<28>+<2B>F<EFBFBD> <1A>,<2C> .<2E><=<3D> =<3D>L<EFBFBD><1F> )<29>M<EFBFBD>(<28><1F>9<>M<EFBFBD><17><06>K<EFBFBD>-<2D>/<2F> <09><18> <12>M<EFBFBD>M<EFBFBD>)<29> $<24><13>z<EFBFBD>z<EFBFBD><14> <0B> <0B> <0A><19>F<EFBFBD>!<21>(<28>+<2B>V<EFBFBD>M<EFBFBD>-B<>B<>F<EFBFBD><14>_<EFBFBD>%<25><11>*<2A>%<25><15> rc<01><><00>t}||jvry|j|}|j|vry||j}d|vr g|dddyy)NrRrN)r,rOrWrXs rrzProfileStatsFile.reset_count<6E>sc<00><00> <20><08> <14>4<EFBFBD>9<EFBFBD>9<EFBFBD> $<24> <12><15><19><19>8<EFBFBD>$<24><06> <0F> <1C> <1C>F<EFBFBD> *<2A> <12><1D>d<EFBFBD>/<2F>/<2F>0<> <0C> <13>|<7C> #<23>(*<2A>L<EFBFBD><18> "<22>1<EFBFBD> %<25> $rc<01><><00>t}|j|}||j}|d}|d}|t|<05>kr |||dz
<n||d<|jr|j <00>yy)NrRrSrr)r r'rLrUr r+)r,rVrOrWrXrRrSs r<00>replacezProfileStatsFile.replace<63>sr<00><00> <20><08><15><19><19>8<EFBFBD>$<24><06><1D>d<EFBFBD>/<2F>/<2F>0<> <0C><1D>h<EFBFBD>'<27><06>$<24>_<EFBFBD>5<> <0A> <18>3<EFBFBD>v<EFBFBD>;<3B> &<26>(1<>F<EFBFBD>=<3D>1<EFBFBD>$<24> %<25>"<22>F<EFBFBD>2<EFBFBD>J<EFBFBD> <0F>:<3A>:<3A> <10>K<EFBFBD>K<EFBFBD>M<EFBFBD> rc<01> <00>d|jzS)Na # %s
# This file is written out on a per-environment basis.
# For each test in aaa_profiling, the corresponding function and
# environment is located within this file. If it doesn't exist,
# the test is skipped.
# If a callcount does exist, it is compared to what we received.
# assertions are raised if the counts do not match.
#
# To add a new callcount test, apply the function_call_count
# decorator and re-run the tests using the --write-profiles
# option - this file will be rewritten including the new count.
#
)r$)r,s r<00>_headerzProfileStatsFile._header<65>s<00><00> <13><12>Z<EFBFBD>Z<EFBFBD>!<19> rc<01><><00> t|j<00>}t|<01>D]<5D>\}}|j <00>}|r|j d<01>r<01>*|j <00>\}}}|j|}||}|j d<02>D<00> cgc] } t| <09><00><02>}
} |
|d<|dz|d<d|d<<00><>|j<00>y#t$rYywxYwcc} w)N<>#<23>,rRrrTrrS)
<EFBFBD>openr$<00>OSError<6F> enumerate<74>strip<69>
startswithr%r'<00>int<6E>close) r,<00> profile_frT<00>linerOrLrRrWrX<00>count<6E>cs rr*zProfileStatsFile._read<61>s<><00><00> <13><1C>T<EFBFBD>Z<EFBFBD>Z<EFBFBD>(<28>I<EFBFBD>&<26>i<EFBFBD>0<>L<EFBFBD>F<EFBFBD>D<EFBFBD><17>:<3A>:<3A><<3C>D<EFBFBD><17>4<EFBFBD>?<3F>?<3F>3<EFBFBD>/<2F><18>-1<>Z<EFBFBD>Z<EFBFBD>\<5C> *<2A>H<EFBFBD>l<EFBFBD>F<EFBFBD><19>Y<EFBFBD>Y<EFBFBD>x<EFBFBD>(<28>F<EFBFBD>!<21>,<2C>/<2F>L<EFBFBD>)/<2F><1C><1C>c<EFBFBD>):<3A>;<3B>):<3A><05><13>U<EFBFBD><1A>):<3A>A<EFBFBD>;<3B>%&<26>L<EFBFBD><18> "<22>%+<2B>a<EFBFBD>Z<EFBFBD>L<EFBFBD><18> "<22>,-<2D>L<EFBFBD><1F> )<29>1<> <12><0F><0F><19><><17> <13> <12> <13><><s<00>C<00>C<06> C <03> C c
<01><><00>td|jz<00>t|jd<02>}|j|j <00><00>t |j <00>D]o}|j |}|jd|z<00>t |<03>D]<}||}djd<05>|dD<00><00>}|j|<02>d|<04>d|<06>d<08><06><00>><00>q|j<00>y) NzWriting profile file %s<>wz
# TEST: %s
rbc3<01>2K<00>|]}t|<01><00><01><00>y<00>wr
)r@)<02>.0rls r<00> <genexpr>z*ProfileStatsFile._write.<locals>.<genexpr><3E>s<00><00><><00>L<>5K<35>E<EFBFBD>S<EFBFBD><15>Z<EFBFBD>5K<35>s<00>rR<00> <20>
) <09>printr$rcr r_<00>sortedr'r=ri)r,rjrOrWrLrXrms rr+zProfileStatsFile._write<74>s<><00><00> <0A>'<27>$<24>*<2A>*<2A>4<>5<><18><14><1A><1A>S<EFBFBD>)<29> <09><11><0F><0F><04> <0C> <0C><0E>'<27><1E>t<EFBFBD>y<EFBFBD>y<EFBFBD>)<29>H<EFBFBD><19>Y<EFBFBD>Y<EFBFBD>x<EFBFBD>(<28>F<EFBFBD> <15>O<EFBFBD>O<EFBFBD>.<2E><18>9<> :<3A> &<26>v<EFBFBD><0E> <0C>%<25>l<EFBFBD>3<> <0C><17>H<EFBFBD>H<EFBFBD>L<>\<5C>(<28>5K<35>L<>L<><01><19><0F><0F><08>,<2C><01> J<>K<>!/<2F>*<2A> <12><0F><0F>r)<02>
cumulativeN)<0E>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r.<00>propertyrLrPrZrr]r_r*r+rrrrr>sC<00><00><08><1A>(<0E>)<29><0E>)<29>0
<EFBFBD> <16>6 +<2B> <1A><19>&<1A>& rrc<01>0<00><00><01><02>ddlm}|<03><01><00>fd<03><08>}|S)a<>Assert a target for a test case's function call count.
The main purpose of this assertion is to detect changes in
callcounts for various functions - the actual number is not as important.
Callcounts are stored in a file keyed to Python version and OS platform
information. This file is generated automatically for new tests,
and versioned so that unexpected changes in callcounts will be detected.
r)<01> decoratorc<01><><00><03>t<00> <09>D]
}||i|<02><01><00> t<00><07>}t<00><08><01>5|D]
}||i|<02><01>}<06> cddd<00>S#1swYyxYw)N)<01>variance)<02>range<67>count_functions)
<EFBFBD>fn<66>args<67>kw<6B>warm<72> timerange<67>time<6D>rv<72>timesr<73><00>warmups
<20><><EFBFBD>r<00>wrapz!function_call_count.<locals>.wrap<61>sU<00><><00><19>&<26>M<EFBFBD>D<EFBFBD> <0E><04>O<EFBFBD><02>O<EFBFBD>"<22><1A>%<25>L<EFBFBD> <09> <1C>h<EFBFBD> /<2F>!<21><04><17><14>_<EFBFBD><12>_<EFBFBD><02>"<22><15>0<> /<2F> /<2F>s <00>A <03> A)<02>sqlalchemy.utilr~)r<>r<>r<>r~r<>s``` r<00>function_call_countr<74><00>s!<00><><00>*<2A><0E><16><0F><16> <10>Krc #<01><>K<00>t<00>tjd<01><00>tj <00>s6tj
s&tj dtjz<00>t<00>tj<00>}|j<00>d<00><01>|j<00>tj|tj<00><03>}|j }tj#|<03>}|<04>d}n|\}}t%d||fz<00>|j&t)j*dtj,<00><00>|j/<00>tj0rtt2j4j7tj0<00>\}}t8j+d<06>d} |<07>d| <09>|xsd <09><01>}
|j;|
<EFBFBD>t%d
|
z<00>tj<rtj?|<03>y|rqtA||z<00>} tC||z
<00>| kD} | rOtj
rtj?|<03>ytEd |<03>d |d z<00>d|<05>dtjF<00>d<10> <09><00>yy<00>w)NzcProfile is not installedz<64>No profiling stats available on this platform for this function. Run tests with --write-profiles to add statistics to %s for this platform.)<01>streamzPstats calls: %d Expected %sz[, ]r3rr0z.profilezDumped stats to file %szAdjusted function call count z not within <20>dz% of expected z , platform z;. Rerun with --write-profiles to regenerate this callcount.)$<24>cProfiler<00>_skip_test_exceptionr rPr <00> skip_testr&r<00>Profile<6C>enable<6C>disable<6C>pstats<74>Statsr><00>stdout<75> total_callsrZru<00>
sort_stats<EFBFBD>rer%r)<00> print_statsr(r!r"<00>splitextr <00>
dump_statsr r]rh<00>abs<62>AssertionErrorrL) r<><00>pr<70>statsrV<00>expected<65>expected_count<6E>line_no<6E>base<73>ext<78> test_name<6D>dumpfile<6C>deviance<63>faileds rr<>r<>s<><00><00><><00><0F><17><14>)<29>)<29>*E<>F<>F<> <19> #<23> #<23> %<25>n<EFBFBD>.B<>.B<><0E><18><18> <1D> .<2E>9<>9<> :<3A>
<EFBFBD><0F>L<EFBFBD> <11> <19> <19> <1B>B<EFBFBD><06>I<EFBFBD>I<EFBFBD>K<EFBFBD> <09><06>J<EFBFBD>J<EFBFBD>L<EFBFBD> <13>L<EFBFBD>L<EFBFBD><12>C<EFBFBD>J<EFBFBD>J<EFBFBD> /<2F>E<EFBFBD><16>!<21>!<21>I<EFBFBD><1D>$<24>$<24>Y<EFBFBD>/<2F>H<EFBFBD><0F><17><1D><0E>"*<2A><1F><07><1E> <09>
(<28>I<EFBFBD>~<7E>+F<>
F<EFBFBD>G<><14>E<EFBFBD><14><14>b<EFBFBD>h<EFBFBD>h<EFBFBD>w<EFBFBD><0E>(;<3B>(;<3B><<3C>=<3D> <09><15><15><17><15><1A><1A><16>G<EFBFBD>G<EFBFBD>$<24>$<24>^<5E>%8<>%8<>9<> <09><04>c<EFBFBD>!<21>'<27>'<27><03>,<2C>R<EFBFBD>0<> <09> $<24>i<EFBFBD><13>1B<31>
<EFBFBD>1B<EFBFBD>C<><08> <0A><18><18><18>"<22> <0A>'<27>(<28>2<>3<><15>!<21>!<21><16><1E><1E>y<EFBFBD>)<29> <17><16>y<EFBFBD>8<EFBFBD>+<2B>,<2C><08><14>Y<EFBFBD><1E>/<2F>0<>8<EFBFBD>;<3B><06> <11><1D>#<23>#<23><1E>&<26>&<26>y<EFBFBD>1<>$<24> "<22>!<21>C<EFBFBD><1E>&<26>&<26>3<>3<> <16> <12> <12> <12>
<18>s<00>I'I))<><E79A99><EFBFBD><EFBFBD><EFBFBD>?rr)r<>)r{<00>
__future__rr<00>
contextlibr!rAr<>r<>r><00>r<00>utilrrr<><00> ImportErrorr r rrr<><00>contextmanagerr<72>rrr<00><module>r<>s<><00><01><04>#<23><12><11> <09><0F> <0A> <09>
<EFBFBD><14><1C>#<23><14><13><16><0E><04><15> <0A><04>%<25>b<1A>b<1A>J<10>> <0C><1A><1A>A<12><1B>A<12><>C<13><14><13>H<EFBFBD><14>s<00>A'<00>'A1<03>0A1