Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/runscript.cpython-36.pyc

3

� f��@s�dZddlZddlZddlZddljZddlmZddl	m
Z
ddl	mZdZGdd�d�Z
ed	kr|dd
lmZeddd
�dS)a�Execute code from an editor.

Check module: do a full syntax check of the current module.
Also run the tabnanny to catch any inconsistent tabs.

Run module: also execute the module's code in the __main__ namespace.
The window must have been saved previously. The module is added to
sys.modules, and is also added to the __main__ namespace.

TODO: Specify command line arguments in a dialog box.
�N)�idleConf)�macosx)�pyshella/Error: Inconsistent indentation detected!

1) Your indentation is outright incorrect (easy to fix), OR

2) Your indentation mixes tabs and spaces.

To fix case 2, change all tabs to spaces by using Edit->Select All followed by Format->Untabify Region and specify the number of columns used by each tab.
c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
ScriptBindingcCs8||_|jj|_|jj|_tj�r4|jjjd|j�dS)Nz<<run-module-event-2>>)�editwin�flist�rootr�	isCocoaTk�
text_frameZbind�_run_module_event)�selfr�r
�6/opt/alt/python36/lib64/python3.6/idlelib/runscript.py�__init__#s


zScriptBinding.__init__cCs0|j�}|sdS|j|�sdS|j|�s,dSdS)N�break)�getfilename�checksyntax�tabnanny)r�event�filenamer
r
r�check_module_event-s

z ScriptBinding.check_module_eventcCs�tj|���}ytjtj|j��Wn�tjk
rn}z.|j\}\}}|jj	|�|j
dd|�dSd}~Xn>tjk
r�}z |jj	|j��|j
dt
�dSd}~XnXWdQRXdS)NzTabnanny Tokenizing ErrorzToken Error: %sFzTab/space errorT)�tokenize�openrZprocess_tokens�generate_tokens�readline�
TokenError�argsrZgotoline�errorboxZNannyNagZ
get_lineno�indent_message)rr�f�msgZmsgtxt�lineno�startZnagr
r
rr7s
zScriptBinding.tabnannyc
CsZ|jj�|_}|j�}|j|j�t|d��}|j�}WdQRXd|krb|jdd�}|jdd�}|r~|dt	d�kr~|d}|j
}|j}|jddd�z�yt
||d	�Stttfk
�rD}zzt|d
d�p�|p�d}	t|d
d�p�d}
t|dd�p�d}|dk�r|
d7}
d|
d|df}|j||�|jdd|	�dSd}~XnXWd|j|�XdS)N�rb�
s
�
�ZERRORz1.0�end�execr �z<no detail available>r!�offsetrz0.0 + %d lines + %d chars�SyntaxErrorz%-20sF���)rZ
open_shell�shellZget_warning_streamZset_warning_stream�stderrr�read�replace�ordr�textZ
tag_remove�compiler+�
OverflowError�
ValueError�getattrZcolorize_syntax_errorr)
rrr-Zsaved_streamr�sourcerr2�valuer r!r*�posr
r
rrIs4
zScriptBinding.checksyntaxcs2tj�r$�jjjd�fdd��dS�j|�SdS)N��cs�jjjd�S)Nz<<run-module-event-2>>)rr
Zevent_generater
)rr
r�<lambda>osz0ScriptBinding.run_module_event.<locals>.<lambda>r)rr	rr
�afterr)rrr
)rr�run_module_eventgs

zScriptBinding.run_module_eventcCs�|j�}|sdS|j|�}|s"dS|j|�s0dS|jj}tjrT|jd|jj	|�d�t
jj|�}|j
dj||d��|j|�|j|�dS)aXRun the module after setting up the environment.

        First check the syntax.  If OK, make sure the shell is active and
        then transfer the arguments, set the run environment's working
        directory to the directory of the module being executed and also
        add that directory to its sys.path if not already included.
        rF)Zwith_cwdrazif 1:
            __file__ = {filename!r}
            import sys as _sys
            from os.path import basename as _basename
            if (not _sys.argv or
                _basename(_sys.argv[0]) != _basename(__file__)):
                _sys.argv = [__file__]
            import os as _os
            _os.chdir({dirname!r})
            del _sys, _basename, _os
            
)r�dirname)rrrr-�interprZuse_subprocessZrestart_subprocessrZ_filename_to_unicode�os�pathr>Z
runcommand�formatZprepend_syspathZruncode)rrr�coder?r>r
r
rrts$	




zScriptBinding._run_module_eventcCsx|jjj}|jj�sttjddddd�}|r>|r>|jjjd�n6|j�}|jjj	�|rp|jjjd�|jjj}nd}|S)a�Get source filename.  If not saved, offer to save (or create) file

        The debugger requires a source file.  Make sure there is one, and that
        the current version of the source buffer has been saved.  If the user
        declines to save or cancels the Save As dialog, return None.

        If the user has configured IDLE for Autosave, the file will be
        silently saved if it already exists and is dirty.

        �mainZGeneral�autosave�bool)�typeN)
r�iorZ	get_savedrZ	GetOptionZsave�ask_save_dialogr2�	focus_set)rrrE�confirmr
r
rr�s


zScriptBinding.getfilenamecCs d	}tjd|tj|jjd�}|S)
NzSource Must Be Saved
�� zOK to Save?zSave Before Run or Check)�title�message�default�parentz     zSource Must Be Saved
     z%Source Must Be Saved
     OK to Save?)�tkMessageBoxZaskokcancelZOKrr2)rr rKr
r
rrI�szScriptBinding.ask_save_dialogcCs$tj|||jjd�|jjj�dS)N)rQ)rRZ	showerrorrr2rJ)rrNrOr
r
rr�szScriptBinding.errorboxN)�__name__�
__module__�__qualname__rrrrr=rrrIrr
r
r
rr!s


)r�__main__)rDz idlelib.idle_test.test_runscript�)�	verbosity)�__doc__r@rrZtkinter.messageboxZ
messageboxrRZidlelib.configrZidlelibrrrrrSZunittestrDr
r
r
r�<module>s

&

Hacked By AnonymousFox1.0, Coded By AnonymousFox