Sindbad~EG File Manager
�
&Μg����ddlZedk(rejdejd< ddl�ejdk(r
dd l m
Z
e
�dd
lmZddlm
Z
ddlZddlZddlZddlZddlmZddlZddlZddlZdd
lmZddlZddlZddlZddlZddlmZddlmZddl m!Z!ddl"m#Z#ddl"m$Z$ddl%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl"m,Z,ddl"m-Z-ddl.m/Z/m0Z0m1Z1ddl2m3Z3da4dZ5dZ6 dZ7e7e8_7e7e9_7eja; d5d�Z<da=d�Z>e>d�dej~fd �Z@e@e_?Gd!�d"e&�ZAGd#�d$e)�ZBGd%�d&e�ZCGd'�d(e3�ZDGd)�d*e!�ZEGd+�d,e-j��ZGd-�ZHGd.�d/e
�ZIGd0�d1e+�ZJd2�ZKd3ZLd4�ZMedk(reM�e>d�y#e$redej��ed��wxYw#e:$rY��wxYw)6�N�__main__zidlelib.pyshell)�*zJ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **��file��win32)�
fix_win_hidpi)�
messagebox)�InteractiveInterpreter)�python_version)�TextWrapper)�ColorDelegator)�idleConf)� Delegator��debugger)�
debugger_r)�EditorWindow�
fixwordbreaks)�FileList)�OutputWindow)�replace)�rpc)�idle_formatwarning�StdInputFile�
StdOutputFile)�
UndoDelegatorFz 127.0.0.1zCtrl-D (end-of-file)c ��|�t} |jt|||||���|jd�y#ttf$rYywxYw)aShow Idle-format warning (after replacing warnings.showwarning).
The differences are the formatter called, the file=None replacement,
which can be None, the capture of the consequence AttributeError,
and the output of a hard-coded prompt.
N)�linez>>> )�warning_stream�writer�AttributeError�OSError)�message�category�filename�linenorrs �,/usr/local/lib/python3.12/idlelib/pyshell.py�idle_showwarningr)CsW���|���
��
�
�%���8�V�$�@� A��
�
�6����G�$�
��
�s�0;�A
�A
c��|r't� tjatt_yyt�tt_dayy)z>Replace warning.showwarning with idle_showwarning, or reverse.N)�_warnings_showwarning�warnings�showwarningr))�captures r(�capture_warningsr/VsA��� �(�$,�$8�$8�!�#3�H� �)�!�,�#8�H� �$(�!�-�Tc��tj}i}t|�D]%}|dd|ddzdk(s�|j|�||<�'||�|j |�y)aoExtend linecache.checkcache to preserve the <pyshell#...> entries
Rather than repeating the linecache code, patch it to save the
<pyshell#...> entries, call the original linecache.checkcache()
(skipping them), and then restore the saved entries.
orig_checkcache is bound at definition time to the original
method, allowing it to be patched.
Nr����<>)� linecache�cache�list�pop�update)r&�orig_checkcacher5�save�keys r(�extended_linecache_checkcacher<es`��
�O�O�E�
�D��E�{���r��7�S���X���%�� � �#��D��I���H�� �L�L��r0c�`�eZdZdZd�Zgd�Zdd�Zd�Zdd�Zdd�Z d �Z
d
�Zd�Zd�Z
d
�Zd�Zy)�PyShellEditorWindowz6Regular text edit window in IDLE, supports breakpointsc�r�g|_tj|g|���|jj d|j
�|jj d|j�|jj d|jj�tjjtjd�|_|jj |fd�}|jj#|�|jj$r|j'�|j)�y)N�<<set-breakpoint>>�<<clear-breakpoint>>z<<open-python-shell>>zbreakpoints.lstc�2�|j�|�y�N)�restore_file_breaks)�old_hook�selfs r(�filename_changed_hookz;PyShellEditorWindow.__init__.<locals>.filename_changed_hook�s���$�$�&��Jr0)�breakpointsr�__init__�text�bind�set_breakpoint_event�clear_breakpoint_event�flist�
open_shell�os�path�joinr�userdir�breakpointPath�io�filename_change_hook�set_filename_change_hookr&rD�color_breakpoint_text)rF�argsrGs r(rIzPyShellEditorWindow.__init__s���������d�*�T�*�� � ���+�T�-F�-F�G�� � ���-�t�/J�/J�K�� � ���.��
�
�0E�0E�F�!�g�g�l�l�� � �"3�5���,0�7�7�+G�+G�'+� �
���(�(�)>�?��7�7����$�$�&��"�"�$r0))�Cutz<<cut>>�rmenu_check_cut)�Copyz<<copy>>�rmenu_check_copy)�Pastez <<paste>>�rmenu_check_paste)NNN)zSet Breakpointr@N)zClear BreakpointrANc��|j�y|r+tj�}tj|d�}nddd�}|jjd|�y)z,Turn colorizing of breakpoint text on or offN�break�)�
foreground�
background�BREAK)rUr�CurrentTheme�GetHighlightrJ�
tag_config)rF�color�theme�cfgs r(rXz)PyShellEditorWindow.color_breakpoint_text�sO���7�7�?����)�)�+�E��'�'��w�7�C�!#�2�6�C�� � ���W�c�*r0c��|j}|jj}|jdd|zd|dzz� |jj|� |jjjj}|j||�y#t$r|jj|�Y�dwxYw#YyxYw)Nrez%d.0r)
rJrUr&�tag_addrH�index�
ValueError�appendrN�pyshell�interpr�set_breakpoint)rFr'rJr&�debugs r(rsz"PyShellEditorWindow.set_breakpoint�s����y�y���7�7�#�#�����W�f�v�o�v����/B�C� ,����"�"�6�*� ��J�J�&�&�-�-�6�6�E�� � ��6�2�� � ,����#�#�F�+� ,��
��s�B�<C�$C�?C�CNc���|j}|jj}|s|j�yt t|j
d���}|j|�y)N�insert)rJrUr&�bell�int�floatrnrs)rF�eventrJr&r's r(rLz(PyShellEditorWindow.set_breakpoint_event�sO���y�y���7�7�#�#����I�I�K���U�4�:�:�h�/�0�1�����F�#r0c��|j}|jj}|s|j�yt t|j
d���} |jj|�|jddd� |jjjj}|j||�y#Y�UxYw#YyxYw)Nrvre�insert linestartzinsert lineend +1char)rJrUr&rwrxryrnrH�remove�
tag_removerNrqrrr�clear_breakpoint)rFrzrJr&r'rts r(rMz*PyShellEditorWindow.clear_breakpoint_event�s����y�y���7�7�#�#����I�I�K���U�4�:�:�h�/�0�1�� ����#�#�F�+�
����!3�/� 1� ��J�J�&�&�-�-�6�6�E��"�"�8�V�4��
��� ��s�C� <C
�C
�
Cc�J�|jr�|j}|jj}|s|j �yg|_|jddt� |jjjj}|j|�yy#YyxYw)Nre�1.0)rHrJrUr&rwr~�ENDrNrqrrr�clear_file_breaks)rFrJr&rts r(r�z%PyShellEditorWindow.clear_file_breaks�s�������9�9�D��w�w�'�'�H��� � ���!�D���O�O�G�U�C�0�
��
�
�*�*�1�1�:�:���'�'��1���
��s�!;B�B"c��|j}|jj} t|j�5}|j�}ddd� t|jd�5}D](}|j|dz�r�|j|��*|j�|j}|r#|j|dzt|�zdz�ddd�y#1swY��xYw#t$rg}Y��wxYw#1swYyxYw#t$re}t|jdd�sDd|j_
tjdd t|�z|j �
�Yd}~yYd}~yd}~wwxYw)z#Save breakpoints when file is savedN�w�=�
�breakpoint_error_displayedFTz
IDLE Errorz$Unable to update breakpoint list:
%s)�titler$�parent)rHrUr&�openrT� readlinesr#�
startswithr!�update_breakpoints�str�getattr�rootr�r
� showerrorrJ)rF�breaksr&�fp�lines�new_filer�errs r(�store_file_breaksz%PyShellEditorWindow.store_file_breaks�sF��$�!�!���7�7�#�#�� ��d�)�)�*�b������+� &��d�)�)�3�/�8�!�D��?�?�8�c�>�:� ���t�,�"��'�'�)��)�)����N�N�8�c�>�C��K�#?�$�#F�G�0�/�+�*��� ��E� ��0�/��� &��4�9�9�&B�E�J�7;�� � �4��$�$�<�C��c�(�#��9�9�&�&�K�� &�sf�C-�C!�
C-�D
�)C>�AC>�D
�!C*�&C-�-C;�:C;�>D�D
�D
�
E8�AE3�3E8c���|jj�|j�y|jj}|�ytj
j
|j�r}t|j�5}|j�}ddd�D]I}|j|dz�s�t|t|�dzd�}|D]}|j|���Kyy#1swY�YxYw)Nr�r)rJr8rUr&rPrQ�isfilerTr�r�r��eval�lenrs)rFr&r�r�r�breakpoint_linenumbers�breakpoint_linenumbers r(rDz'PyShellEditorWindow.restore_file_breakss���� � �����7�7�?���7�7�#�#�����
�7�7�>�>�$�-�-�.��d�)�)�*�b������+����?�?�8�c�>�2�-1�$�s�8�}�Q��7G�2H�-I�*�1G�-��+�+�,A�B�2H��/�*�*�s�?C(�(C1c�n�|j}|jd�}|j|�}||_y)z3Retrieves all the breakpoints in the current windowreN)rJ�
tag_ranges�ranges_to_linenumbersrH)rFrJ�ranges�linenumber_lists r(r�z&PyShellEditorWindow.update_breakpointss1���y�y������)���4�4�V�<��*��r0c��g}tdt|�d�D]i}tt||j��}tt||dzj��}||ks�N|j|�|dz
}||kr��k|S)Nr�r)�ranger�rxry�stringrp)rFr�r�rnr'�ends r(r�z)PyShellEditorWindow.ranges_to_linenumbers#s������1�c�&�k�1�-�E���v�e�}�3�3�4�5�F��e�F�5��7�O�2�2�3�4�C��3�,����V�$��!����3�,�.��r0c�N�|j�tj|�y)z7Extend base method - clear breaks when module is closedN)r�r�_close�rFs r(r�zPyShellEditorWindow._close4s����� ����D�!r0)TrC)�__name__�
__module__�__qualname__�__doc__rI�rmenu_specsrXrsrLrMr�r�rDr�r�r��r0r(r>r>|sE��<�%�(�K�
+��$��&
�(&�TC�"+��""r0r>c� �eZdZdZeZdZdd�Zy)�PyShellFileListz8Extend base class: IDLE supports a shell and breakpointsNc��|jr0|jjj�|jSt|�|_|jr|jj �sy|jSrC)rq�top�wakeup�PyShell�begin�rFrzs r(rOzPyShellFileList.open_shellCs\���<�<��L�L���#�#�%��|�|�� #�4�=�D�L��|�|��|�|�)�)�+���|�|�r0rC)r�r�r�r�r>rrqrOr�r0r(r�r�:s��>�'�L��G�r0r�c��eZdZdZd�Zd�Zy)�ModifiedColorDelegatorz8Extend base class: colorizer for the shell window itselfc�z�|jddd�|jddd�tj|�y)N�TODOr��iomark�SYNC)r~rmr�recolorize_mainr�s r(r�z&ModifiedColorDelegator.recolorize_mainPs0�������x�0����V�U�H�-��&�&�t�,r0c�L�|jD]}|j|dd��y)Nr�r�)�tagdefsr~)rF�tags r(�removecolorsz#ModifiedColorDelegator.removecolorsUs ���<�<�C��O�O�C��5�1� r0N)r�r�r�r�r�r�r�r0r(r�r�Ns��>�-�
2r0r�c�2��eZdZdZdd�Zdd�Z�fd�Z�xZS)�ModifiedUndoDelegatorz;Extend base class: forbid insert/delete before the I/O markc��� |jj|dd�r|jj�y t j
||||�y#t$rY�$wxYw�N�<r�)�delegate�comparerw�TclErrorrrv�rFrn�chars�tagss r(rvzModifiedUndoDelegator.insert]s_�� ��}�}�$�$�U�C��:��
�
�"�"�$��;�
���T�5�%��6��� �� �s�7A� A �A c��� |jj|dd�r|jj�y t j
|||�y#t$rY�#wxYwr�)r�r�rwr�r�delete)rF�index1�index2s r(r�zModifiedUndoDelegator.deletefs]�� ��}�}�$�$�V�S�(�;��
�
�"�"�$��<�
���T�6�6�2��� �� �s�7A� A�Ac�����|jj��fd�|j_ t�|�
|��|j_y#�|j_wxYw)Nc����||d�S�N�stdinr�)rnr��orig_inserts �r(�<lambda>z2ModifiedUndoDelegator.undo_event.<locals>.<lambda>vs����U�E�7�!Cr0)r�rv�super�
undo_event)rFrzr�� __class__s @�r(r�z ModifiedUndoDelegator.undo_eventosN���
�m�m�*�*��C�
�
�
�� /��G��u�%�#.�D�M�M� ��;�D�M�M� �s�A�A"rC)r�r�r�r�rvr�r��
__classcell__�r�s@r(r�r�[s���A�7�3�/�/r0r�c��eZdZdZdd�Zy)�UserInputTaggingDelegatorz.Delegator used to tag user input with "stdin".Nc�F�|�d}|jj|||�yr�)r�rvr�s r(rvz UserInputTaggingDelegator.inserts"���<��D��
�
���U�E�4�0r0rC)r�r�r�r�rvr�r0r(r�r�}s
��8�1r0r�c��eZdZd�Zy)�MyRPCClientc��t�)z0Override the base class - just re-raise EOFError)�EOFErrorr�s r(�
handle_EOFzMyRPCClient.handle_EOF�s���r0N)r�r�r�r�r�r0r(r�r��s��r0r�c��d|xsd�d�}|t|�k\r,t|t|�z
d�\}}||zdz�|�|dz��S|ddS)z�Return width long restart line formatted with filename.
Fill line with balanced '='s, with any extras and at least one at
the beginning. Do not end with a trailing space.
z= RESTART: �Shellz =r�r�N���)r��divmod)�widthr&r��div�mods r(�restart_liner��sf��
��+�G�,�B�
/�C���C����5�#�c�(�?�Q�/���S��s�7�C�-����c�#�g�Y�/�/��3�B�x�r0c���eZdZd�ZdZdZdZd�Zd�Zd�Z d d�Z
d�Zd�Zd �Z
d
�Zd!d�ZdZd�ZdZd
�Zd�Zd�Zd�ZdZd�Zd"d�Zd�Zd�Zd�Zd"d�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%y)#�ModifiedInterpreterc��||_tjdj}t j
||��d|_d|_t|_ |jjj|_
y)Nr)�localsF)� tkconsole�sys�modules�__dict__rrI�
restarting�subprocess_arglist�PORT�port�compile�compiler�flags�original_compiler_flags)rFr�r�s r(rIzModifiedInterpreter.__init__�s[��"������Z�(�1�1���'�'��V�<����"&����� �'+�|�|�'<�'<�'B�'B��$r0Nc��|j�|j�|_tj|j�|_yrC)r��build_subprocess_arglist�
subprocess�Popen�
rpcsubprocr�s r(�spawn_subprocessz$ModifiedInterpreter.spawn_subprocess�s7���"�"�*�&*�&C�&C�&E�D�#�$�*�*�4�+B�+B�C��r0c��|jdk7sJd��tjD�cgc]}d|z�� }}tjddddd� �}d
|�d�}tj
g|zd|t
|j�gzScc}w)
Nrz/Socket should have been assigned a port number.z-W�main�Generalzdelete-exitfuncF�bool)�default�typez#__import__('idlelib.run').run.main(�)�-c)r�r��warnoptionsr� GetOption�
executabler�)rF�sr�� del_exitf�commands r(rz,ModifiedInterpreter.build_subprocess_arglist�s���� � �1�� ?�=� ?��"���/��!�T�A�X���/��&�&�v�y�:K�/4�6�C� �7� �}�A�F������!�#�t�W�c�$�)�)�n�&E�E�E��
0s�Bc�D�t|jf}td�D])}tj|� t|�|_n|j�y|jjj�d|_tdk7rC|jjjtjtjd�|j!�|jjj#d� |jj%�|jj+d|j,�|jj+d|j,j.�|jj+d|j,j0�|jj+d|j,j2�|jj+d |j,j4�|jj+d
t6�|jj+d|�|j9d�
�|j;�|jS#t$rY��awxYw#t&$r|j)�YywxYw)N�rr�
�consoler��stdout�stderrrNr4rrT��with_cwd)�HOSTr�r��time�sleepr��rpccltr#�display_port_binding_error�listening_sock�getsocknamer��
setsockopt�socket�
SOL_SOCKET�SO_REUSEADDRr�
settimeout�accept�TimeoutError�display_no_subprocess_error�registerr�r�rrrNr4�
transfer_path�poll_subprocess)rF�addr�is r(�start_subprocessz$ModifiedInterpreter.start_subprocess�s����d�i�i� ���q��A��J�J�q�M�
�)�$�/���� �
�+�+�-���K�K�.�.�:�:�<�Q�?�� ��1�9�
�K�K�&�&�1�1�&�2C�2C�+1�+>�+>��
C�����
���"�"�-�-�b�1� ��K�K��� �
�����Y����7������W�d�n�n�&:�&:�;������X�t�~�~�'<�'<�=������X�t�~�~�'<�'<�=������W�d�n�n�&:�&:�;������[�)�4������X�t�,����D��)������{�{���C�
��
��*� ��,�,�.�� �s#�I3� J�3 J�?J�J�Jc�(�|jr|jSd|_|j�}|r tj|j�|jj�|j
�|j}|j}d|_|j� |jj�|j|��|j�|jj!dd�|j#d�|j#t%|j&|��|jj)dd�|jj+dd�|s|j-�|r/tj.|j�|j1�|j2|j4j6_d|_|jS#Y���xYw#t$r|j�YywxYw) NTFrr��end-1cr��restart�left)r�r�getdebuggerr�close_subprocess_debugger�close�terminate_subprocessr�� executingrr'r(r)r+�
stop_readlinerJr�r!r�r��mark_set�mark_gravity�
showprompt�restart_subprocess_debugger�load_breakpointsr�r�r�r�)rFrr&rtr�
was_executings r(�restart_subprocessz&ModifiedInterpreter.restart_subprocess�s����?�?��;�;������ � �"���
��4�4�T�[�[�A�
�������!�!�#��.�.���)�)�
�!������� ��K�K��� �
���H��-����������H�h�/��
�
�d���
�
�l�7�=�=�(�;�<������i��2����!�!�)�V�4����� ���2�2�4�;�;�?��"�"�$�&*�&B�&B������#�����{�{���A
���� ��,�,�.�� �s�G-�,G5�-G2�5H�Hc�@�|jjdddi�y)N�exec�interrupt_the_serverr�)r�
remotecallr�s r(�__request_interruptz'ModifiedInterpreter.__request_interrupts�������v�'=�r�2�Fr0c�`�tj|j��j�y)N)�target)� threading�Thread�'_ModifiedInterpreter__request_interrupt�startr�s r(�interrupt_subprocessz(ModifiedInterpreter.interrupt_subprocesss������ 8� 8�9�?�?�Ar0c��|j�/|jjj|j� |jj
j
� |jj
�|j�d|j_ d|_y#t$rY�OwxYw#t$rY�CwxYw)NF)
�_afteridr�rJ�after_cancelrr r6r"r7r8r�s r(�kill_subprocessz#ModifiedInterpreter.kill_subprocesss����=�=�$��N�N���,�,�T�]�]�;� ��K�K�&�&�,�,�.� ��K�K����
�!�!�#�#(���� ������ �� ��� �� �s#�$B%�"B4�% B1�0B1�4 C�?Cc�� |jj� |jj�y#t$rYywxYw#t$rYywxYw)z"Make sure subprocess is terminatedN)r�kill�waitr#r�s r(r7z(ModifiedInterpreter.terminate_subprocess%sQ�� ��O�O� � �"�
����$�$�&���
��
��
� �� �s �A�8� A�A� A�Ac��|r#dg}|jtj�ntj}|jdj |��y)NrbzTif 1:
import sys as _sys
_sys.path = {!r}
del _sys
)�extendr�rQ�
runcommand�format)rFrrQs r(r+z!ModifiedInterpreter.transfer_path2sA����4�D��K�K����!��8�8�D������f�T�l� r0c�x�|j}|�y |j|jd��}|r�|jj�d|_|\}}|jj}|dk(r|�ytt|�|��nb|dk(r,|jjd�rB|j�n1|dk(r,d}t||tj ��t|||�� |jj#�|jjsJ|jj&j)|jj*|j,�|_yy#ttt
f$r.|jjrYyd}|j�Y��{wxYw#t$$rY��wxYw) Ng�������?)rS�OKr� EXCEPTION�<<toggle-jit-stack-viewer>>�ERRORz/pyshell.ModifiedInterpreter: Subprocess ERROR:
)r�pollresponse�
active_seqr�r#�KeyboardInterruptr��closingr@�resetoutputr�print�repr�getvar�remote_stack_viewerr��
__stderr__�endexecutingr"rJ�after�pollintervalr,rN)rF�clt�response�how�whatr�errmsgs r(r,z#ModifiedInterpreter.poll_subprocessAsy���k�k���;�� &��'�'����d�'�C�H���N�N�&�&�(�"�D�O� �I�C���n�n�,�,�G��d�{��#��$�t�*�7�3���#��>�>�(�(�)F�G��,�,�.����K���f�d����8��f�d��1�
����+�+�-��~�~�%�%� �N�N�/�/�5�5����+�+�T�-A�-A�C�D�M�&��9�'�#4�5� &��~�~�%�%���H��#�#�%�
&��2"�
��
�s)�E(�-F-�(*F*�F*�)F*�- F9�8F9c��||_yrCr)rFrs r(�setdebuggerzModifiedInterpreter.setdebuggeris �� ��
r0c��|jSrCrr�s r(r4zModifiedInterpreter.getdebuggerls���}�}�r0c�d�|jjjd|j�y)a�Initiate the remote stack viewer from a separate thread.
This method is called from the subprocess, and by returning from this
method we allow the subprocess to unblock. After a bit the shell
requests the subprocess to open the remote stack viewer which returns a
static object looking at the last exception. It is queried through
the RPC mechanism.
i,N)r�rJrhrer�s r(�open_remote_stack_viewerz,ModifiedInterpreter.open_remote_stack_vieweros'��
�����!�!�#�t�'?�'?�@�r0c��ddlm}|jjdddi�}|�%|jj
j
�y|j|j|�}ddlm }m
}t|jj
�}tj�}tj|d�d}|||d� �} | jj!d
d��|| j"d|�}
|
j%�y)
Nr)�
debugobj_rrB�stackviewer)rN)�ScrolledCanvas�TreeNode�normalrd)�bg�highlightthicknessr�both)�expand�fill)�idlelibrur�remotequeuer�r�rw�StubObjectTreeItem�idlelib.treerwrx�Toplevelrrfrg�frame�pack�canvasr})rFru�oid�itemrwrxr�rjrd�sc�nodes r(rez'ModifiedInterpreter.remote_stack_viewer|s���&��k�k�%�%�f�m�Z��L���;��N�N���$�$�&���,�,�T�[�[�#�>��9��t�~�~�*�*�+���%�%�'���*�*�5�(�;�L�I�
�
�C�J�1�
E��
���
�
�Q�V�
�,��� � �4��.�����
r0rc�J�|j|�}|j||�y)z1Like runsource() but assumes complete exec sourceN)�stuffsource�execfile�rF�sourcer&s r(�
execsourcezModifiedInterpreter.execsource�s ���#�#�F�+���
�
�h��'r0c��|�]tj|�5}|j�}tr)dtj
j
|��d�|zdz}ddd� t||d�}|j|�y#1swY�)xYw#ttf$rn|jj�td|jj��tj ||�|jj#�YywxYw)zExecute an existing fileNz__file__ = r'''z'''
z
del __file__rBzB*** Error in script or command!
Traceback (most recent call last):r)�tokenizer��read�use_subprocessrPrQ�abspathr��runcode�
OverflowError�SyntaxErrorr�rarbrr�showsyntaxerrorr<)rFr&r�r��codes r(r�zModifiedInterpreter.execfile�s����>����x�(�B������!� /�������0I�/J�%�P� &�'�)9�:�F�)�
��6�8�V�4�D�
�L�L���)�(���{�+� (��N�N�&�&�(��6��~�~�,�,�
.�
#�2�2�4��B��N�N�%�%�'�
(�s�AB�!
B�B �A:D �D c�v�|j|�}t|t�sJ�tj|||�S)zBExtend base class method: Stuff the source in the line cache first)r��
isinstancer�r� runsourcer�s r(r�zModifiedInterpreter.runsource�s9���#�#�F�+���&�#�&�&�&�&�/�/��f�h�G�Gr0c��d|jz}|jdz|_|jd�}t|�dzd||ftj|<|S)z"Stuff source in the filename cachez<pyshell#%d>rr�r)�gid�splitr�r4r5)rFr�r&r�s r(r�zModifiedInterpreter.stuffsource�sQ��!�D�H�H�,���8�8�a�<������T�"��$'��K��M�1�e�X�$E� ����!��r0c�D�|jdj|��y)z>Prepend sys.path with file's directory if not already includeda*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
N)rVrW�rFr&s r(�prepend_syspathz#ModifiedInterpreter.prepend_syspath�s�������&��"� $r0c���|j}|j}|jddd�tj�\}}}t|dd�xs|xsd}t|dd�xsd} t|d d�xsd
}
|
d
k(r| dz
} | dk(r d|
dz
z}n
d| dz
|
dz
fz}|j
||�|j�|jd
|z�|j�y)z�Override Interactive Interpreter method: Use Colorizing
Color the offending position instead of printing it and pointing at it
with a caret.
r\r�r��msgrbz<no detail available>r'r�offsetrziomark + %d charsz&iomark linestart + %d lines + %d charszSyntaxError: %s
N)
r�rJr~r��exc_infor��colorize_syntax_errorrar!r<)rFr&�kwargsr�rJr
�value�tbr�r'r��poss r(r�z#ModifiedInterpreter.showsyntaxerror�s����N�N� ��~�~��������.��,�,�.���e�R��e�U�B�'�K�5�K�4K�����"�-�2������"�-�2����Q�;��a�K�F��Q�;�%����2�C�:��!�8�V�A�X�&�'�C��'�'��c�2������
�
�&��,�-����r0c���|jj�|j�tj|�|jjd�r|jj
�yy)z1Extend base class method to reset output properlyr[N)r�ra�checklinecacher�
showtracebackrd�open_stack_viewerr�s r(r�z!ModifiedInterpreter.showtraceback�sU�����"�"�$������,�,�T�2��>�>� � �!>�?��N�N�,�,�.�@r0c�h�tj}t|�D]}|dd|ddzdk7s�||=�y)z%Remove keys other than '<pyshell#n>'.Nrr2r3)r4r5r6)rFr5r;s r(r�z"ModifiedInterpreter.checklinecache�s9��������;�C��2�A�w��R�S��!�T�)��#�J�r0c���|jjr|j�y|jr |jj dd|fi�yt||j�y)z*Run the code without invoking the debuggerrrBr�r)r�r8�display_executing_dialogrr�rBr�)rFr�s r(rVzModifiedInterpreter.runcommand�sY���>�>�#�#��)�)�+���;�;��K�K�#�#�F�I��w��C��
��t�{�{�#�r0c��|jjr|j�|j�|j} |jj�|s1|j�%|jjdd|fi�|_n6|r|j||j�nt||j�t$s |jj+�yy#t$rY|jjs?tjddd|jj ��r�|j#�n�Y��t$rLt'd|jj(� �|j#�|jj+�nY|jj,r3d
|j_t'd|jj(� �n|j#�Y��3xYw#t.$rYywxYw#t$s+ |jj+�w#t.$rYwwxYwwxYw)�Override base class methodNrBr�zExit?zDo you want to exit altogether?�yes�r r�z IDLE internal error in runcode()rFr_)r�r8r@r�r�beginexecutingr�
asyncqueuer^�runr�rB�
SystemExitr`r
�askyesnorJr�r�rbrrg�canceledr")rFr�rs r(r�zModifiedInterpreter.runcode�s����>�>�#�#��#�#�%������=�=��& ��N�N�)�)�+����� 7�"&�+�+�"8�"8���9=���#E��������T�4�;�;�/��T�4�;�;�'�4"���N�N�/�/�1�"��3� ��>�>�)�)��&�&��5�!��>�>�.�.� 0�
��&�&�(��)� )���8��>�>�0�0�2��"�"�$����+�+�-��>�>�*�*�.3�D�N�N�+��-�D�N�N�4I�4I�J��&�&�(��
&�����"���N�N�/�/�1��%�����"�s]�BC*�G=�*AG:� H�B,G:�7H�= H �H �H?�H/�.H?�/ H;�8H?�:H;�;H?c�L�|jjj|�S)r�)r�rr!)rFrs r(r!zModifiedInterpreter.write(s���~�~�$�$�*�*�1�-�-r0c�\�tjdd|jj��y)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��r
r�r�rJr�s r(rz.ModifiedInterpreter.display_port_binding_error,s'����� �
/��>�>�&�&� (r0c�\�tjdd|jj��y)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-failurer�r�r�s r(r)z/ModifiedInterpreter.display_no_subprocess_error7s(�����)�
J��>�>�&�&� (r0c�\�tjdd|jj��y)NzAlready executingzYThe Python Shell window is already executing a command; please wait until it is finished.r�r�r�s r(r�z,ModifiedInterpreter.display_executing_dialog?s%������
0��>�>�&�&� (r0)Frb)FrC)&r�r�r�rIrNrrrrr/r@rJrLrPr7r+r^r,rrpr4rsrer�r�r�r�r�r�r�r�r�rVr�r!rr)r�r�r0r(r�r��s���C��H�
�F��J�D�
F�)�V*�XG�B�
����J�$C�L�H�!����"�C�(�
�(H��
$��4/��
�,�\.� (�(�(r0r�c �P��eZdZddlmZde�zZeZe Z
gd�ZejdgzZ
deeej"d�e
���zZe
j'ed�[d Zd
ZddlmZddlmZd9d
�Z�fd�Z�fd�Zd�Zd�Zd�Zd9d�Z d Z!d Z"d Z#d Z$d Z%d Z&d�Z'd�Z(d9d�Z)d�Z*d9d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d �Z3d!�Z4d"Z5d#�Z6d$�Z7d%�Z8d&�Z9d9d'�Z:d(�Z;d)�Z<d*�Z=d+�Z>e?j�d,�ZAd-�ZBd9d.�ZCd9d/�ZDd9d0�ZEd1�ZFd2�ZGd3�ZHd:d4�ZI�fd5�ZJ�fd6�ZKd9d7�ZLd8�ZM�xZNS);r�r)�SqueezerzIDLE Shell ))r�_File)�edit�_Edit)rt�_Debug)�options�_Options)�window�_Window)�help�_Help)�Squeeze�<<squeeze-current-text>>rc��|ddk7S)Nrr\r�)�
rmenu_items r(r�zPyShell.<lambda>_s
��:�a�=�F�2r0)zCopy with prompts�<<copy-with-prompts>>r]Fr�)�History)�ShellSidebarc��tr)|j}|dddk7r|jdd�t|�|_|�0t�}t
|�|j�t|�}d|_ tj||dd�d|_d|_
ttd�rtj nd|_|j"j%d �d
|_|j"|_|j*}|j-d��|j/d
|j0�|j/d|j2�|j/d|j4�|j/d|j6�|j/d|j8�|j/d|j:�|j/d|j<�|j/d|j>�tr8|j/d|j@�|j/d|jB�|jE|�|_#|j/d|jH�tjJ|_&tjN|_(tjR|_*ddl+m,}t[|d|j\|j^�|_)ta|d|j\|j^�|_%ta|d|j\d�|_'ta|d|j\|j^�|_1ts?|jJt_%|jNt_'|jRt_) ddl2}|jf|_4|jm|j*�|_7d|_8|js|�|_ |jtjvj|j*_|jtjyt{��y#tjjt_'�xYw)Nr�r�shell)r��She_llF��ps1z>>>
r�r2�char)�wrapz<<newline-and-indent>>z<<plain-newline-and-indent>>z<<interrupt-execution>>z<<end-of-file>>z<<open-stack-viewer>>�<<toggle-debugger>>r[r�z<<view-restart>>z<<restart-shell>>r�)�iomenur�rr�backslashreplacer�2)>r��
menu_specsrvr�rr�Tkr�withdrawr��
shell_sidebarrrI�usetabs�indentwidth�hasattrr�r��sys_ps1r��prompt_last_line�promptrJ� configurerK�enter_callback�linefeed_callback�cancel_callback�eof_callbackr��toggle_debugger�toggle_jit_stack_viewer�copy_with_prompts_callback�view_restart_mark�
restart_shellr��squeezer�squeeze_current_text_eventr�save_stdoutr�save_stderrr��
save_stdinrr�r�encoding�errorsrr�pydoc�
plainpager�pagerrfr��historyrir��perr��insertfilterr�)rFrN�msr�rJr�r�s r(rIzPyShell.__init__ms*������B��!�u�Q�x�7�"�� � �!�0�1�)�$�/����=��4�D��$���M�M�O�#�D�)�E�!������d�E�4��6�������")�#�u�"5�s�w�w�7��� $��� 2� 2�4� 8�� <����l�l����y�y�����F��#�� � �*�D�,?�,?�@�� � �0�$�2H�2H�I�� � �+�T�-A�-A�B�� � �#�T�%6�%6�7�� � �)�4�+A�+A�B�� � �'��)=�)=�>�� � �/��1M�1M�N�� � �)�4�+J�+J�K���I�I�(�$�*@�*@�A��I�I�)�4�+=�+=�>��
�
�d�+��
�� � �,��1�1� 3��:�:����:�:����)�)���"�!�$��"(�/�/�6�=�=�B��
�#�D�(�$*�O�O�V�]�]�D���#�D�(�$*�O�O�5G�I���$�T�9�%+�_�_�f�m�m�E�������C�J����C�J��
�
�C�I� ���*�*�E�K�
�|�|�D�I�I�.������!�.�.�t�4���
�8�8�<�<�.�.�� � �������7�9�:�� ����C�J��s�P*�*Qc�p��t�|��|j�|jj�yyrC)r�� ResetFontr��update_font�rFr�s �r(rzPyShell.ResetFont�s1���
�������)����*�*�,�*r0c���t�|��tj�}ddd�tj|d�tj|d�tj|d�d�}|j�D]"\}}|jj|fi|���$|j�|jj�yy)N)rdrcrrry)r�rrr)
r��ResetColorizerrrfrg�itemsrJ�
tag_configurer��
update_colors)rFrj�
tag_colorsr��tag_colors_configr�s �r(r zPyShell.ResetColorizer�s����
��� ��%�%�'��"&�d�;��)�)�%��:��)�)�%��:��*�*�5�(�;�
�
�'1�&6�&6�&8�"�C�"�#�D�I�I�#�#�C�=�+<�=�'9����)����,�,�.�*r0c�F�tj|jd��y)Nr�)�insert_tagsra)rrJr�s r(�
replace_eventzPyShell.replace_event�s������ � �w�7�r0c�.�tjd��S)NT)�
shell_only)r�
GetExtensionsr�s r(�get_standard_extension_namesz$PyShell.get_standard_extension_names�s���%�%��6�6r0c�n�|jj||�}ttt |��tt |���}|D�cgc]'}|j
jj|���)}}djd�t||j��D��dzScc}w)z6Return text between first and last with prompts added.r�c3�8K�|]\}}|�|n|�d|�����y�w)N� r�)�.0r�rs r(� <genexpr>z*PyShell.get_prompt_text.<locals>.<genexpr>�s0����
� ?�����N�D�6�(�!�D�6�(:�:� ?�s�)
rJ�getr�rxryr��line_promptsrR�zip�
splitlines)rF�first�lastrJ�lineno_ranger'�promptss r(�get_prompt_textzPyShell.get_prompt_text�s����y�y�}�}�U�D�)�����e�����d�����'�
�&��
���+�+�/�/��7�&� �
��y�y�
� #�G�T�_�_�->� ?�
�
�
�� ��
s�,B2c��|j}|jd�}|�y|jd�}|ddk7r|jd�}|j�|j||�}|j |�y)aCopy selected lines to the clipboard, with prompts.
This makes the copied text useful for doc-tests and interactive
shell code examples.
This always copies entire lines, even if only part of the first
and/or last lines is selected.
zsel.first linestartN�sel.lastr2�0zsel.last+1line linestart)rJrn�clipboard_clearr#�clipboard_append)rFrzrJ�selfirst�sellast�prompt_texts r(r�z"PyShell.copy_with_prompts_callback�sz���y�y���:�:�3�4������*�*�Z�(���2�;�#���j�j�!;�<�G������*�*�8�W�=�����k�*r0c��|ayrC�r )rF�streams r(�set_warning_streamzPyShell.set_warning_streams���r0c��tSrCr-r�s r(�get_warning_streamzPyShell.get_warning_streams���r0c��|jr3tjdd|j��|j �y|j
j
�}|r|j�y|j�y)NzDon't debug nowz*You can only toggle the debugger when idler�ra) r8r
r�rJ�set_debugger_indicatorrrr4�close_debugger�
open_debugger)rFrz�dbs r(r�zPyShell.toggle_debuggersb���>�>�� � �!2�<��y�y�
"�
�'�'�)�����(�(�*�B���#�#�%��"�"�$r0c�`�|jj�}|jd|�y)Nr�)rrr4�setvar�rFr6s r(r3zPyShell.set_debugger_indicators'��
�[�[�
$�
$�
&�����)�2�v�:�6r0c��yrCr�r�s r(r�zPyShell.toggle_jit_stack_viewers��r0c���|jj�}|r�|jjd�|j�|jjr)tj|jj�|j�|jjd�|j|_|j�|j�y)Nz[DEBUG OFF]
)rrr4rpr6rr�close_remote_debuggerrarr!r�r�r<r3r9s r(r4zPyShell.close_debugger s���
�[�[�
$�
$�
&��
��K�K�#�#�D�)��H�H�J��{�{�!�!��0�0����1C�1C�D������L�L����/��,�,�D�K��O�O���#�#�%r0c�n�|jjr+tj|jj|�}nt j
|�}|jj
|�|j�d|jz|_ |j�|j�y)Nz[DEBUG ON]
)rrrr�start_remote_debuggerr�Debuggerrpr>r�r�r<r3)rF�dbg_guis r(r5zPyShell.open_debugger-s����;�;��� �6�6�t�{�{�7I�7I�;?�A�G��'�'��-�G�������(�� � �"�$�t�|�|�3��������#�#�%r0c�J�|jrdnd}|jdd|�y)N�disabledryrtz*tack*iewer)r8�update_menu_state)rF�states r(�debug_menu_postcommandzPyShell.debug_menu_postcommand9s!��"�n�n�
�(�����w�
�u�=r0c�2�|j�d|_y)�Helper for ModifiedInterpreterTN)rar8r�s r(r�zPyShell.beginexecuting=s��������r0c�@�d|_d|_|j�y)rGFN)r8r�r<r�s r(rgzPyShell.endexecutingBs�������
����r0c���|jr(tjddd|j��}|dury|j �d|_d|_tj|�S)zExtend EditorWindow.close()zKill?z7Your program is still running!
Do you want to kill it?�okr�F�cancelT) r8r
�askokcancelrJr9r�r`rr6)rFrks r(r6z
PyShell.closeHsa���>�>�!�-�-��J���y�y� "�H�
�5� ��������
�����!�!�$�'�'r0c�X�|j�tr|jj�|jt
_|jt
_|jt
_
d|_d|_d|j_
d|_tj |�y)zEExtend EditorWindow._close(), shut down debugger and execution serverN)r4r�rrrPr�r�rr�rr�r�rrNrqrrr�r�s r(r�zPyShell._closeWsu��������K�K�'�'�)��%�%��
��%�%��
��O�O�� �������!��
�
��������D�!r0c��y)z8Override EditorWindow method: never remove the colorizerTr�r�s r(�ispythonsourcezPyShell.ispythonsourcegs��r0c��|jSrC)�shell_titler�s r(�short_titlezPyShell.short_titleks�����r0zHType "help", "copyright", "credits" or "license()" for more information.c
��|jjdd�|j�tr/d}|jj�}|s,|j
�yd}tjt_|jdtj�dtj�d|j�d|���|jj�|j�d dl}d
|_d|_y
)Nr�rvrbFz�==== 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 z on r�rT)rJr:rar�rrr/r6r�displayhookr�r!�version�platform� COPYRIGHT�focus_forcer<�tkinter�_support_default_root�
_default_root)rF�nosub�clientrYs r(r�z
PyShell.beginqs���� � ���8�X�.�������E��[�[�1�1�3�F���
�
���'�E�"�o�o�C�O��
�
��K�K����t�~�~�u�F� G�� � ���������(,��%� $���r0c�`�|jsyd|_|jj�y�NT)�reading�_stop_readline_flagr��quitr�s r(r9zPyShell.stop_readline�s!���|�|��#'�� ����
�
�r0c��|j} d|_|jj�||_|jrd|_y|jjdd�}t
|�dk(rd}|j�|jrd|_tst�|jr d|_d}|S#||_wxYw)NTFrbr�r1rr�)r`r��mainlooprarJrr�rar�r�r_� endoffile)rFr:rs r(�readlinezPyShell.readline�s����|�|�� ��D�L��H�H�����D�L��#�#�',�D�$���y�y�}�}�X�x�0���t�9��>��D������=�=�!�D�M�!�'�'��>�>�"�D�N��D���� �D�L�s�!B<�< Cc��yr_r�r�s r(�isattyzPyShell.isatty�s��r0c�D� |jjddd�ry |jsH|js<|j �|j
j
d�|j�yd|_d|_ |jre|j
jrO|j
j�r|j
j�n|j
j�|jr|jj�y#Y��xYw)N� sel.firstz!=r%zKeyboardInterrupt
raFT)rJr�r8r`rarrr!r<rer�rr4r@rLr�rbr�s r(r�zPyShell.cancel_callback�s��� ��y�y� � ��d�J�?��@����$�,�,������K�K���3�4��O�O��������
��N�N�t�{�{�1�1��{�{�&�&�(����.�.�0����0�0�2��<�<��H�H�M�M�O���! ��s�D�Dc�V�|jr
|jsy|jjddd�r|jjddd�sy|js!|j �|j�yd|_d|_|jj�y)Nr�z==rvr1FTra)
r8r`rJr�rar6r�rer�rbr�s r(r�zPyShell.eof_callback�s����>�>�$�,�,��� � �!�!�(�D�(�;�� � �!�!�(�D�(�;���~�~������J�J�L�
�"�D�M�!�D�N��H�H�M�M�O�r0c��|jr8|jjdd�|jjd�y|j |�y)Nrvr�ra)r`rJrv�see�newline_and_indent_eventr�s r(r�zPyShell.linefeed_callback�sE���<�<��I�I���X�t�,��I�I�M�M�(�#��
�)�)�%�0�r0c�r �|jr
|jsy |jjdd�}|r0|jj ddd�r|j||�y|jj ddd��r�|jj
d d�}|�r#|jj dd|d
��rd|jjd�vr�|jj
dd�}|r-|jj |d
d|d
�r
|d
|d
f}|jjdd�}|rI|jj |d
d|d
�r&|d
|jj|d
dz�f}|j|jj|d
|d
�|�y|jjd d�}|r�|jj dd|d
�r�|jjdd�}|rI|jj |d
d|d
�r&|d
|jj|d
dz�f}|j|jj|d
|d
�|�y|jjdd�}|rP|jj |d
dd�r0|j|jj|d
d�|�y|j|jjdd�|�y|jj ddd�r|jjdd�|jjdd�}|r,|j�s|jjdd�|jj ddd�r|j|�y|jjdd�|jr8|jjdd�|jjd�n|j|�|jj!�|jr|j"j%�y|j'�y#Y��MxYw)Nrjr%z<=r�rarvr��iomark linestartr�rrz>=rz+1czinsert lineendr|r1zend-1c linestartr�)r8r`rJrr��recall�
tag_prevrange� tag_names�
tag_nextrangernr:�stripr�rnrvrm�update_idletasksr�rb�runit) rFrz�sel�prev� prev_cons� next_cons�next�indicesrs r(r�zPyShell.enter_callback�s����>�>�$�,�,�� ��)�)�-�-��Z�8�C���9�9�$�$�Z��x�@��K�K��U�+�"��9�9���X�s�,>�?�
�9�9�*�*�7�H�=�D���I�I�%�%�h��T�!�W�=��T�Y�Y�%8�%8��%B�B� �I�I�3�3�I�x�H� �����!2�!2�9�Q�<��t�A�w�!O�%�a�L�$�q�'�2�D� �I�I�3�3�I�x�H� �����!2�!2�9�Q�<��d�1�g�!N� ��G�T�Y�Y�_�_�Y�q�\�E�5I�%J�K�D����D�I�I�M�M�$�q�'�4��7�;�U�C���9�9�*�*�7�H�=�D��� � �)�)�*:�D�$�q�'�J� �I�I�3�3�I�?O�P� �����!2�!2�9�Q�<��d�1�g�!N� ��G�T�Y�Y�_�_�Y�q�\�E�5I�%J�K�D����D�I�I�M�M�$�q�'�4��7�;�U�C���i�i�-�-�i�9K�L�G���y�y� � ����T�3E�F����D�I�I�M�M�'�!�*�6F�G��O�����D�I�I�M�M�*<�>N�O�QV�W���9�9���X�s�H�5��I�I���x��2�
�I�I�M�M�(�H�-���Q�W�W�Y��I�I���X�x�0��9�9���X�s�,>�?��)�)�%�0��� � ���8�X�.��<�<��I�I���X�t�,��I�I�M�M�(�#��)�)�%�0�� � �"�"�$��<�<��H�H�M�M�O��
�J�J�L���E ��s�A
R1�1R6c���tjdd|�}tjdd|�}|jd�}|jj � |jjddd�|jj
dd �|jjd
d�}|j�jd�r-|j|�|jjd
d�}|jjd|dj�|j�t|�d
kDr�tjd|d�j!d�}tjd|�j!d�}|d
dD]\}|j#|�r||t|�dz}|jjdd|j�z|j��^|jj%d�|jj'�y#|jj%d�|jj'�wxYw)Nz^\s*\nrbz\n\s*$r�rxr�r�rvr1r|�:rrz ^([ \t]*))�re�subr�rJ�undo_block_startr~r:r�rstrip�endswithrnrvru�user_input_insert_tagsr��search�groupr�rm�undo_block_stop)rFrrzr��prefix�orig_base_indent�new_base_indentrs r(rqzPyShell.recall(s����F�F�9�b�!�$���F�F�9�b�!�$������
��� � �"�"�$� (��I�I� � ���u�5��I�I���x��2��Y�Y�]�]�#5�x�@�F��}�}��'�'��,��-�-�e�4������'9�8�D���I�I���X�u�Q�x�~�~�'7�!�8�8�
:��5�z�A�~�#%�9�9�\�5��8�#D�#J�#J�1�#M� �#%�9�9�\�6�#B�#H�#H��#K��!�!�"�I�D����'7�8�.��c�:J�6K�6L�1M�M���I�I�$�$�X�t�d�k�k�m�/C�%)�%@�%@�B� &�
�I�I�M�M�(�#��I�I�%�%�'��
�I�I�M�M�(�#��I�I�%�%�'�s
�FH)�)7I z[ \t]*(\n[ \t]*)?\Zc��|jjd�}|jjdd�}|jj d|�}|j
j
|�}|s_|jj|�dk(r&|jj|j|�|jj�yy)N�end-2cr�r1rbr�)rJrnr�_last_newline_rer�rrr�r~r�r��update_sidebar)rF�index_beforer�input_is_completes r(rwz
PyShell.runitEs����y�y���x�0���y�y�}�}�X�x�0���$�$�(�(��T�2�� �K�K�1�1�$�7�� ��y�y�}�}�\�*�d�2�� � �$�$�T�%@�%@�,�O����-�-�/�!r0c��|jjr|jj�Sddlm} ||j
tj|j�y#tjdd|j��YyxYw)Nr)�StackBrowserzNo stack tracez:There is no stack trace yet.
(sys.last_exc is not defined)r�)rrrre�idlelib.stackviewerr�r�r��last_excrNr
r�rJ)rFrzr�s r(r�zPyShell.open_stack_viewerQsp���;�;����;�;�2�2�4�4�4� "�����C�L�L�$�*�*�=��� "�� � �!1�0��y�y�
"��s�,A%�%$Bc�p�|jjd�|jjd�y)Nr�r2)rJrmr�s r(r�zPyShell.view_restart_mark_s"��� � �
�
�h��� � �
�
�i� r0c�<�|jjd��y)z&Callback for Run/Restart Shell Cntl-F6TrN)rrr@r�s r(r�zPyShell.restart_shellcs�����&�&��&�5r0c���|j�|j}|jr4|j|j�r|dt |j�}|j
j
dd�|jj|�|jj�|j
jdd�|j�|jj�y)Nrz iomark-1crvr1)rar�r�r�r�rJrmrr!r�r�r:�set_line_and_columnrU�
reset_undo)rFr�s r(r<zPyShell.showpromptgs������������<�<�F�O�O�D�L�L�9��/�c�$�,�,�/�/�0�F�� � ���)�[�1������6�"����)�)�+�� � ���8�X�.�� � �"������r0c��|jjj}t|dd��}dj |j|��}|j
d�s|dz
}|jjjd|d�y)N�T)r��tabsize�expand_tabsr�rpr)
rrr�r�r
rRr�r�r�bottomrv)rFr�r��wrapper�wrapped_msgs r(�show_warningzPyShell.show_warninguso�����%�%�+�+���E�1�$�G���i�i����S� 1�2���#�#�D�)��4��K��������1�;��Ir0c��|jjdd�}|jr|jj|�|jjd�dk7r|jj dd�|jjdd�|j
�|jj�y)Nr�r1r�r�) rJrr�storervr:r��ctip�remove_calltip_window)rFr�s r(razPyShell.resetoutput}s��������x��2���<�<��L�L���v�&��9�9�=�=��"�d�*��I�I���X�t�,�� � ���8�X�.�� � �"�� � �'�'�)r0c��� |jjdd�tj|||d�}|jjdd�|jrd|_t
st�|S#�xYw)Nr��rightr3F)rJr;rr!r�r�r_)rFrr��counts r(r!z
PyShell.write�sm�� ��I�I�"�"�8�W�5� �&�&�t�Q��h�?�E��I�I�"�"�8�V�4��=�=�!�D�M�!�'�'���� ��s�AA3�3A6c�~�� |jjddd�ry t�|��S#t$rYywxYw)Nrjr�r�rB)rJr�r�r�r[rs �r(r[zPyShell.rmenu_check_cut�sJ��� ��y�y� � ��c�8�<�!�=��w�&�(�(��� �� �s�0� <�<c�\��|jjddd�ryt�|�
�S)Nrvr�r�rB)rJr�r�r_rs �r(r_zPyShell.rmenu_check_paste�s*����9�9���X�c�(�3���w�(�*�*r0c�l�|jj�|jj�yrC)r��squeeze_current_textr�r�r�s r(r�z"PyShell.squeeze_current_text_event�s$���
�
�*�*�,����)�)�+r0c�8�|jj�yrC)r�r�)rFrnrJr�s r(�on_squeezed_expandzPyShell.on_squeezed_expand�s�����)�)�+r0rC)r�)Or�r�r��idlelib.squeezerr�rrQr�rr�rr�rr�r�r6� itertools� takewhile�_idxrv�allow_line_numbersr��idlelib.historyr��idlelib.sidebarr�rIrr rrr#r�r`r8r�rer`rar/r1r�r3r�r4r5rEr�rgr6r�rOrRrWr�r9rfrhr�r�r�r�rqr�r�r�rwr�r�r�r<r�rar!r[r_r�r�r�r�s@r(r�r�Gs����)��.�"2�2�K�,�N�)�M��J��*�*�/�.��K�
�s�4�+� �+�+�2�K�A����D����t�2�3�
���$��(�,�L;�\-�/� �7��"+�(�G��I��H��I��G��� ��%�7�
�&�
&�>��
�
(�"� � �U���4��.��,
��M�^(�8"�r�z�z�"8�9��
0��!�6��J�*��)�+�
,�,r0r�c
�~�|jdk(r.dD](}|j|dd|j|d�z��*yy)z6Make paste replace selection on x11. See issue #5124.�x11)�Text�Entry�Spinboxz <<Paste>>z%catch {%W delete sel.first sel.last}
N)�_windowingsystem�
bind_class)r��clss r(�
fix_x11_paster��sG������%�-�C��O�O���8�����[�9�:�
;�.�&r0a�
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 ��ddl}ddlm}ddlm}ddlm}t
d�dad}d}d}d}d}d} |jtjddd�\}
}
D]�\}
}|
d
k(r|}d}|
dk(rd}d}|
dk(rd}|
dk(r7tjj!t�tj�|
dk(rd}|
dk(rtdtj��da|
dk(rD|}t"j$j'|�rn td|�tj�d}|
dk(rd} d}|
dk(s��|t(_d}��r(|ddk(r tj,j/�}d}t1t3tj$��D]C}t"j$j5tj$|�tj$|<�E|r|ddk(rdg|ddzt_ n�|rd
g|zt_ n�|r|g|zt_ n�|r�d}g}|D]0}|j7t"j$j9|���2|D]T}t"j$j5|�}|tj$vs�5tj$j;d|��VnFt#j<�}|tj$vr tj$j;d|�t?j@dddd��}|xs|}|xs|}tr|s
tC�tEd� �a#tFjI�dd!l%m&}|tF�t"j$jOt"j$j9tP�d"�}|�d#k(r7t"j$jO|d$�}tFjS|�%�n�|jU�sxtVd&k\rd'}d(}nd)}d*}|D�cgc]'}t"j$jO|d+||fz���)}}|D�cgc]}tYtF|�,���}}tGjZdg|���t]tF�t_tF�tatF�a1|jetFtb�|rK|sI|sG|ddD])}tbjg|���|ji|��+|stbjk�|rRtbjm�}|sy|jU�r;tbjnr+|jpjs�ntbjt}|r|jw�| r|t"jxj{d-�xst"jxj{d.�}|r:t"j$j'|�r|j|j|�|s|r�|j|j�d/j�tj��|r|j|j�|�n^|r\|j|j�|�|j|j|�n%|r#|j��}|r|j�|�tbj�r%tFj��tbj�r�%tFj��t
d�y#|j$rE}td |�d
t��tj��tjd�Yd}~���d}~wwxYwcc}wcc}w)0Nr)�system)�testing)�macosxTFrzc:deihnr:st:zError: r�rr�rz-dz-ez-hz-iz-nz: Warning: running IDLE without a subprocess is deprecated.z-rzNo script file: z-sz-t�-rbrrzeditor-on-startupr)r
�Idle)� className)�fix_scaling�Icons�Windowszidle.ico)r g333333!@z.png)�� �0�z.gif)r�r�r�z idle_%d%s)�masterr�IDLESTARTUP�
PYTHONSTARTUPzdif 1:
import sys as _sys
_sys.argv = {!r}
del _sys
)I�getoptrVr�rr�r�r/r�r��argv�errorrb� usage_msgr�exitrr!rPrQr�r�rQr�r�r�r�r�rp�dirnamerv�getcwdrr�
NoDefaultRootr�r�r��idlelib.runr�rR�__file__�
wm_iconbitmap�isAquaTk� TkVersion�
PhotoImage�wm_iconphotorr�r�rN�setupAppr�r}�newrO�dictr��lowerrqr5�environrrrr�rVrWr�r��preferTabsPreferenceWarningr��inversedictrd�destroy)r�r�r�r��enable_shell�enable_editrt�cmd�script�startup�optsrYr��o�ar.�pathxr&�dir�
edit_startr��icondir�iconfile�ext�sizes�size� iconfiles�iconsr��prefer_tabs_preference_warnings r(rr�s��������T���N��L��K��E�
�C�
�F��G���]�]�3�8�8�A�B�<��@�
��d����1���9��C��L���9��E��L���9��K���9��J�J���Y�'��H�H�J���9��L���9��N��z�z�
#�"�N���9��F��w�w�~�~�f�%���(�&�1����
��L���9��G��L���9�"#�G���L�?�@��Q��3���i�i�n�n�����
�3�s�x�x�=�
!���g�g�o�o�c�h�h�q�k�2������"���Q��3���4�$�q�r�(�?��� ��6�D�=��� ��8�d�?���
������H��L�L�������2�3���C��'�'�/�/�#�&�C��#�(�(�?�������3�'��
�i�i�k���c�h�h���H�H�O�O�A�s�#��#�#�F�I�$7�f�F�J��+��K��2�{�?�L��g���
���D��M�M�O�'�����g�g�l�l�2�7�7�?�?�8�4�g�>�G�
�x�9���7�7�<�<���4�����8��,�
�_�_�
�����C�%�E��C� �E�!&�(�!&���W�W�\�\�'�;�$���+D�E�!&� �(�"+�,�!*�X��4�h�7�!*� �,����$�'��'��$���$���D�!�E�
�O�O�D�%� ���v� ��G���:�:�h�'�/��K�K��)�$��� � ���� � �"�����?�?�����
�I�I�O�O���
�
��
�
������:�:�>�>�-�0�3��:�:�>�>�/�2� �������x�0��L�L�!�!�(�+�
�f�
�����!��&����"� $�
��L�L�#�#�C�(�
��L�L�(�(��0��L�L�!�!�&�)� �*0�)K�)K�)M�&�)����=�>�
�
�
��
�
���
�
��L�L�N��U���y�<�<��
���u�B�y�k�*����<����������n(��,s#�&[;�,]�6]�;]�
:]
�
])NN)Nr�r�r�rY�ImportErrorrbrfr�rV�idlelib.utilr r
r�rr�r4rP�os.pathrr�r#r�textwrapr
rHrr�r,�idlelib.colorizerr�idlelib.configr�idlelib.delegatorrrrr�idlelib.editorrr�idlelib.filelistr�idlelib.outwinrrrr�rrr�idlelib.undorr�rr��eofr�rb� NameErrorr r)r+r/�
checkcacher<r>r�r�r�r�� RPCClientr�r�r�r�r�r�rr�r0r(�<module>r
s�����z��%(�[�[��%<�C�K�K�!�"����<�<�7��*��O��'��� ��#� �
�� �����,�#�'���6�%�'���G�G�&������� �
�C��D�H��D�H�����>B�
�"��)����+/�2;�2F�2F��(5� ��{"�,�{"�|�h��(
2�^�
2�/�M�/�D1� �1��#�-�-���k(�0�k(�\
` ,�l�` ,�F;�4
� �ln�b�z���F�����m4�� �9�?B�~�~�O�
�Q�-����b� �� �s�F(�!G
�("G
�
G�G
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists