B YI~d��@s�ddlZddlZddlZddlZddlZddlZddlmZddlm Z Gdd�d�Z dd�Z dZ d Z d Ze�d �Zd Zd ZdZdd�Zedkr�ddlmZeddd�dS)�N)� calltip_w)� HyperParserc@sXeZdZddd�Zdd�Zdd�Zddd �Zd d �Zd d �Zdd�Z dd�Z dd�Z dS)�CalltipNcCs0|dkrd|_n||_|j|_d|_|j|_dS)N)�editwin�text�active_calltip�_make_tk_calltip_window�_calltip_window)�selfr�r �4/opt/alt/python37/lib64/python3.7/idlelib/calltip.py�__init__s zCalltip.__init__cCs d|_dS)N)r )r r r r �closesz Calltip.closecCs t�|j�S)N)rZ CalltipWindowr)r r r r r szCalltip._make_tk_calltip_windowcCs|jr|j��d|_dS)N)rZhidetip)r �eventr r r �remove_calltip_window$s zCalltip.remove_calltip_windowcCs|�d�dS)NT�break)� open_calltip)r rr r r �force_open_calltip_event)s z Calltip.force_open_calltip_eventcCs|�d�dS)NF)r)r rr r r �try_open_calltip_event.szCalltip.try_open_calltip_eventcCs|jr|jjr|�d�dS)NF)rZ tipwindowr)r rr r r �refresh_calltip_event5szCalltip.refresh_calltip_eventcCs�|��t|jd�}|�d�}|s&dS|�|d�|��}|sDdS|sZ|�d�dkrZdS|�|�}|sldS|��|_ |j � ||d|d�dS)N�insert�(r������) rrrZget_surrounding_bracketsZ set_indexZget_expression�find� fetch_tipr rZshowtip)r Z evalfuncsZhpZ sur_paren� expression�argspecr r r r9s     zCalltip.open_calltipcCsRy|jjjjj}Wntk r*d}YnX|rB|�dd|fi�Stt|��SdS)N�execZget_the_calltip) r�flistZpyshellZinterp�rpcclt�AttributeErrorZ remotecall� get_argspec� get_entity)r rr r r r rLs  zCalltip.fetch_tip)N)N) �__name__� __module__� __qualname__r rrrrrrrrr r r r rs  rcCs4|r0tjtj�}y t||�Stk r.dSXdS)N)�sys�modules�__main__�__dict__�eval� BaseException)r� namespacer r r r#es   r#�U�z z(?<=\()\w*\,?\s*zSee source or doczinvalid method signaturez0 # '/' marks preceding args as positional-only.c Cs�y |j}Wntk rdSXt|tj�r0|n|}ytt�|��}Wn<tk r�}zt|�}|� t �rnt Sd}Wdd}~XYnXd|kr�t |�t t t �kr�|t 7}t|t�r�|dkr�t}t |�t kr�tj|t td�n |r�|gng}t|tj��r�|j}n t|dd�}|�rlxZ|�dt�dt�D]B}|��}|�s:Pt |�t k�r\|dt d�d}|�|��q&Wd�|�}|�p~tS) N��/z())�subsequent_indent�__doc__� �z...)�__call__r,� isinstance�types� MethodType�str�inspectZ signature� Exception� startswith�_invalid_method�len� _MAX_COLS�_argument_positional�type�_default_callable_argspec�textwrap�wrap�_INDENTr3�getattr�split� _MAX_LINES�strip�append�join) ZobZob_callZfobr�err�msg�lines�doc�liner r r r"{s<   *  r"r))�mainzidlelib.idle_test.test_calltip�)� verbosity)r)r;�rer'rDr8ZidlelibrZidlelib.hyperparserrrr#r@rIrF�compileZ _first_paramrCr>rAr"r$ZunittestrRr r r r �s(  S 6