/usr/local/lib/python3.6/site-packages/dill/__pycache__
NameSizeModeActions
detect.cpython-36.pyc86530644editdlrm
info.cpython-36.pyc104980644editdlrm
objtypes.cpython-36.pyc5050644editdlrm
pointers.cpython-36.pyc34060644editdlrm
settings.cpython-36.pyc3970644editdlrm
source.cpython-36.pyc267190644editdlrm
temp.cpython-36.pyc73020644editdlrm
_dill.cpython-36.pyc423680644editdlrm
_objects.cpython-36.pyc141340644editdlrm
__diff.cpython-36.pyc58540644editdlrm
__init__.cpython-36.pyc35310644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/dill/__pycache__/source.cpython-36.pyc (26719B)
3 8%Egj@sdZddddddddd d d d d dgZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZddlmZddlmZddZdd ZddZddZdFddZdGddZdHddZd d!Zd"d#Zd$d%Zd&d'Z dId)dZ!dJd+d,Z"dKd-dZ#e$Z%e&Z'd.dLZ(d1dMZ)er0e*e)ne*e([([)dNd2d3Z+dOd4dZ,dPd5dZ-d6d Z.dQd7d8Z/dRd9d Z0dSd:d Z1dTd;d<Z2dUd=d>Z3dVd?d Z4dWd@dAZ5dXdBdCZ6dYdDdEZ7e-Z8eZ9dS)Za< 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)PY3cCst|}|r|jdkrdSdS)z%check if object was built in __main____main__TF)r__name__)objmoduler$5/usr/local/lib/python3.6/site-packages/dill/source.pyr#sc Cs>y t|}Wntk r$d}YnX|dkr:t|r:dSdS)z,check if object was built in the interpreterNzTF)r TypeErrorr)r"filer$r$r%r +s  c sddlm}ddlm}m}m}dd}jdddjdd\}}ytd||fttWn|YnX|j ||j } fd d ||j Ds| krd Sd St sd S||fd d ddDot  rd Sfdd ||j Dr,t  r,d Sj ddkr|||j kr|jdddjdd\} } ytd| | fttWn|YnX|j ||j } t t | krd Stddt| Dt dkrd Sd Stsd Sjd| j| dtfddtdt Dtfddtdt Dj j krtjtjkrd Sd S)z=check if lambda object 'func' matches raw line of code 'line'r)code)freevars globalvarsvarnamescSsdS)NZ __this_is_a_big_dummy_function__r$r$r$r$r%8sz_matchlambda..zlambda :zlambda %s : %scsg|]}j|qSr$)count).0i)liner$r% Asz _matchlambda..TFcsg|]}j|qSr$)r.)r/r0)r1r$r%r2Jsrcsg|]}j|qSr$)r.)r/r0)r1r$r%r2Lscss"|]\}}||kr||fVqdS)Nr$)r/r0jr$r$r% Xsz_matchlambda..c3s"|]}tjd|jVqdS)z([\W\D\S])(.*)N)rematchgroups)r/r0)_r$r%r4bsc3s"|]}tjd|jVqdS)z([\W\D\S])(.*)N)r5r6r7)r/r0)_fr$r%r4csr:)detectr(r)r*r+splitevalglobalslocalsco_codekeysallr.lensetziprdictrangesortedvalues) funcr1getcoder)r*r+dummylhsrhsr(Z_lhsZ_rhsr$)r8r9r1r% _matchlambda4sZ  "    ,rOcsZt|}y t|}Wntk r,d}YnX|r|jdkr| ryddld}Wn@ddl}|jdjd}|jdddkr|d7}YnX|rt |j }fd d t d|D}ny.z<>zsource code not availablezcould not extract source codez^(\s*@)zz(.*(?z+^(\s*def\s)|(.*(?.) rrryrrr5rijoinr6rrCrk)rnlstrip enclosinglocaterprurrzrrrsskipr1blocksrvtargetr(_liner$r$r% getblockssl         rcCs$t|||dd\}}|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)r|r}r~rr:r:)r)rnr|r}r(nr$r$r%r8s rPcCst|}t|}yt||d\}} Wnttfk r|sBt|s|s\t|||dSt||d} t|dd} |rd|nd} || krd} | | d| S|st|||dS|jj } |j } | dkrt|||dSd | | | | fgd }} t |d j | d }t||d\}} YnX|s&|r.t |}|rd t|krR|jd|n2t|d|dd}dd|jdDddd }} |r|rRd }x$|D]}|jdsP|d7}qW||j jdr||j krP|jd||j fn`d||kr0|||jdd jkrPd|||f||<n ||j kr|jd||j fnh|r||djdd jkrd||d|d <n0t|ddp|j } || kr|jd|| fdj|S)!a+Return the text of the source code for an object. The source code for interactively-defined objects are extracted from 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 single string. 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 alias is provided, then add a line of code that renames the object. If lstrip=True, ensure there is no indentation in the first line of code. If enclosing=True, then also return any enclosing code. If force=True, catch (TypeError,IOError) and try to use import hooks. If builtin=True, force an import for any builtins )r})builtinT)forcez%s = rPz%s builtins __builtin__z*%s = __import__('%s', fromlist=['%s']).%s rz = (z%r F)aliasnewenclosecSsg|] }|dqS)rSr$)r/r1r$r$r%r2szgetsource..rSNr@zdef z %s = %s zlambda =z%s = %s)rrr:r:r:r:)_hascode _isinstancerr&r[rr rrjr! __module__r=r|ryreprrkrr< startswithstripr{)rnrr|r}rrZhascodeinstancerpru_importrq_aliasr#r"rr1r$r$r%rJsl   "     cCst|ddpt|ddS)z9True if object has an attribute that stores it's __code__rcNrd)getattr)rnr$r$r%rsrcCst|st|st|rdSt|s4t|s4t|r8dSt| rXtt|jd krXdSd }t t|j |srdSt| s|j d kst |ddd krdSdS)z>True if object is a class instance type (and is not a builtin)FnumpyTrr)rarray)r)rr)rr)r) rrrrrrrr]r!rrrr)rn_typesr$r$r%rs$rcCsBddl}t|tdk r$t|dd}|dkr0d}t||r>dSdS) z(check if object is in the 'types' modulerNrPT)rellipsis EllipsisTypeF)typesr]rrg)rnrr$r$r%_intypess  rcCstrt|ttfSt|tS)z%check if object is a string-like type)r isinstancestrbytes basestring)rnr$r$r% _isstringsrcCst|}t|tkrd|}t|}|jd}x:tt|D]*}t||}||krVq<|||||<qW|S)zAoutdent lines of code, accounting for docs and line continuationsrNr)rrGrC)rprrBrr0rZ_spacesr$r$r%rys  rycCsNt|}|dks ||ks |dkr$|}|s4||dSdjt|jd||dS)zDoutdent a block of code (default is to strip all leading whitespace)NrrS)rrB)rr{ryr<)r(rrBrr$r$r%rs  a def _wrap(f): """ encapsulate a function and it's __import__ """ def func(*args, **kwds): try: # _ = eval(getsource(f, force=True)) #XXX: safer but less robust exec getimportable(f, alias='_') in %s, %s except: raise ImportError('cannot import name ' + f.__name__) return _(*args, **kwds) func.__name__ = f.__name__ func.__doc__ = f.__doc__ return func __globals__ __locals__a def _wrap(f): """ encapsulate a function and it's __import__ """ def func(*args, **kwds): try: # _ = eval(getsource(f, force=True)) #XXX: safer but less robust exec(getimportable(f, alias='_'), %s, %s) except: raise ImportError('cannot import name ' + f.__name__) return _(*args, **kwds) func.__name__ = f.__name__ func.__doc__ = f.__doc__ return func cCs\d}d}d|}|tt||ddd7}|td|7}|rH|d|7}|d||f7}|S) zrrrrrrr<)rr) r{r rrr!rr<rr^r)r"rZfqnr#rqr$r$r%r`s,  cCs*yntt|jdjdjd}}|jd}t|r<|St|pH|j}|dkrft|rfdg|gS||gSYnXt|dkrd gt|gSt|j d d}t|j }y||j ddd}Wnt k rYnX|jd}|dkr&|ddkr d|d<t|drd}|g|}|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"'rrrrinfnanInfNaNrrNrr)rr)rrrr)rrr:r:r:) rrr<rrrr!rrrjindex ValueError)r"r#qualrqr$r$r%r ys8 $        c CsF|dkr|dkrtj}n8|dkrP|dkrP|r4d|nd}||krDd}|d|S|dkr|d krdd }t|rrd}n,|s|rd|nd}||krd}|d|S|sd |}n d ||f}|rd|nd}||krd}||7}|o|jd rBy t|WnFtk r@|jddd}|s$||krYnNtk r|dkr|rfd |nd } || krxd } | d | SYnXdS)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) outermostrNr>rrrrz%s = rPz%s r:r:)rr)rr)rr) r;rr r{rr<rr SyntaxError) r"rrrr}r_objrrrrqrr$r$r%r sJ           c Cs8|dkrt|rdnd}|r>yt||||||dSYnXyrt|s\t|||| |dSt||| |d}t|dd}|std|rd|nd } ||krd } || d |SYnX|syt||||||dSYnXt||d}| s|jd r td|rd|nd } ||kr,d } | d |S) 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)r}rr|r)r}rr)rz!object has no atribute '__name__'z%s = rPz%s r)rrrr rr^r) r"rsourcer}rrr|rrqrr$r$r%r sH       c sddlddlm}m}||}i}x"t|jD]\}t|sHq4|jt}|j j drxt ||d}n||dt dt t t } t\} } fd d | D} | st t } t\} } fd d | D} t| s td | d} | jd ddjdjt| ||d}||<q4W|s||t t } | sv|krt |ddt |||d}nft\} } fdd | D} t| std | d} | jd ddjdjt| ||d}||<|S)zEget import for closured objects; return a dict of 'name' and 'import'rNr)r)rr)rrz .*[\w\s]=\s*z\(cs(g|] }t|krj|r|qSr$)rr6)r/r1)enclrwr5r$r%r2Zsz#_closuredimport..cs(g|] }t|krj|r|qSr$)rr6)r/r1)fobjrwr5r$r%r2`szimport could not be foundrT)rcs4g|],}t|krjdtd|r|qS)z .*[\w\s]=\s*z\()rr6)r/r1)rqr5r$r%r2psr:r:r:r:)r5r;r)rlistitemsrpoprr|rr rrrrCr&r<rr) rJrrr)r free_vars func_varsr"srcrrpr8 candidater$)rrrqrwr5r%_closuredimportEsR           rc Csddlm}||}i}xt|jD]\}}t|sJt|d|d||<q&|j|}t||}|jjdst ||d}t||ddd} || f}n$t|ddd} t ||dd }| |f}|||<q&Wd j |j }|st||dddd } || f}n|d f}||d <|S) zSget source code for closured objects; return a dict of 'name' and 'code blocks'r)r)T)rrr)rF)r}r|)rrP)rr}r|N) r;r)rrrrrr|rr r{rI) rJrr)rrrqr"rrorgr$r$r%_closuredsourcezs0       rc Cs|dkrt|rdnd}n|r*t|r*d}d}}x|sy^t|rTt||d|dSt|||d}t|dkrvtdt|dkrtdt|jdS|rd}YnXyt ||d }t|dkrtdd d }||j d}|r|gng}x*|jD]} || } | r|j | qWt|s4d }n"t|dkrL|d}n d j |}ddl m} | |}tdd|jD}|rd j |nd }|s|S|s|S||S|rd}| }Yq6Xq6WdS)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. NTF)rr)rrrznot implementedr)rcSsH|dr|drdj|}n(|dr.|d}n|dr@|d}nd}|S)z,stitch together the strings in tuple 'block'rrrSrPr:r:r:)r{)rzr$r$r%_code_stitchers   z"importable.._code_stitcherrPrS)r*css(|] \}}t|st||ddVqdS)T)rN)rr)r/rqrr$r$r%r4szimportable..)rrrr rrCNotImplementedErrorrrIrrrkr{r;r*r) r"rrrZ tried_sourceZ tried_importrrZ_srcZxxxr*r$r$r%r sf          cCst||| |dS)N)rr)r )r"rZbynameexplicitr$r$r% getimportablesrcCst|| |dS)N)rr)r )r"passiverr$r$r% likely_importsrcCst||| |dS)N)rr)r)firstlastrrr$r$r%_likely_importsr)FFF)FF)rPFFFF)r)NT)NT)rr)rr)rP)rPFT)FF)rPTF)rPTFF)rPNFTTT)rPF)rP)rPNT)rPTF)FF)FT):__doc____all__r_r5inspectrrrrrrrrrrrrrtokenizerZ_dillrrr rOrrrrrrrrrryrr>rr?rZwrap2Zwrap3rrrrr rr r rrr rrrZ _get_nameZgetblocks_from_historyr$r$r$r%s`   <   5 G  [      * + 0 3 = 5 ' R