B Y"@s~ddlZddlZddlZdgZGdddZddZy ddlZWnek rXdZYn"Xe ej e ddd ZdS) N Completerc@s6eZdZd ddZddZddZdd Zd d ZdS) rNcCs6|rt|tstd|dkr&d|_n d|_||_dS)Nznamespace must be a dictionaryr) isinstancedict TypeError use_main_ns namespace)selfrr ./opt/alt/python37/lib/python3.7/rlcompleter.py__init__'s zCompleter.__init__cCs|jrtj|_|sB|dkr>tr8tdtdSdSndS|dkrld|kr`| ||_ n | ||_ y |j |St k rdSXdS)Nr .) r__main____dict__rstrip_readline_availablereadlineZ insert_textZ redisplay attr_matchesmatchesglobal_matches IndexError)r textstater r r completeBs$   zCompleter.completecCst|r|d}|S)N()callable)r valwordr r r _callable_postfixaszCompleter._callable_postfixc Csddl}g}dh}t|}xT|jD]J}|d||kr"|||dkrR|d}n|dkrb|d}||q"Wx^|jtjgD]N}xH|D]<\}}|d||kr||kr|||| ||qWq~W|S)Nr __builtins__>tryfinally:>passFalseNoneTruecontinueelsebreak ) keywordlenkwlistaddappendrbuiltinsritemsr ) r rr-rseennrZnspacerr r r rfs$    zCompleter.global_matchesc Csjddl}|d|}|sgS|dd\}}yt||j}Wntk rPgSXtt|}|dt |dr| d| t |j g}t|} |dkrd} n|dkrd } nd} xx||D]t} | d| |kr| r| d| d| ksd || f} yt|| } Wntk rYnX|| | } || qW|sD| sFP| dkrVd } qd} qW||S) Nrz(\w+(\.\w+)*)\.(\w*)rr! __class__r___z%s.%s)rematchgroupevalr Exceptionsetdirdiscardhasattrr0updateget_class_membersr7r.getattrr r1sort)r rr:mexprattrZ thisobjectZwordsrr5Znoprefixrr;rr r r rsN           zCompleter.attr_matches)N)__name__ __module__ __qualname__r rr rrr r r r r&s  cCs2t|}t|dr.x|jD]}|t|}qW|S)N __bases__)r@rBrMrD)klassretbaser r r rDs   rDFcCs tdS)N)r set_completerr r r r rRT) atexitr2r__all__rrDr ImportErrorrrQrregisterr r r r  s