B /g^!;@sddlZddlZddlZddlZddlmZmZmZddddgZ iZ GdddZ Gd dde Z Gd dde Z d d Zdd dZdddZdddZdddZddZddZddZddZedkredS) N)NAMEDEDENTOP readmodule readmodule_exClassFunctionc@seZdZddZddZdS)_ObjectcCs(||_||_||_||_||_i|_dS)N)modulenamefilelinenoparentchildren)selfr r r r rr/usr/lib64/python3.7/pyclbr.py__init__6s z_Object.__init__cCs||j|<dS)N)r)rr objrrr _addchild>sz_Object._addchildN)__name__ __module__ __qualname__rrrrrrr 4sr c@seZdZdddZdS)rNcCst||||||dS)N)r r)rr r r r rrrrrDszFunction.__init__)N)rrrrrrrrrBscs&eZdZdfdd ZddZZS)rNcs0t|||||||dkr gn||_i|_dS)N)r rsupermethods)rr r rr r r) __class__rrrJszClass.__init__cCs||j|<dS)N)r)rr r rrr _addmethodOszClass._addmethod)N)rrrrr __classcell__rr)rrrHscCs:t|j||j||}|||t|tr6||||S)N)rr r r isinstancerr)ob func_namer Znewfuncrrr_nest_functionSs    r!cCs&t|j|||j||}||||S)N)rr r r)r class_namer rZnewclassrrr _nest_class[s r#cCs:i}x0t||pgD]\}}t|tr|||<qW|S)N) _readmoduleitemsrr)r pathZreskeyvaluerrrras   cCst||p gS)N)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 || } |t|<| j dk r| j |d<y| j |} | dkr$|SWnttfk r@|SX| j |} t||| | ||S)Nz%s.%s.r__path__zNo package named {})_modulessysbuiltin_module_namesrfindr$ ImportErrorformatr& importlibutil_find_spec_from_pathsubmodule_search_locationsloader get_sourceAttributeError get_filename _create_tree)r r& inpackage fullmoduletreeipackageZ submodulerfZ search_pathspecsourcefnamerrrr$vsF           r$c! Csjt|}g}t|j}y*x"|D]\} } } } } | tkrh| \}}x|rd|dd|krd|d=qHWq&| dkr| \}}x|r|dd|kr|d=q|Wt|dd\} }} | tkrq&d}|r|dd}t|||}nt ||||}|||<| ||fq&| dkr| \}}x$|r8|dd|kr8|d=qWt|dd\} }} | tkr\q&t|dd\} } } d}| dkrg}d}g}xt|dd\} } } | dkr2|dkr2d |}||kr||}nL| d }t |dkr$|d }|d}|tkr$t|}||kr$||}| |g}| dkrF|d7}nX| d krf|d8}|dkrPn8| d kr||dkr|n"| ttfkr|dkr| | qW|}|r|dd}t||||}nt|||||}|||<| ||fq&| dkr| ddkrt|}xl|D]d\}}yL|dkr8t||n2yt|||Wn tk rht|gYnXWn YnXqWq&| dkr&| ddkr&t|\}} |r&| dkrq&t|}yt|||}Wnw&YnXxd|D]\\}} ||kr|||| p|<n4|dkrx(|D] }|ddkr||||<qWqWq&WWntk r\YnX||S)Nr*defrclass()),r)rIrJimportfrom*_)ioStringIOtokenizegenerate_tokensreadlinernextrr!rappendjoinsplitlenr,rr#r _getnamelistr$r0_getname StopIterationclose)!r<r&rCrBr=r;r@stackg tokentypetokenstartZ_end_liner Z thisindentr Zcur_funcZcur_objr"ZinheritnameslevelrncmdZ cur_classmodulesmodZ_mod2Zn2rrrr:s                             r:cCstg}xjt|\}}|sP|dkr.t|\}}nd}|||fx |dkr`d|kr`t|d}qBW|dkrPqW|S)NasrJ r*)r\rWrV)r`rer rbZname2rrrr[Bs r[cCsg}t|dd\}}|tkr0|dkr0d|fS||xJt|dd\}}|dkrZPt|dd\}}|tkrxP||qyz_main..T)r'reverseroindentz{}class {} {} {} z {}def {} {})osr-argv__file__r&existsdirnamebasenamelowerendswithrsortedvaluespoprlisthasattrrwr rextendrprintr1r rr r) ryrlr&r=Z lineno_keyZobjsZ indent_levelrZnew_objsrrrr_mainjs@             r__main__)N)N)N)N)rQr-importlib.utilr2rSrbrrr__all__r,r rrr!r#rrr$r:r[r\rrrrrr)s*    =&