B YI~d��� @s�ddlZedkr ejdejd<y ddlTWn*ek rVedejd�ed��YnXejdkr�y ddl Z dZ e � d �� e �Wnee efk r�YnXddlmZed kr�e�at��dd lmZet�ejd d etd�ed��ddlmZddlZddlZddlZddlmZddlZddl Z ddl!Z!ddl"m#Z#ddl$Z$ddl%Z%ddl&Z&ddl'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl,m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl,m6Z6ddlm7Z7m8Z8m9Z9ddl:m;Z;dZd:dd�Z?da@dd �ZAeAd!�dejBfd"d#�ZCeCe_BGd$d%�d%e0�ZDGd&d'�d'e3�ZEGd(d)�d)e)�ZFGd*d+�d+e;�ZGGd,d-�d-e6jH�ZId.d/�ZJGd0d1�d1e�ZKGd2d3�d3e5�ZLd4d5�ZMd6ZNd7d8�ZOedk�r�eO�eAd9�dS);�N�__main__zidlelib.pyshell)�*zJ** IDLE can't import Tkinter. Your Python may not be configured for Tk. **)�file��win32Zshcoreg!@)� fix_scalingzIdle Cannot Startz"Idle requires tcl/tk 8.5+, not %s.)�parent)�InteractiveInterpreter)�python_version)� TextWrapper)�ColorDelegator)�idleConf)�debugger)� debugger_r)� EditorWindow� fixwordbreaks)�FileList)� OutputWindow)�rpc)�idle_formatwarning� StdInputFile� StdOutputFile)� UndoDelegatorz 127.0.0.1c CsP|dkr t}y&|�t|||||d��|�d�Wnttfk rJYnXdS)N)�linez>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorr�r"�4/opt/alt/python37/lib64/python3.7/idlelib/pyshell.py�idle_showwarningEsr$cCs0|rtdkr,tjatt_ntdk r,tt_dadS)N)�_warnings_showwarning�warnings� showwarningr$)Zcapturer"r"r#�capture_warningsXsr(TcCs\tj}i}x:t|�D].}|dd�|dd�dkr|�|�||<qW||�|�|�dS)Nr�����z<>)� linecache�cache�list�pop�update)r Zorig_checkcacher+�save�keyr"r"r#�extended_linecache_checkcachegs r1c@szeZdZdd�ZddddddgZdd d �Zd d �Zd dd�Zd!dd�Zdd�Z dd�Z dd�Z dd�Z dd�Z dd�ZdS)"�PyShellEditorWindowcGs�g|_tj|f|��|j�d|j�|j�d|j�|j�d|jj�t j � t j d�|_|jj|fdd�}|j�|�|jjr�|��|��dS)Nz<>z<>z<>zbreakpoints.lstcSs|��|�dS)N)�restore_file_breaks)Zold_hook�selfr"r"r#�filename_changed_hook�sz;PyShellEditorWindow.__init__..filename_changed_hook)� breakpointsr�__init__�text�bind�set_breakpoint_here�clear_breakpoint_here�flist� open_shell�os�path�joinr Zuserdir�breakpointPath�ioZfilename_change_hookZset_filename_change_hookr r3�color_breakpoint_text)r4�argsr5r"r"r#r7�s   zPyShellEditorWindow.__init__)ZCutz<>�rmenu_check_cut)ZCopyz<>Zrmenu_check_copy)ZPastez <>�rmenu_check_paste)NNN)zSet Breakpointz<>N)zClear Breakpointz<>NTcCsD|jdkrdS|r(t��}t�|d�}n ddd�}|j�d|�dS)N�break�)� foreground� background�BREAK)rBr � CurrentTheme� GetHighlightr8Z tag_config)r4Zcolor�themeZcfgr"r"r#rC�s  z)PyShellEditorWindow.color_breakpoint_textcCs�|j}|jj}|�dd|d|d�y|j�|�Wn tk rX|j�|�YnXy|jj j j }|� ||�Wn YnXdS)NrKz%d.0r) r8rBr �tag_addr6�index� ValueError�appendr<�pyshell�interprr:)r4r!r8r �debugr"r"r#�set_breakpoint�s z"PyShellEditorWindow.set_breakpointNcCs>|j}|jj}|s|��dStt|�d���}|�|�dS)N�insert)r8rBr �bell�int�floatrPrV)r4�eventr8r r!r"r"r#r:�sz'PyShellEditorWindow.set_breakpoint_herecCs�|j}|jj}|s|��dStt|�d���}y|j�|�Wn YnX|� ddd�y|j j j j }|�||�Wn YnXdS)NrWrKzinsert linestartzinsert lineend +1char)r8rBr rXrYrZrPr6�remove� tag_remover<rSrTrr;)r4r[r8r r!rUr"r"r#r;�s" z)PyShellEditorWindow.clear_breakpoint_herecCsd|jr`|j}|jj}|s$|��dSg|_|�ddt�y|jjj j }|� |�Wn YnXdS)NrKz1.0) r6r8rBr rXr]ZENDr<rSrTr�clear_file_breaks)r4r8r rUr"r"r#r^�s z%PyShellEditorWindow.clear_file_breaksc Cs|j}|jj}y$t|jd��}|��}WdQRXWntk rJg}YnXynt|jd��X}x$|D]}|�|d�sb|�|�qbW|� �|j}|r�|�|dt |�d�WdQRXWnTtk �r}z4t |j dd�s�d|j _ tjdd t |�|jd �Wdd}~XYnXdS) N�r�w�=� �breakpoint_error_displayedFTz IDLE Errorz$Unable to update breakpoint list: %s)�titlerr)r6rBr �openrA� readlinesr� startswithr�update_breakpoints�str�getattr�rootrc� tkMessageBox� showerrorr8)r4Zbreaksr �fp�linesZnew_filer�errr"r"r#�store_file_breaks�s.  (z%PyShellEditorWindow.store_file_breaksc Cs�|j��|jdkrdS|jj}|dkr,dStj�|j�r�t|jd��}|� �}WdQRXxJ|D]B}|� |d�r`t |t |�dd��}x|D]}|� |�q�Wq`WdS)Nr_rar)r8r.rBr r>r?�isfilerArerfrg�eval�lenrV)r4r rnrorZbreakpoint_linenumbersZbreakpoint_linenumberr"r"r#r3 s    z'PyShellEditorWindow.restore_file_breakscCs$|j}|�d�}|�|�}||_dS)NrK)r8Z tag_ranges�ranges_to_linenumbersr6)r4r8�rangesZlinenumber_listr"r"r#rhs  z&PyShellEditorWindow.update_breakpointscCsjg}x`tdt|�d�D]L}tt||j��}tt||dj��}x||kr`|�|�|d7}qDWqW|S)Nr�r)�rangertrYrZ�stringrR)r4rvrorPr!�endr"r"r#ru%s  z)PyShellEditorWindow.ranges_to_linenumberscCs|��t�|�dS)N)r^r�_close)r4r"r"r#r{6szPyShellEditorWindow._close)T)N)N)�__name__� __module__� __qualname__r7� rmenu_specsrCrVr:r;r^rqr3rhrur{r"r"r"r#r2~s"  *r2c@seZdZeZdZddd�ZdS)�PyShellFileListNcCs8|jr|jj��nt|�|_|jr2|j��s2dS|jS)N)rS�top�wakeup�PyShell�begin)r4r[r"r"r#r=Es  zPyShellFileList.open_shell)N)r|r}r~r2rrSr=r"r"r"r#r�<sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ModifiedColorDelegatorcCst�|�|��dS)N)r r7� LoadTagDefs)r4r"r"r#r7Ss zModifiedColorDelegator.__init__cCs*|�ddd�|�ddd�t�|�dS)NZTODOz1.0�iomarkZSYNC)r]rOr �recolorize_main)r4r"r"r#r�Wsz&ModifiedColorDelegator.recolorize_mainc CsJt�|�t��}|j�ddd�t�|d�t�|d�t�|d�d��dS)N)rJrI�stdout�stderr�console)�stdinr�r�r�)r r�r rL�tagdefsr.rM)r4rNr"r"r#r�\s   z"ModifiedColorDelegator.LoadTagDefscCs"x|jD]}|�|dd�qWdS)Nr�rz)r�r])r4�tagr"r"r#� removecolorsfs z#ModifiedColorDelegator.removecolorsN)r|r}r~r7r�r�r�r"r"r"r#r�Ps r�c@s eZdZddd�Zddd�ZdS)�ModifiedUndoDelegatorNcCsLy"|j�|dd�r |j��dSWntk r6YnXt�||||�dS)N��Z%dS)C�ModifiedInterpretercCsB||_tjdj}tj||d�d|_d|_t|_ |j j j |_ dS)Nr)�localsF)� tkconsole�sys�modules�__dict__r r7� restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)r4r�r�r"r"r#r7�s zModifiedInterpreter.__init__NcCs&|jdkr|��|_t�|j�|_dS)N)r��build_subprocess_arglist� subprocess�Popen� rpcsubproc)r4r"r"r#�spawn_subprocess�s  z$ModifiedInterpreter.spawn_subprocesscCsJdd�tjD�}tjdddddd�}d |f}tjg|d |t|j�gS) NcSsg|] }d|�qS)z-Wr")�.0�sr"r"r#� �s[email protected]_subprocess_arglist..�main�Generalzdelete-exitfuncF�bool)�default�typez&__import__('idlelib.run').run.main(%r)z-c)r�� warnoptionsr � GetOption� executablerir�)r4r`Z del_exitfZcommandr"r"r#r��s    z,ModifiedInterpreter.build_subprocess_arglistc CsZt|jf}xLtd�D]4}t�|�yt|�|_PWqtk rFYqXqW|��dS|jj � �d|_t dkr�|jj � t jt jd�|��|jj �d�y|j��Wnt jk r�|��dSX|j�d|j�|j�d|jj�|j�d|jj�|j�d|jj�|j�d |jj�|j�d t�|j�d |�|jd d �|��|jS)N�rr� r�r�r�r�r<r*rTT)�with_cwd)�HOSTr�rx�timeZsleepr��rpccltr�display_port_binding_error�listening_sockZ getsocknamer�Z setsockopt�socketZ SOL_SOCKETZ SO_REUSEADDRr�Z settimeout�accept�timeout�display_no_subprocess_error�registerr�r�r�r�r<r*� transfer_path�poll_subprocess)r4Zaddr�ir"r"r#�start_subprocess�s>       z$ModifiedInterpreter.start_subprocessFrHcCs0|jr |jSd|_|��}|rYnXy|j��Wntk rbYnX|��d|j_ d|_dS)NF) �_afteridr�r8Z after_cancelr�r�r�rr�r�)r4r"r"r#�kill_subprocesss z#ModifiedInterpreter.kill_subprocesscCsLy|j��Wntk r"dSXy|j��Wntk rFdSXdS)N)r��killr�wait)r4r"r"r#r�!sz(ModifiedInterpreter.terminate_subprocesscCs2|rdg}|�tj�ntj}|�d|f�dS)NrHzRif 1: import sys as _sys _sys.path = %r del _sys )�extendr�r?� runcommand)r4r�r?r"r"r#r�.s z!ModifiedInterpreter.transfer_pathc Cs6|j}|dkrdSy|j|jdd�}Wn2tttfk rX|jjrHdSd}|��YnX|�r|j� �d|_|\}}|jj }|dkr�|dk r�t t |�|d�nH|dkr�|j� d�r�|��n*|dkr�d}t ||tjd�t |||d�y|j��Wntk �rYnX|jj�s2|jj�|jj|j�|_dS) Ng�������?)r�ZOK)rZ EXCEPTIONz<>�ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR: )r�Z pollresponse� active_seqr�r�KeyboardInterruptr��closingr�� resetoutputr��print�repr�getvar�remote_stack_viewerr�� __stderr__� endexecutingrr8�after� pollintervalr�r�)r4Zclt�responseZhowZwhatr��errmsgr"r"r#r�=s@    z#ModifiedInterpreter.poll_subprocesscCs ||_dS)N)r)r4rr"r"r#� setdebuggereszModifiedInterpreter.setdebuggercCs|jS)N)r)r4r"r"r#r�hszModifiedInterpreter.getdebuggercCs|jj�d|j�dS)Ni,)r�r8r�r�)r4r"r"r#�open_remote_stack_viewerks z,ModifiedInterpreter.open_remote_stack_viewerc Cs�ddlm}|j�dddi�}|dkr6|jj��dS|�|j|�}ddlm }m }t |jj�}t � �}t �|d�d}|||dd �} | jjd d d �|| jd|�} | ��dS) Nr)� debugobj_rr�Z stackviewer)r<)�ScrolledCanvas�TreeNodeZnormalrJ)�bgZhighlightthicknessrZboth)�expand�fill)�idlelibr�r�� remotequeuer�rkrXZStubObjectTreeItemZ idlelib.treer�r�ZToplevelr rLrM�frame�packZcanvasr�) r4r�Zoid�itemr�r�r�rNrJZscZnoder"r"r#r�xs   z'ModifiedInterpreter.remote_stack_viewerrcCs|�|�}|�||�dS)N)� stuffsource�execfile)r4�sourcer r"r"r#� execsource�s zModifiedInterpreter.execsourcec Cs�|dkrFt�|��.}|��}trr?�abspathr�� OverflowError� SyntaxErrorr�r�r�r�r �showsyntaxerrorr��runcode)r4r rrn�coder"r"r#r�s &   zModifiedInterpreter.execfilecCs|�|�}t�|||�S)N)rr � runsource)r4rr r"r"r#r�s zModifiedInterpreter.runsourcecCs>d|j}|jd|_|�d�}t|�dd||ftj|<|S)Nz rrbr)�gid�splitrtr*r+)r4rr ror"r"r#r�s    zModifiedInterpreter.stuffsourcecCs|�d|f�dS)Na(if 1: _filename = %r import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir )r�)r4r r"r"r#�prepend_syspath�sz#ModifiedInterpreter.prepend_syspathc Cs�|j}|j}|�ddd�t��\}}}t|dd�p:|p:d}t|dd�pJd}t|d d�pZd } | d krl|d7}|dkr�d | d} nd |d| df} |�|| �|��|�d |�|� �dS)Nr�z1.0rz�msgrHzr!r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s ) r�r8r]r��exc_inforjZcolorize_syntax_errorr�rr�) r4r r�r8r��value�tbrr!r�posr"r"r#r �s" z#ModifiedInterpreter.showsyntaxerrorcCs6|j��|��t�|�|j�d�r2|j��dS)Nz<>)r�r��checklinecacher � showtracebackr��open_stack_viewer)r4r"r"r#r�s    z!ModifiedInterpreter.showtracebackcCsBtj}x6t|���D]&}|dd�|dd�dkr||=qWdS)Nrr)z<>)r*r+r,�keys)r4�cr0r"r"r#r�sz"ModifiedInterpreter.checklinecachecCs@|jjr|��dS|jr0|j�dd|fi�n t||j�dS)Nrr�rr)r�r��display_executing_dialogr�r�r�r�)r4rr"r"r#r��s zModifiedInterpreter.runcommandcCsN|jjr|j��|��|j}z�yT|j��|sT|jdk rT|j�dd|fi�|_ n |rh|� ||j �n t ||j �Wn�t k r�|jjs�tjddd|jjd�r��q�|��n�Yn`tr�td|jjd�|��|j��n,|jj�r d |j_td |jjd�n|��YnXWdt�sHy|j��Wntk �rFYnXXdS) Nr�rzExit?zDo you want to exit altogether?Zyes)r�rz IDLE internal error in runcode())rFr�)r�r�rTr�rr�beginexecutingr�Z asyncqueuer��runr�r�� SystemExitr�rlZaskyesnor8rr r�r�r��canceledr)r4rrr"r"r#r�sJ        zModifiedInterpreter.runcodecCs|jj�|�S)N)r�r�r)r4r�r"r"r#r#szModifiedInterpreter.writecCstjdd|jjd�dS)NzPort Binding ErroraAIDLE can't bind to a TCP/IP port, which is necessary to communicate with its Python execution server. This might be because no networking is installed on this computer. Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.)r)rlrmr�r8)r4r"r"r#r�'sz.ModifiedInterpreter.display_port_binding_errorcCstjdd|jjd�dS)NzSubprocess Connection Errorz�IDLE's subprocess didn't make connection. See the 'Startup failure' section of the IDLE doc, online at https://docs.python.org/3/library/idle.html#startup-failure)r)rlrmr�r8)r4r"r"r#r�2sz/ModifiedInterpreter.display_no_subprocess_errorcCstjdd|jjd�dS)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.)r)rlrmr�r8)r4r"r"r#r:sz,ModifiedInterpreter.display_executing_dialog)FrH)F)N)N)&r|r}r~r7r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rrrrrrr rrr�rrr�r�rr"r"r"r#r��sF  + , &     . r�cs�eZdZde�dZeZeZddddddgZ e j d gZ d Z d d l mZdTdd�Zdd�Zd Zd Zd Zd Zd Zd Zdd�Zdd�ZdUdd�Zdd�ZdVdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Z d&d'�Z!d(d)�Z"d*d+�Z#d,Z$d-d.�Z%d/d0�Z&d1d2�Z'd3d4�Z(dWd5d6�Z)d7d8�Z*d9d:�Z+d;d<�Z,d=d>�Z-d?d@�Z.dXdAdB�Z/dYdCdD�Z0dZdEdF�Z1dGdH�Z2dIdJ�Z3dKdL�Z4d[dNdO�Z5�fdPdQ�Z6�fdRdS�Z7�Z8S)\r�zPython z Shell)rZ_File)ZeditZ_Edit)rUZ_Debug)�optionsZ_Options)ZwindowZ_Window)�helpZ_Help)ZSqueezez<>Fr)�HistoryNcCs$tr&|j}|dddkr&|�dd�t|�|_|dkrVt�}t|�|��t|�}t � ||dd�d|_ d|_ t td�r�tjnd|_|j�d �d |_|j|_|j}|jd d �|�d |j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�t�r8|�d|j�|�d|j�|� |�}|�d|j!�tj"|_#tj$|_%tj&|_'ddl(m)}t*|d|j+|j,�|_&t-|d|j+|j,�|_"t-|d|j+d�|_$t-|d|j+|j,�|_.t�s�|j"t_"|j$t_$|j&t_&yddl/}|j0|_1Wntj2t_$�YnX|�3|j�|_4d|_5dS)Nrwr�shell)r'ZShe_llT��ps1z>>> rbr)�char)�wrapz<>z<>z<>z<>z<>z<>z<>z<>z<>z<>)�iomenur�r�r��backslashreplacer��2)6r � menu_specsrWr�rT�Tkr�withdrawr�rr7ZusetabsZ indentwidth�hasattrr�r)�sys_ps1rZprompt_last_line�promptr8Z configurer9�enter_callback�linefeed_callback�cancel_callback� eof_callbackr�toggle_debugger�toggle_jit_stack_viewer�view_restart_mark� restart_shellZSqueezerZsqueeze_current_text_eventr�� save_stdoutr�� save_stderrr�� save_stdinr�r,r�encoding�errorsrr��pydocZ plainpagerZpagerr�r&�historyr�)r4r<�msrkr8Zsqueezerr,rBr"r"r#r7^sn       zPyShell.__init__cCs tjdd�S)NT)Z shell_only)r Z GetExtensions)r4r"r"r#�get_standard_extension_names�sz$PyShell.get_standard_extension_namescCs|adS)N)r)r4�streamr"r"r#�set_warning_stream�szPyShell.set_warning_streamcCstS)N)r)r4r"r"r#�get_warning_stream�szPyShell.get_warning_streamcCsH|jr$tjdd|jd�|��dS|j��}|r<|��n|��dS)NzDon't debug nowz*You can only toggle the debugger when idle)rrG) r�rlrmr8�set_debugger_indicatorrTr��close_debugger� open_debugger)r4r[�dbr"r"r#r9�s   zPyShell.toggle_debuggercCs|j��}|�d| �dS)Nz<>)rTr�Zsetvar)r4rLr"r"r#rI�s zPyShell.set_debugger_indicatorcCsdS)Nr")r4r[r"r"r#r:�szPyShell.toggle_jit_stack_viewercCsh|j��}|r\|j�d�|��|jjr8t�|jj�|��|j� d�|j |_ |� �|� �dS)Nz [DEBUG OFF] )rTr�r�r�r�rZclose_remote_debuggerr�r�rr3r4r�rI)r4rLr"r"r#rJ�s   zPyShell.close_debuggercCsX|jjrt�|jj|�}n t�|�}|j�|�|��d|j|_ |� �|� �dS)Nz [DEBUG ON] ) rTr�rZstart_remote_debuggerrZDebuggerr�r�r3r4r�rI)r4Zdbg_guir"r"r#rK�s    zPyShell.open_debuggercCs|��d|_dS)NT)r�r�)r4r"r"r#r �szPyShell.beginexecutingcCsd|_d|_|��dS)NF)r�r#r�)r4r"r"r#r��szPyShell.endexecutingcCsD|jr&tjddd|jd�}|dkr&dS|��d|_d|_t�|�S)NzKill?z7Your program is still running! Do you want to kill it?�ok)r�rFZcancelT) r�rlZ askokcancelr8r�r#r�rr�)r4r�r"r"r#r��s z PyShell.closecCsV|��tr|j��|jt_|jt_|j t_ d|_d|_ d|j _ d|_t�|�dS)N)rJr rTr�r=r�r�r>r�r?r�r�r<rSrCrr{)r4r"r"r#r{�s zPyShell._closecCsdS)NTr")r4r r"r"r#�ispythonsource szPyShell.ispythonsourcecCs|jS)N)� shell_title)r4r"r"r#� short_titleszPyShell.short_titlezHType "help", "copyright", "credits" or "license()" for more information.cCs�|j�dd�|��tr:d}|j��}|sF|��dSn d}tjt _|� dt j t j |j |f�|j��|��ddl}d|_dS) Nr�rWrHFz�==== No Subprocess ==== WARNING: Running IDLE without a Subprocess is deprecated and will be removed in a later version. See Help/IDLE Help for details. zPython %s on %s %s %srT)r8r�r�r rTr�r�r� displayhookr�r�version�platform� COPYRIGHTZ focus_forcer��tkinterZ _default_root)r4ZnosubZclientrUr"r"r#r�s"  z PyShell.begincCs|js dSd|_|j��dS)NT)�reading�_stop_readline_flagr��quit)r4r"r"r#r�,szPyShell.stop_readlinecCs�|j}zd|_|j��Wd||_X|jr4d|_dS|j�dd�}t|�dkrRd}|��|jrnd|_t snt �|j r~d|_ d}|S)NTFrHr�zend-1crrb) rVr��mainlooprWr8�getrtr�r#r r�� endoffile)r4r/rr"r"r#�readline2s( zPyShell.readlinecCsdS)NTr")r4r"r"r#�isattyIszPyShell.isattycCs�y|j�ddd�rdSWn YnX|jsR|jsR|��|j�d�|��dSd|_d|_ |jr�|jj r�|j� �r�|j� �n |j� �|jr�|j��dS)Nz sel.firstz!=zsel.lastzKeyboardInterrupt rGFT)r8r�r�rVr�rTrr�r[r#r�r�r�r�r�rX)r4r[r"r"r#r7Ls&      zPyShell.cancel_callbackcCsf|jr|jsdS|j�ddd�r0|j�ddd�s4dS|jsL|��|��nd|_d|_|j� �dS)Nr�z==rWzend-1cFTrG) r�rVr8r�r�r�r#r[r�rX)r4r[r"r"r#r8bs   zPyShell.eof_callbackcCs0|jr"|j�dd�|j�d�n |�|�dS)NrWrbrG)rVr8rW�see�newline_and_indent_event)r4r[r"r"r#r6qs  zPyShell.linefeed_callbackcCs8|jr|jsdSy6|j�dd�}|rD|j�ddd�rD|�||�dSWn YnX|j�ddd��rV|j�d d�}|r�|j�dd|d �r�|�|j�|d |d �|�dS|j�d d�}|r�|j�d d |d �r�|�|j�|d |d �|�dS|j�dd�}|�r<|j�|d dd��r<|�|j�|d d �|�n|�|j�dd �|�dS|j�ddd��rv|j�dd�|j�dd�}|�r�|� ��s�|j� dd�|j�ddd��r�|� |�dS|j�dd�|j�r�|j� dd�|j� d�n |� |�|j�d dd�|j��|j�r,|j��n|��dS)Nz sel.firstzsel.lastz<=r�rGrWr�ziomark linestartr�rrzinsert lineendz>=r�zinsert linestartzend-1czend-1c linestartrb)r�rVr8rZr��recallZ tag_prevrangeZ tag_nextranger��stripr�r_rWr^rOZupdate_idletasksr�rX�runit)r4r[�sel�prev�next�indicesr�r"r"r#r5zsX      zPyShell.enter_callbackc Cs<t�dd|�}t�dd|�}|�d�}|j��z�|j�ddd�|j�dd �|j�d d�}|��� d �r�|� |�|j�d d�}|j� d|d � ��t |�d k�rt�d|d ��d �}t�d|��d �}xJ|d d�D]:}|�|��r||t |�d�}|j� dd|���q�WWd|j�d�|j��XdS)Nz^\s*\nrHz\n\s*$rbrcz1.0rzrWzend-1czinsert linestart�:rrz ^([ \t]*))�re�subrr8Zundo_block_startr]r�rZ�rstrip�endswithr_rWrart�search�grouprgr^Zundo_block_stop)r4r�r[ro�prefixZorig_base_indentZnew_base_indentrr"r"r#r`�s*     zPyShell.recallcCs�|j�dd�}t|�}x$|dkr:||ddkr:|d}qW|dkr\||ddkr\|d}x$|dkr�||ddkr�|d}q^W|d|�}|j�|�dS)Nr�zend-1crrz rb)r8rZrtrTr)r4rr�r"r"r#rb�s   z PyShell.runitcCsX|jjr|j��Sy tjWntjdd|jd�dSddlm }||j |j �dS)NzNo stack tracez@There is no stack trace yet. (sys.last_traceback is not defined))rr)� StackBrowser) rTr�r�r��last_tracebackrlrmr8Zidlelib.stackviewerrorkr<)r4r[ror"r"r#r�s    zPyShell.open_stack_viewercCs|j�d�|j�d�dS)Nr�r�)r8r^)r4r[r"r"r#r;�s zPyShell.view_restart_markcCs|jjdd�dS)NT)r�)rTr�)r4r[r"r"r#r<�szPyShell.restart_shellcCs:|��|j�|j�|j�dd�|��|j��dS)NrWzend-1c) r�r�rr4r8r��set_line_and_columnrBZ reset_undo)r4r"r"r#r��s zPyShell.showpromptcCsP|jjj}t|ddd�}d�|�|��}|�d�s:|d7}|jj� d|d�dS)Nr(T)r��tabsizeZ expand_tabsrbziomark linestartr�) rTr�r�r r@r+rkZperZbottomrW)r4rr��wrapperZ wrapped_msgr"r"r#� show_warning�s   zPyShell.show_warningcCsb|j�dd�}|jr |j�|�|j�d�dkr>|j�dd�|j�dd�|��|j��dS)Nr�zend-1czend-2crb) r8rZrC�storerWr�rqZctipZremove_calltip_window)r4rr"r"r#r�s zPyShell.resetoutputr"cCsXy0|j�dd�t�|||d�}|j�dd�Wn�YnX|jrTd|_tsTt�|S)Nr��rightr�F)r8r�rrr#r r�)r4r�r��countr"r"r#rsz PyShell.writecs8y|j�ddd�rdSWntk r,dSXt���S)Nz sel.firstr�r��disabled)r8r�r��superrE)r4)� __class__r"r#rEs zPyShell.rmenu_check_cutcs|j�ddd�rdSt���S)NrWr�r�rx)r8r�ryrF)r4)rzr"r#rF&szPyShell.rmenu_check_paste)N)N)N)N)N)N)N)r")9r|r}r~r rOr�r r�rr/rrZallow_line_numbersZidlelib.historyr&r7rErVr�r#r[r�rWrGrHr9rIr:rJrKr r�r�r{rNrPrTr�r�r\r]r7r8r6r5r`rbrr;r<r�rtr�rrErF� __classcell__r"r")rzr#r�Bsl  C      ?     r�c Cs6|jdkr2x&dD]}|�|dd|�|d��qWdS)NZx11)ZTextZEntryZSpinboxz <>z%catch {%W delete sel.first sel.last} )Z_windowingsystemZ bind_class)rk�clsr"r"r#� fix_x11_paste,s  r}a� USAGE: idle [-deins] [-t title] [file]* idle [-dns] [-t title] (-c cmd | -r file) [arg]* idle [-dns] [-t title] - [arg]* -h print this help message and exit -n run IDLE without a subprocess (DEPRECATED, see Help/IDLE Help for details) The following options will override the IDLE 'settings' configuration: -e open an edit window -i open a shell window The following options imply -i and will open a shell: -c cmd run the command in a shell, or -r file run script from file -d enable the debugger -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window A default edit window will be bypassed when -c, -r, or - are used. [arg]* are passed to the command (-c) or script (-r) in sys.argv[1:]. Examples: idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print(sys.argv)" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print(sys.argv)" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. c snddl}ddlm}ddlm}ddlm}td�dad}d}d}d}d}d} y|�tj dd�d�\} } WnD|j k r�} z$t d | t ftj d �t�d �Wdd} ~ XYnXx�| D]�\} }| d kr�|}d}| d kr�d}d}| dkr�d}| dk�r tj�t �t��| dk�rd}| dk�r6t dtj d �da| dk�rj|}tj�|��rTnt d|�t��d}| dk�r|d} d}| dkr�|t_d}q�W| �r�| ddk�r�tj��}d}x0tttj��D]}tj�tj|�tj|<�q�W| �r| ddk�rdg| dd�t_ n�|�r$d g| t_ n�|�r8|g| t_ n�| �r�d}g}x | D]}|�tj�|���qLWxX|D],}tj�|�}|tjk�rntj�d|��qnWn"t��}|tjk�r�tj�d|�tj ddddd�}|�p�|}|�p�| }t�r�|�s�t!�t"dd�a#t#�$�dd l%m&}|t#�tj�'tj�t(�d!��|�d"k�r`tj�'�d#�}t#j)|d$�nV|�*��s�t+d%k�r~d&�d'}nd(�d)}��fd*d+�|D�}d,d+�|D�}t#j,d0|��t-t#�t.t#�t/t#�a0|�1t#t0�|�r,|�s,|�s,x0| dd�D] }t0�2|�dk�r�| �3|��q�W| �s,t0�4�|�rbt0�5�}|�sDdS|�*��rht0j6�rh|j7�8�nt0j9}|�rv|�:�| �r�tj;�|�|�s�|�r |j=�?d/tj f�|�r�|j=�@|�n|�rB|j=�A|�|j=�>|�n8|�rB|�Bt#�}|�r*|�C|�|�D�}|�rB|�C|�xt0jE�rXt#�F��qDWt#�G�td�dS)1Nr)�system)�testing)�macosxTFrz c:deihnr:st:z Error: %s %s)rrwz-cz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t�-rHr�r�zeditor-on-startupr�)r�ZIdle)Z className)rZIconsZWindowszidle.ico)r�g333333!@z.png)�� �0�z.gif)r�r�r�cs"g|]}tj��d|�f��qS)z idle_%d%s)r>r?r@)r��size)�ext�icondirr"r#r��szmain..cSsg|]}tt|d��qS))Zmasterr)Z PhotoImagerk)r��iconfiler"r"r#r��sZ IDLESTARTUPZ PYTHONSTARTUPzbif 1: import sys as _sys _sys.argv = %r del _sys )T)H�getoptrSr~r�rr�r(r r��argv�errorr�� usage_msgr��exitr�rr>r?rrr�rOr�rrxrtr rR�dirnamerW�getcwdr r�Z NoDefaultRootr0rkr1� idlelib.runrr@�__file__Z wm_iconbitmapZisAquaTk� TkVersionZ wm_iconphotorr}r�r<ZsetupApprer\�newr=�dictr��lowerrSrK�environrZrTrr�rrZtkVersionWarningrtZpreferTabsPreferenceWarningZ inversedictrYZdestroy)r�r~rr�Z enable_shellZ enable_editrU�cmdZscriptZstartupZoptsrDr�o�ar�Zpathxr �dirZ edit_startrr�ZsizesZ iconfilesZiconsr'ZtkversionwarningZprefer_tabs_preference_warningr")r�r�r#r�ms                                      r�F)NN)Pr�r|r�rU� ImportErrorr�r�r"rSZctypesZPROCESS_SYSTEM_DPI_AWAREZOleDLLZSetProcessDpiAwarenessrrZtkinter.messageboxZ messageboxrlr�r0rkr1r�rrmrr r*r>Zos.pathr rhr�r��textwrapr r�r�rr&Zidlelib.colorizerr Zidlelib.configr r�rrZidlelib.editorrrZidlelib.filelistrZidlelib.outwinrrrrrZ idlelib.undorr�r�rr$r%r(� checkcacher1r2r�r�r�Z RPCClientr�r�r�r�r}r�r�r"r"r"r#�s�                  ?0m?6