Your IP : 3.129.216.248


Current Path : /opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/main.cpython-33.pyc

�
��fh-c@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
dd�ZGdd	�d	e
j�Z
d
d�Zddd
�ZdS(u
Main program for 2to3.
i(uwith_statementNi(urefactorc	Cs:|j�}|j�}tj||||dddd�S(u%Return a unified diff of two strings.u
(original)u(refactored)ulinetermu(u
splitlinesudifflibuunified_diff(uaubufilename((u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu
diff_textss
	u
diff_textscs_|EeZdZdZddd�fdd�Zdd�Z�fdd�Zd	d
�Z�S(uStdoutRefactoringToolu2
    A refactoring tool that can avoid overwriting its input files.
    Prints output to stdout.

    Output files can optionally be written to a different directory and or
    have an extra file suffix appended to their name for use in situations
    where you do not want to replace the input files.
    uc		sv||_||_|r;|jtj�r;|tj7}n||_||_||_tt	|�j
|||�dS(uF
        Args:
            fixers: A list of fixers to import.
            options: A dict with RefactoringTool configuration.
            explicit: A list of fixers to run even if they are explicit.
            nobackups: If true no backup '.bak' files will be created for those
                files that are being refactored.
            show_diffs: Should diffs of the refactoring be printed to stdout?
            input_base_dir: The base directory for all input files.  This class
                will strip this path prefix off of filenames before substituting
                it with output_dir.  Only meaningful if output_dir is supplied.
                All files processed by refactor() must start with this path.
            output_dir: If supplied, all converted files will be written into
                this directory tree instead of input_base_dir.
            append_suffix: If supplied, all files output by this tool will have
                this appended to their filename.  Useful for changing .py to
                .py3 for example by passing append_suffix='3'.
        N(u	nobackupsu
show_diffsuendswithuosusepu_input_base_diru_output_diru_append_suffixusuperuStdoutRefactoringToolu__init__(	uselfufixersuoptionsuexplicitu	nobackupsu
show_diffsuinput_base_diru
output_diru
append_suffix(u	__class__(u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu__init__$s					uStdoutRefactoringTool.__init__cOs3|jj|||f�|jj|||�dS(N(uerrorsuappenduloggeruerror(uselfumsguargsukwargs((u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu	log_errorAsuStdoutRefactoringTool.log_errorc
!s|}|jrk|j|j�rOtjj|j|t|j�d��}qktd||jf��n|jr�||j7}n||kr�tjj	|�}tjj
|�s�tj|�n|jd||�n|j
s�|d}tjj|�rNytj|�WqNtjk
rJ}z|jd|�WYdd}~XqNXnytj||�Wq�tjk
r�}z|jd||�WYdd}~Xq�Xntt|�j}	|	||||�|j
s�tj||�n||krtj||�ndS(Nu5filename %s does not start with the input_base_dir %suWriting converted %s to %s.u.bakuCan't remove backup %suCan't rename %s to %s(u_output_diru
startswithu_input_base_diruosupathujoinulenu
ValueErroru_append_suffixudirnameuisdirumakedirsulog_messageu	nobackupsulexistsuremoveuerrorurenameusuperuStdoutRefactoringToolu
write_fileushutilucopymode(
uselfunew_textufilenameuold_textuencodingu
orig_filenameu
output_dirubackupuerruwrite(u	__class__(u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu
write_fileEs@		
	
&)	u StdoutRefactoringTool.write_filecCs�|r|jd|�n�|jd|�|jr�t|||�}yi|jdk	r�|j�-x|D]}t|�qgWtjj�WdQXnx|D]}t|�q�WWq�t	k
r�t
d|f�dSYq�XndS(NuNo changes to %su
Refactored %su+couldn't encode %s's diff for your terminal(ulog_messageu
show_diffsu
diff_textsuoutput_lockuNoneuprintusysustdoutuflushuUnicodeEncodeErroruwarn(uselfuoldunewufilenameuequalu
diff_linesuline((u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyuprint_outputls"	



u"StdoutRefactoringTool.print_output(u__name__u
__module__u__qualname__u__doc__u__init__u	log_erroru
write_fileuprint_output(u
__locals__((u	__class__u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyuStdoutRefactoringTools
'uStdoutRefactoringToolcCstd|fdtj�dS(NuWARNING: %sufile(uprintusysustderr(umsg((u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyuwarn�suwarncs�tjdd�}|jdddddd�|jd	d
dddgdd
�|jdddddddddd�|jdddddgdd�|jdddddd�|jdddddd�|jdddddd �|jd!dddd"�|jd#d$dddd%�|jd&d'ddddOdd(�|jd)d*dddd+dd,dd-�|jd.d/dddd0�|jd1dddd+dd,dd2�dO}i}|j|�\}}|jrdP|d3<|js�td4�ndP|_n|j	r'|j
r'|jd5�n|jrJ|j
rJ|jd6�n|jrj|j
rjtd7�n|jr�|j
r�|jd8�n|jr�td9�x!tj��D]}t|�q�W|s�d:Sn|std;d<tj�td=d<tj�d>Sd?|kr6dP}|jr6td@d<tj�d>Sn|jrLdP|dA<n|jr^tjntj}tjdBdCdD|�tjdE�}ttj���}	t�fdFdG�|jD��}
t�}|jr7dO}x;|jD]0}
|
dHkrdP}q�|j�dI|
�q�W|r.|	j |�n|}n|	j |�}|j!|
�}t"j#j$|�}|r�|j%t"j&�r�t"j#j'|�r�t"j#j(|�}n|j	r�|j)t"j&�}|j*dJ|j	|�nt+t,|�|t,|�|j
|j
dK|dL|j	dM|j�}|j-s�|r;|j.�ngy#|j||j|j/|j0�WnAtj1k
r�|j0dks�t2�tdNd<tj�dSYnX|j3�nt4t5|j-��S(Qu�Main program.

    Args:
        fixer_pkg: the name of a package where the fixers are located.
        args: optional; a list of command line arguments. If omitted,
              sys.argv[1:] is used.

    Returns a suggested exit status (0, 1, 2).
    uusageu2to3 [options] file|dir ...u-du--doctests_onlyuactionu
store_trueuhelpuFix up doctests onlyu-fu--fixuappendudefaultu1Each FIX specifies a transformation; default: allu-ju--processesustoreiutypeuintuRun 2to3 concurrentlyu-xu--nofixu'Prevent a transformation from being runu-lu--list-fixesuList available transformationsu-pu--print-functionu0Modify the grammar so that print() is a functionu-vu	--verboseuMore verbose loggingu
--no-diffsu#Don't show diffs of the refactoringu-wu--writeuWrite back modified filesu-nu--nobackupsu&Don't write backups for modified filesu-ou--output-dirustruuXPut output files in this directory instead of overwriting the input files.  Requires -n.u-Wu--write-unchanged-filesuYAlso write files even if no changes were required (useful with --output-dir); implies -w.u--add-suffixuuAppend this string to all output filenames. Requires -n if non-empty.  ex: --add-suffix='3' will generate .py3 files.uwrite_unchanged_filesu&--write-unchanged-files/-W implies -w.u%Can't use --output-dir/-o without -n.u"Can't use --add-suffix without -n.u@not writing files and not printing diffs; that's not very usefuluCan't use -n without -wu2Available transformations for the -f/--fix option:iu1At least one file or directory argument required.ufileuUse --help to show usage.iu-uCan't write to stdin.uprint_functionuformatu%(name)s: %(message)sulevelulib2to3.mainc3s|]}�d|VqdS(u.fix_N((u.0ufix(u	fixer_pkg(u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu	<genexpr>�sumain.<locals>.<genexpr>uallu.fix_u7Output in %r will mirror the input directory %r layout.uinput_base_diru
output_diru
append_suffixu+Sorry, -j isn't supported on this platform.FT(6uoptparseuOptionParseru
add_optionuFalseu
parse_argsuwrite_unchanged_filesuTrueuwriteuwarnu
output_diru	nobackupsuerroru
add_suffixuno_diffsu
list_fixesuprinturefactoruget_all_fix_namesusysustderruprint_functionuverboseulogginguDEBUGuINFOubasicConfigu	getLoggerusetuget_fixers_from_packageunofixufixuadduunionu
differenceuosupathucommonprefixuendswithusepuisdirudirnameurstripuinfouStdoutRefactoringToolusorteduerrorsurefactor_stdinu
doctests_onlyu	processesuMultiprocessingUnsupporteduAssertionErroru	summarizeuintubool(u	fixer_pkguargsuparserurefactor_stdinuflagsuoptionsufixnameuleveluloggeruavail_fixesuunwanted_fixesuexplicituall_presentufixu	requestedufixer_namesuinput_base_dirurt((u	fixer_pkgu1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyumain�s�

	
	

	
		
"							
	
	
umain(u__doc__u
__future__uwith_statementusysuosudifflibuloggingushutiluoptparseuurefactoru
diff_textsuMultiprocessRefactoringTooluStdoutRefactoringTooluwarnuNoneumain(((u1/opt/alt/python33/lib64/python3.3/lib2to3/main.pyu<module>s	g

?>