U e5d;@sddlZddlZddlZddlZddlmZmZmZddddgZ iZ GdddZ Gd dde Z Gd dde Z d d Zdd dZdddZdddZdddZddZddZddZddZedkredS) N)NAMEDEDENTOP readmodule readmodule_exClassFunctionc@seZdZddZddZdS)_ObjectcCs(||_||_||_||_||_i|_dSN)modulenamefilelinenoparentchildrenselfr r r rrr/usr/lib64/python3.8/pyclbr.py__init__6s z_Object.__init__cCs||j|<dSr )r)rr objrrr _addchild>sz_Object._addchildN)__name__ __module__ __qualname__rrrrrrr 4sr c@seZdZdddZdS)rNcCst||||||dSr )r rrrrrrDszFunction.__init__)N)rrrrrrrrrBscs&eZdZdfdd ZddZZS)rNcs0t|||||||dkr gn||_i|_dSr )r rsupermethods)rr r rr rr __class__rrrJszClass.__init__cCs||j|<dSr )r)rr rrrr _addmethodOszClass._addmethod)N)rrrrr __classcell__rrrrrHscCs:t|j||j||}|||t|tr6||||Sr )rr r r isinstancerr)ob func_namerZnewfuncrrr_nest_functionSs    r$cCs&t|j|||j||}||||Sr )rr r r)r" class_namerrZnewclassrrr _nest_class[s r&cCs6i}t||pgD]\}}t|tr|||<q|Sr ) _readmoduleitemsr!r)r pathreskeyvaluerrrras   cCst||p gSr )r')r r)rrrrmsc Cs|dk rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|d}|dkr|d|}||dd}t|||}|dk rd||f}d|krtd|t||d|Sd} |dk r|} n |tj} tj || } | dkrt d||d|t|<| j dk r$| j |d<z| j |} Wnttfk rR|YSX| dkrb|S| j |} t||| | ||S) Nz%s.%s.r__path__zNo package named {}zno module named )r )_modulessysbuiltin_module_namesrfindr' ImportErrorformatr) importlibutil_find_spec_from_pathModuleNotFoundErrorsubmodule_search_locationsloader get_sourceAttributeError get_filename _create_tree)r r) inpackage fullmoduletreeipackageZ submodulerfZ search_pathspecsourcefnamerrrr'vsJ            r'c! CsHt|}g}t|j}z|D]\} } } } } | tkr`| \}}|r^|dd|kr^|d=qBq"| dkr| \}}|r|dd|kr|d=qpt|dd\} }} | tkrq"d}|r|dd}t|||}nt ||||}|||<| ||fq"| dkr| \}}|r(|dd|kr(|d=qt|dd\} }} | tkrJq"t|dd\} } } d}| dkrg}d}g}t|dd\} } } | dkr|dkrd |}||kr||}nL| d }t |dkr|d }|d}|tkrt|}||kr||}| |g}| dkr0|d7}nZ| d krR|d8}|dkrqn8| d krh|dkrhn"| ttfkrz|dkrz| | qz|}|r|dd}t||||}nt|||||}|||<| ||fq"| dkrh| ddkrht|}|D]d\}}zL|dkr t||n2zt|||Wn tk rPt|gYnXWn YnXqq"| dkr"| ddkr"t|\}} |r"| dkrq"t|}zt|||}WnYq"YnX|D]X\}} ||kr|||| p|<n0|dkr|D] }|ddkr||||<qqq"Wntk r:YnX||S)Nr.defrclass()),r-rNrOimportfrom*_)ioStringIOtokenizegenerate_tokensreadlinernextrr$rappendjoinsplitlenr0rr&r _getnamelistr'r4_getname StopIterationclose)!rAr)rHrGrBr@rEstackg tokentypetokenstartZ_end_linerZ thisindentr#Zcur_funcZcur_objr%ZinheritnameslevelrncmdZ cur_classmodulesmodZ_mod2Zn2rrrr?s                             r?cCslg}t|\}}|sqh|dkr,t|\}}nd}|||f|dkr\d|kr\t|d}q>|dkrqhq|S)NasrO r.)rar\r[)rerjr rgZname2rrrr`Es r`cCsg}t|dd\}}|tkr0|dkr0d|fS||t|dd\}}|dkrXqt|dd\}}|tkrvq||q:d||fS)NrrTr-)r[rr\r])repartsrfrgrrrra[s  rac CsXddl}ztjd}Wnt}YnX|j|rj|j|g}|j|}| drn|dd}ng}t ||}dd}t | |dd}d }|rT| }t|trqt|d sd|_t|trt |j |dd}|D]} |j|| _q||t|tr,td d |j|j|j|jqt|trtd d |j|j|jqdS)Nrr.z.pycSs t|ddS)Nrr)getattr)arrr|z_main..T)r+reversertindentz{}class {} {} {} z {}def {} {})osr1argv__file__r)existsdirnamebasenamelowerendswithrsortedvaluespopr!listhasattrr|r rextendrprintr5r rrr) r~rqr)rBZ lineno_keyZobjsZ indent_levelrZnew_objsr"rrr_mainmsL           r__main__)N)N)N)N)rVr1importlib.utilr6rXrgrrr__all__r0r rrr$r&rrr'r?r`rarrrrrr)s*    @&