bgAzdZgdZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZddlmZddlmZdZd Zd Zd Zd(d Zd)dZ d*dZdZdZdZdZ d+dZ!d,dZ"d,dZ#e$Z%e&Z'dZ(d-dZ)d.dZ*d)dZ+dZ,d/dZ-d0d Z. d1d!Z/d2d"Z0d-d#Z1d3d$Z2d/d%Z3d)d&Z4d4d'Z5e+Z6eZ7dS)5a; Extensions to python's 'inspect' module, which can be used to retrieve information from live python objects. The methods defined in this module are augmented to facilitate access to source code of interactively defined functions and classes, as well as provide access to source code for objects defined in a file. ) findsourcegetsourcelines getsourceindentoutdent_wrap dumpsourcegetname _namespace getimport _importable importable isdynamic isfrommainN) getblockgetfile getmodule getsourcefile indentsize isbuiltinisclassiscodeisframe isfunctionismethodismodule istraceback) TokenError) IS_IPYTHONcBt|}|r |jdkrdSdS)z%check if object was built in __main____main__TF)r__name__)objmodules \/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/dill/source.pyrr#s+ s^^F &/Z//t 5cxt|}n#t$rd}YnwxYw|dkrt|rdSdS)z,check if object was built in the interpreterNTF)r TypeErrorr)r$files r&rr+sJ  !!!Tddd! yZ__t 5s   c  ddlm}ddlm}m}m}d}ddddd\}} t d|d|tt n#t$r| YnwxYw| j ||j c } fd || D s | krd Sd St sd S|| fd  d  dzD rt sd Sfd|| D rt sd S ddkr||| vr|ddddd\} } t d| d| tt n#t$r| YnwxYw| j ||j c } t t| krd Stdt! | D t dkrd Sd St#sd S  d  | | d  t% fdt'dt D t% fdt'dt D krFt) t) krd Sd S)z=check if lambda object 'func' matches raw line of code 'line'r)code)freevars globalvarsvarnamescdS)N __this_is_a_big_dummy_function__r3r'r&z_matchlambda..8s7r'lambda :z : c:g|]}|Sr3count.0ilines r& z _matchlambda..As# 7 7 7A$**Q-- 7 7 7r'TFc:g|]}|Sr3r9r;s r&r?z _matchlambda..Js# - - -A$**Q-- - - -r'rc:g|]}|Sr3r9r;s r&r?z _matchlambda..Ls# 9 9 9A$**Q-- 9 9 9r'c30K|]\}}||k ||fVdS)Nr3)r<r=js r& z_matchlambda..Xs.99%1Q!q&&1&&&&99r'c3rK|]1}tjd|V2dSz([\W\D\S])(.*)Nrematchgroups)r<r=_s r&rDz_matchlambda..bs@ Q QARX'1 . . 5 5 7 7 Q Q Q Q Q Qr'c3rK|]1}tjd|V2dSrFrG)r<r=_fs r&rDz_matchlambda..cs@ T Tabh("Q%007799 T T T T T Tr')detectr-r.r/r0splitevalglobalslocals Exceptionco_codekeysallr:lensetziprdictrangesortedvalues)funcr>getcoder.r/r0dummylhsrhsr-_lhs_rhsrKrMs ` @@r& _matchlambdare4s''''''6666666666 7 7Ejj1%%b)//Q77GC DSSS-wyy B B %aaagajj ''$--"7GAt 7 7 7 7$!4!4!6!6 7 7 7B  99TTu r77 55 $B - - - -Ar!u - - -B '#b'''%% 9 9 9 9D!1!1!6!6!8!8 9 9 9B '#b'''%% 9!!xx~~/B/B/D/D(D(DIIi**2.44S;; T %$$$tt4giiIIBB$$$u"""$'"++%wwt}}'<4 q66SYY  uu 993q;;999 9 9 q66Q;;uut d  )EE ! A DG  B Q Q Q QqQ Q Q QQQA T T T T53r77CSCS T T T T TB BGGIIF188::$6$6&:M:M$M$Mt 5s$ /A;; B  B /H HHc t|}t|}n#t$rd}YnwxYw|o |jdko| }tr |r t|}t |}n#t$rwt |rett|j D]8}t|}| ds'|}t |}YnwxYw|rtj |}ndtjj}d|D}n|r ddld} nQ#t($rDddl} | djd} | jdd d kr| d z } YnwxYw| rt3| } fd t7d| D}n t |s;t t9|rt|}t |}nt|}t |}n5#tt:f$r!t|}t |}YnwxYw|s(|dd|d dzdkrt3d|r|n|}t||}|rtj ||j }ntj |}|st3dt=|r|dfSdx} x} }d}t?|r|j} | dkrd} nd} |j }t|r|j} | dkrd} |}nd} |j!}tE|r|j#}tI|r|j%}tM|rtO|dst3d|j(dk}|rtS|dz }| sd} n |j*dz }d} tWj,| } tWj,|}|dkr||}| -|r_|sng| dkrt]||rnPnD| |vr@d}t7|dz d d D]#}|-||r|dz }#||z }n |dz }|dk||fS t |s#t t9|r|j/}n#t:$rYnwxYwt |r|j} tWj,d| zdz}g}t7tS|dz d d D]a}|-||}|rB||ddkr||fcS|0|1d|fb|r$|2||ddfSt3dt3d)aReturn the entire source file and starting line number for an object. For interactively-defined objects, the 'file' is the interpreter's history. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved, while a TypeError is raised for objects where the source code is unavailable (e.g. builtins).Nr"zs r&r?zfindsource..sBBBTTD[BBBr'rrwinz, please install 'pyreadline'c@g|]}|dzSri)get_history_item)r<r=readlines r&r?zfindsource..s,JJJq**1--d2JJJr'r6z<>zsource code not availablezcould not extract source code^(\s*@)z(.*(?hats_lnumpat candidatesr=rIrps @r&rrisv  F !!!Tddd!KJ!>Kt8N6-n6- 6??D&v..JJ   v %+J8N8N8P8P%Q%QM%,]%;%;N)445FGG! )D!.}!=!=J   C&t,,EEii = OPPGBBW-?-?-A-ABBBEE  - 7 OOOCC 7 7 7 JJJ,,..#(+C|BQB5((66  7  #,, 2244JJJJE!DMMJJJ /6?? 3wtF||'<'< 3v*622 v*622 >* / / /6??D&v..JJJ / 7d2A2hbcc2d::566 6'1zzT64((  -&tV_==EE&t,,E 75666axD4# D! :  &@tt#d&! :  -DCC#d6!v f~~v/00 @>?? ?"i/  Bu::>D N N(1,DADz$ 4(8(8Qhh;Dzz$ #e:%%#C..55t|| %*46"R%8%8((E#zz%,77("'#d{!8DQhhd{ v &74<<#8#8 &%F 44v=j*T1E9:: s5zz!|Br** 7 7AIIeAh''E 78A;#%% !8OOO!!5;;q>>1"5666  = OO   *Q-** *;<< < . / //sW! 00A..A>C/.C/EA F-,F-4A(I/JJ2S99 TTFct|\}}t|r|rt|}|dur|gdgfn|gSt||}t ||d}|r|s|rt|}|dur|g|gfn|gSd}t j|}d} t j| } d} d} g} g} d|}| |krj||| r| s1t || d}n#t$r || g}YnwxYwt|| |kr| t|| z z } n_|d|vrC| || | | z | t|| z z } n| dz } d} n| || rbt || d}n#t$r || g}YnwxYwd} |ddD]}| |sn| dz } | | z } n| dz } d} | |kj| s|g} |g} |r d| D} |dur| | fn| S) aReturn a list of source lines and starting line number for an object. Interactively-defined objects refer to lines in the interpreter's history. If enclosing=True, then also return any enclosing code. If lstrip=True, ensure there is no indentation in the first line of code. If locate=True, then also return the line number for the block of code. DEPRECATED: use 'getsourcelines' instead TrNz#^(\s*def\s)|(.*(?.Gs===U%===r') rrrrrrHrrzrIrrWr)rlstrip enclosinglocaterrrrrrskipr>blocksrtargetr-_lines r& getblocksrsV$$KE4= *8E??5!'4!~~eW<d $ $F U455\ " "E @F@ *8E??5$*dNN$  ? 1D"*T:J:J4 Dbj..t D D F WWU^^F $,, ::eDk " "  8$U455\22TT!7775;-4447%+&&//D D((2774==(( d### TD[)))D D(( DD ZZd $ $  tuu.. 3 3 3uT{mttt 3Dabb  zz%((/%%  DLDD 1HDD7 $,,:  ===f===v$nnFE??&8s$;DD)(D)G00HHcNt|||d\}}|d|dfS)aReturn a list of source lines and starting line number for an object. Interactively-defined objects refer to lines in the interpreter's history. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of the lines corresponding to the object and the line number indicates where in the original source file the first line of code was found. An IOError is raised if the source code cannot be retrieved, while a TypeError is raised for objects where the source code is unavailable (e.g. builtins). If lstrip=True, ensure there is no indentation in the first line of code. If enclosing=True, then also return any enclosing code.T)rrrr6)r)rrrr-ns r&rrLs0v4PPPGD! 8QrU?r'rkc t|}t|} t||\}} n#ttf$r|st |sV|st |||cYSt ||} t|d} |rd|znd} || krd} | | zd| zzcYS|st |||cYS|jj } |j } | dvrt |||cYS| d | d | d | d gd } }t|d  | dz}t||\}} YnwxYw|s|rt|}|rfdt|vr|d|zn.sCCC49CCCr'Nr6@rzdef r5=)_hascode _isinstancerr*rrr r rr# __module__rPrrreprrrrOrwstriprz)rrrrrrhascodeinstancerr_importr_aliasr%r$rr>s r&rr^s$vG6""HG$VyAAA tt w GGG     G MIfeW$M$M$MMMM888G6...D(-5Wu__2F}}rf6>&4-/ / / / MIfeW$M$M$MMMM#,D&F333 @@@@@@PTPTPTU[U[U[\`\`\`aeaeaefgijt58??4%<8899,SIFFF ttt+G0  L $v,,   Vf_ = = = = vRUEJJJECCT1B1BCCCCRCH!4E @  @D  s++2UU T{!!##..v66 KFO++LLL%%%!IJJJeDk))E$K--c2215;;====/4uueDkk"BE$KFO++LLL%%%!IJJJ @E"IOOC00399;;;;!(5E"I =E"IvT222EfoD==LLL%%%!>??? 775>>s(67E/>E/E)E0AEEcFt|ddpt|ddS)z9True if object has an attribute that stores it's __code__rN func_code)getattrrs r&rrs% 6*T * * Ngf[.N.NNr'ct|st|st|rdSt|st |st |rdSt |s%t t|jdvrdSd}tt| |sdSt |r|j dvst|ddvrdSdS)z>True if object is a class instance type (and is not a builtin)F)numpyT)zrr)array) rrrrrrrrr#rrwrr )r_typess r&rrs76??hv.>.>u6gfoou V  4<.funcss B q,,,k: F F F F B B B3aj@AA A B$$s *."A)r#__doc__)rr^s` r&rrs5     JDM9DL Kr'c d}d}d|z}|tt||ddz }|td|zz }|r|d|zz }||d|d z }|S) z|t |jdd d z }t|j} ||d |d | d zz }|rad} t| |} | d} | ddzt|zd | ddz}|S)a/'dump to source', where the code includes a pickled object. If new=True and object is a class instance, then create a new instance using the unpacked class source code. If enclose, then create the object inside a function enclosure (thus minimizing any global namespace pollution). r)dumpsz import dill rrFzdill.loads(%s) rkTrz dill.loads(z .replace(bz,bytes(__name__,"UTF-8"))) __this_is_a_big_dummy_object__rrgN) dillrrrrrrrrOrrz) rrrrrpikr-rpremodr`s r&rr3sQ uuV}}  C D1,n %0gnn5 Zk&))Z (3... &*"TNNNN6$%% QTQTQTUXUXUXYYYD0e,,, D!!Qx}vd||+diibcc .C.CC Kr'c|r"dt|St|}|s|sdSt|S |j}|dkr;t |dddS|jdvr|dkrd }|S#t$r1|sYdSt|}| d rYdS|cYSwxYw) zEget the name of the object. for lambdas, get the name of the pointer .Nrrrrrrrr<) rzr rrr#rrOrrrw)r$rfqnr%rs r&r r Zs ,388JsOO,, , s^^F !TTCyy| :  S>>''A..q17799 9 ?8 8 8z!!.4 !TTTCyy ??3   44 s% AB%B%% C 4$C C C cL tt|ddddx}}|d}t |r|St |p|j}|dvrt|rdg|gzS||gzS#t$rYnwxYwt|dvrd gt|gzSt|j d d }t|j }|| ddzd }n#t$rYnwxYw|d}|dvr.|d dkrd|d <t|d rd}|g|z}|S)a_namespace(obj); return namespace hierarchy (as a list of names) for the given object. For an instance, find the class hierarchy. For example: >>> from functools import partial >>> p = partial(int, base=2) >>> _namespace(p) ['functools', 'partial'] r>"'rrr)infnanInfNaNrrNr6rr) rrrOrrr r#rrSrrindex ValueError)r$r%qualrs r&r r ss IcNN++1133A6<> '44 (-5Wu__2F}}rf&4-' ' 4 d*4(,dd3$#( 2Z%  dF }}tfFND>doog..> $ZZZZ > > >KKA&&q)E %}}!%uf==  > Ks.B>>ADDc|rddlm}||}|r|n|}t|}d|dd}|d} t |dddddd} d} nL#t $r?|dvrt |} n(t |d d } YnwxYw| rMt|| |||S#t$rYn.t$r"|dvr|rd |znd } || krd } | d | zzcYSYnwxYw t|| |||S#t$rt$r!|dvr|rd |znd } || krd } | d | zzcYSwxYw)alget the likely import string for the given object obj is the object to inspect If verify=True, then test the import string before returning it. If builtin=True, then force an import for builtins where possible. If enclosing=True, get the import for the outermost enclosing callable. If alias is provided, then rename the object on import. r) outermostrNr6rrrrrrrkr) rNrr rzrrOrSrr SyntaxError) r$rrrrr_objrrrrrs r&r r s$%%%%%%y~~#dd c??D 88D"I  D 8D+Cyys1%%a(..s155a8 +++ - - -99DD99??3''*D + tT5&'BB B   DD   111,195rD==2&ftm++++$   $eVW===   - - -(-5Wu__2F}}rf&4-' ' ' ' s>ABACC#C66 D-&D-,D-1E1E97E9cz|t|rdnd}|r& t||||||S#t$rYnwxYw t|st |||| |St ||| |}t |d}|st d|rd|znd } ||krd } || zd |zzS#t$rYnwxYw|s& t||||||S#t$rYnwxYwt ||}|r|d rt d|rd|znd } ||krd } | d |zzS) a\get an import string (or the source code) for the given object This function will attempt to discover the name of the object, or the repr of the object, or the source code for the object. To attempt to force discovery of the source code, use source=True, to attempt to force the use of an import, use source=False; otherwise an import will be sought for objects not defined in __main__. The intent is to build a string that can be imported from a python file. obj is the object to inspect. If alias is provided, then rename the object with the given alias. If source=True, use these options: If enclosing=True, then also return any enclosing code. If force=True, catch (TypeError,IOError) and try to use import hooks. If lstrip=True, ensure there is no indentation in the first line of code. If source=False, use these options: If enclosing=True, get the import for the outermost enclosing callable. If force=True, then don't test the import string before returning it. If builtin=True, then force an import for builtins where possible. NTF)rrrr)rrrrz!object has no atribute '__name__'rrkrr)rrrSrr r rrw) r$rsourcerrrrrrrs r&r r s,~#C3e  S%9#(JJJ J$$3 GS%9.3)gGGG GC9-2WFFFs$''' F !DEE E$)15r D==2&v~ftm++ dd  S%9#(JJJ J$$ #U # # #C B#..%%B@AAA % -Wu__2F ||bV &3, s6. ;;#B5#AB55 CCC C*)C*c ddlddlm}m}||}i}t |D]\}t |s|t}| drt||}n-|| dt zdztztt } t \} } fd | D} | s>tt} t\} } fd | D} t| st!d | d } | d ddd t'| ||}||<|s||tt} | r|ur$t|dt|||}nt\} } fd| D} t| st!d | d } | d ddd t'| ||}||<|S)zEget import for closured objects; return a dict of 'name' and 'import'rNr)r.rrrr .*[\w\s]=\s*\(cXg|]&}t|vj|$|'Sr3r rI)r<r>enclrrHs r&r?z#_closuredimport..TsF...$74==D3H3H!#t,,4I3H3H3Hr'cXg|]&}t|vj|$|'Sr3r&)r<r>fobjrrHs r&r?z#_closuredimport..ZsIOOOd '  5 5("(3:M:M 5" 5 5 5r'zimport could not be foundr6rTrc~g|]9}t|vjdtzdz|7|:S)r#r$r&)r<r>rrHs r&r?z#_closuredimport..jsYNNN$74==D3H3H!/'$--"?"EtLL4I3H3H3Hr')rHrNr.rlistitemsrpoprrrwr r rrrWr*rOrr)r^rrr.r free_vars func_varsr$srcrrrK candidater'r)rrrHs @@@@@r&_closuredimportr2?sC III++++++++II**++S#(}}T""oo ::<< " "3 ' ' FDw???CC9T??D!'$--/5gdmmCC)D//**C &&GE!......%...I Oioo..$T**aOOOOOOeOOO y>> O3N)O)O#O!" I??3q))!,2244R8>>@@DS$eWEEEC $ yioo&& Fddll4t,,,DDw???CC &&GE!NNNNN%NNNIy>> O3N)O)O#O!" I??3q))!,2244R8>>@@DS$eWEEEC $ r'cddlm}||}i}t|D]\}}t |st |d|||<*||}t ||}|ds)t||}t ||dd} || f}n(t |dd} t||d }| |f}|||<d | }|st ||ddd } || f}n|d f}||d <|S) zSget source code for closured objects; return a dict of 'name' and 'code blocks'r)r.T)rrrrF)rr)r rk)rrrN) rNr.r+r,rrr-rrwr rzr]) r^rr.r.r/rr$r)r0orgs r&_closuredsourcer5ts!     II**++S# '4tDDDIdO }}T""e$$zz||&&s++ T---CD%5FFFC*CCDD???CT5666C*C $ '')""$$ % %C e45NNNCjDkIdO r'ct|t|rdnd}n|rt|rd}dx}} |s t|rt||d|St |||}t |dkrt dt |dkrt dt|dS#t$r|rd}YnwxYw t|| }t |dkrt dd }|| d}|r|gng}|D]$} || } | r| | %t |sd }n1t |dkr |d}nd |}dd lm} | |}td|D}|rd |nd }|s|S|s|S||zS#t$r |rd}| }YnwxYw )aget an importable string (i.e. source code or the import string) for the given object, including any required objects from the enclosing and global scope This function will attempt to discover the name of the object, or the repr of the object, or the source code for the object. To attempt to force discovery of the source code, use source=True, to attempt to force the use of an import, use source=False; otherwise an import will be sought for objects not defined in __main__. The intent is to build a string that can be imported from a python file. obj is the object to inspect. If alias is provided, then rename the object with the given alias. If builtin=True, then force an import for builtins where possible. NTFr rr"rznot implementedrrc|dr|drd|}n$|dr |d}n|dr |d}nd}|S)z,stitch together the strings in tuple 'block'rr6rgrk)rz)rs r&_code_stitcherz"importable.._code_stitchersa8!b !499U3C3C551X!uQxuu2Y!b  e r'rkrg)r/c3^K|](\}}t|t||dV)dS)TrN)rr)r<rrs r&rDzimportable..sDmm;D]fgk]l]lmyd666mmmmmmr')rrrr r2rWNotImplementedErrorr+r]rSr5r-rrzrNr/r,) r$rr r tried_source tried_importr0r9_srcxxxr/s r&r r s$~#C3e Ys^^"''L<5  $ $s##R&sE%QQQQ%cHHHs88q==-.?@@@s88a<<-.?@@@CJJLL))!,, $ $ $&#  $& !#U333C3xx1}})*;<<<   ">#''$--00D!)D66rDzz|| ) )$nS))( C(((t99 &Ta1giioo * * * * * **S//Cmm#))++mmmmmC$'/$))C...RC "s  "s 9     "ULZFFF e5 s7!CArQs] B B B ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 222jY0Y0Y0xD9D9D9D9N$9>CHYYYYxOOO(555,,, <    IIIIgii VXX        $$$$N2'''V++++`0000fDHCG::::|2222j%%%%NN N N N dFFFFBBBBKKKK  "r'