a �DOg��@s|ddlZddlZddlZdgZGdd�d�Zdd�Zz ddlZWneyVdZYn"0e� e�j �e� dd��d ZdS) �N� Completerc@s6eZdZd dd�Zdd�Zdd�Zdd �Zd d �ZdS) rNcCs6|rt|t�std��|dur&d|_n d|_||_dS)Nznamespace must be a dictionary�r)� isinstance�dict� TypeError� use_main_ns� namespace)�selfr�r �#/usr/lib64/python3.9/rlcompleter.py�__init__'s zCompleter.__init__cCs�|jrtj|_|��sB|dkr>tr8t�d�t��dSdSndS|dkrld|vr`|� |�|_ n |� |�|_ z |j |WSt y�YdS0dS)Nr� ��.) r�__main__�__dict__r�strip�_readline_available�readlineZ insert_textZ redisplay� attr_matches�matches�global_matches� IndexError)r �text�stater r r �completeBs$    zCompleter.completecCst|�r|d}|S)N�()�callable)r �val�wordr r r �_callable_postfixaszCompleter._callable_postfixc Cs�ddl}g}dh}t|�}|jD]J}|d|�|kr |�|�|dvrP|d}n|dvr`|d}|�|�q |jtjfD]J}|��D]<\}}|d|�|kr�||vr�|�|�|�|� ||��q�qx|S)Nr� __builtins__>�try�finally�:>�False�break�None�else�True�continue�pass� ) �keyword�len�kwlist�add�appendr�builtinsr�itemsr ) r rr-r�seen�nrZnspacerr r r rfs$     zCompleter.global_matchescCs�ddl}|�d|�}|sgS|�dd�\}}zt||j�}WntyRgYS0tt|��}|�d�t |d�r�|� d�|� t |j ��g}t|�} |dkr�d} n|dkr�d } nd} |D]�} | d| �|kr�| r�| d| d�| ks�d || f} ttt|�| d�t��r|�| �q�t|| d�} du�rD|�|�| | ��q�|�| �q�|�sv| �s`�qv| dk�rpd } q�d} q�|��|S) Nrz(\w+(\.\w+)*)\.(\w*)r�r!� __class__r�_�__z%s.%s)�re�match�group�evalr� Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.r�getattr�type�propertyr1r �sort)r rr:�m�expr�attrZ thisobject�wordsrr5Znoprefixrr;�valuer r r r�sV        �� �    zCompleter.attr_matches)N)�__name__� __module__� __qualname__r rr rrr r r r r&s  cCs.t|�}t|d�r*|jD]}|t|�}q|S)N� __bases__)r@rBrQrD)�klass�ret�baser r r rD�s   rDFcCs t�d�S)N)r� set_completerr r r r ���rVT) �atexitr2r�__all__rrDr� ImportErrorrrUr�registerr r r r � s