Hacked By AnonymousFox

Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/fileinput.cpython-33.pyo

�
��f�7c	@sdZddlZddlZddddddd	d
dg	Zdad"Zdd#dddddd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd	�Zdd
�ZGdd�d�Zdd�Zdd�Zdd �Zed!kre�ndS($u5Helper class to quickly write a loop over all standard input files.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty.  If a filename is '-' it
is also replaced by sys.stdin.  To specify an alternative list of
filenames, pass it as the argument to input().  A single file name is
also allowed.

Functions filename(), lineno() return the filename and cumulative line
number of the line that has just been read; filelineno() returns its
line number in the current file; isfirstline() returns true iff the
line just read is the first line of its file; isstdin() returns true
iff the line was read from sys.stdin.  Function nextfile() closes the
current file so that the next iteration will read the first line from
the next file (if any); lines not read from the file will not count
towards the cumulative line count; the filename is not changed until
after the first line of the next file has been read.  Function close()
closes the sequence.

Before any lines have been read, filename() returns None and both line
numbers are zero; nextfile() has no effect.  After all lines have been
read, filename() and the line number functions return the values
pertaining to the last line read; nextfile() has no effect.

All files are opened in text mode by default, you can override this by
setting the mode parameter to input() or FileInput.__init__().
If an I/O error occurs during opening or reading a file, the IOError
exception is raised.

If sys.stdin is used more than once, the second and further use will
return no lines, except perhaps for interactive use, or if it has been
explicitly reset (e.g. using sys.stdin.seek(0)).

Empty files are opened and immediately closed; the only time their
presence in the list of filenames is noticeable at all is when the
last file opened is empty.

It is possible that the last line of a file doesn't end in a newline
character; otherwise lines are returned including the trailing
newline.

Class FileInput is the implementation; its methods filename(),
lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
correspond to the functions in the module.  In addition it has a
readline() method which returns the next input line, and a
__getitem__() method which implements the sequence behavior.  The
sequence must be accessed in strictly sequential order; sequence
access and readline() cannot be mixed.

Optional in-place filtering: if the keyword argument inplace=1 is
passed to input() or to the FileInput constructor, the file is moved
to a backup file and standard output is directed to the input file.
This makes it possible to write a filter that rewrites its input file
in place.  If the keyword argument backup=".<some extension>" is also
given, it specifies the extension for the backup file, and the backup
file remains around; by default, the extension is ".bak" and it is
deleted when the output file is closed.  In-place filtering is
disabled when standard input is read.  XXX The current implementation
does not work for MS-DOS 8+3 filesystems.

Performance: this module is unfortunately one of the slower ways of
processing large numbers of input lines.  Nevertheless, a significant
speed-up has been obtained by using readlines(bufsize) instead of
readline().  A new keyword argument, bufsize=N, is present on the
input() function and the FileInput() class to override the default
buffer size.

XXX Possible additions:

- optional getopt argument processing
- isatty()
- read(), read(size), even readlines()

iNuinputucloseunextfileufilenameulinenou
filelinenouisfirstlineuisstdinu	FileInputiiuurcCs=trtjrtd��nt||||||�atS(uReturn an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    uinput() already active(u_stateu_fileuRuntimeErroru	FileInput(ufilesuinplaceubackupubufsizeumodeuopenhook((u./opt/alt/python33/lib64/python3.3/fileinput.pyuinput[s	cCs#t}da|r|j�ndS(uClose the sequence.N(u_stateuNoneuclose(ustate((u./opt/alt/python33/lib64/python3.3/fileinput.pyucloseiscCststd��ntj�S(u�
    Close the current file so that the next iteration will read the first
    line from the next file (if any); lines not read from the file will
    not count towards the cumulative line count. The filename is not
    changed until after the first line of the next file has been read.
    Before the first line has been read, this function has no effect;
    it cannot be used to skip the first file. After the last line of the
    last file has been read, this function has no effect.
    uno active input()(u_stateuRuntimeErrorunextfile(((u./opt/alt/python33/lib64/python3.3/fileinput.pyunextfileqs
cCststd��ntj�S(ur
    Return the name of the file currently being read.
    Before the first line has been read, returns None.
    uno active input()(u_stateuRuntimeErrorufilename(((u./opt/alt/python33/lib64/python3.3/fileinput.pyufilenamescCststd��ntj�S(u�
    Return the cumulative line number of the line that has just been read.
    Before the first line has been read, returns 0. After the last line
    of the last file has been read, returns the line number of that line.
    uno active input()(u_stateuRuntimeErrorulineno(((u./opt/alt/python33/lib64/python3.3/fileinput.pyulineno�scCststd��ntj�S(u�
    Return the line number in the current file. Before the first line
    has been read, returns 0. After the last line of the last file has
    been read, returns the line number of that line within the file.
    uno active input()(u_stateuRuntimeErroru
filelineno(((u./opt/alt/python33/lib64/python3.3/fileinput.pyu
filelineno�scCststd��ntj�S(ug
    Return the file number of the current file. When no file is currently
    opened, returns -1.
    uno active input()(u_stateuRuntimeErrorufileno(((u./opt/alt/python33/lib64/python3.3/fileinput.pyufileno�sufilenocCststd��ntj�S(ue
    Returns true the line just read is the first line of its file,
    otherwise returns false.
    uno active input()(u_stateuRuntimeErroruisfirstline(((u./opt/alt/python33/lib64/python3.3/fileinput.pyuisfirstline�scCststd��ntj�S(u]
    Returns true if the last line was read from sys.stdin,
    otherwise returns false.
    uno active input()(u_stateuRuntimeErroruisstdin(((u./opt/alt/python33/lib64/python3.3/fileinput.pyuisstdin�scBs�|EeZdZdZd%d&dddd%dd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S('u	FileInputu?FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]])

    Class FileInput is the implementation of the module; its methods
    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
    nextfile() and close() correspond to the functions of the same name
    in the module.
    In addition it has a readline() method which returns the next
    input line, and a __getitem__() method which implements the
    sequence behavior. The sequence must be accessed in strictly
    sequential order; random access and readline() cannot be mixed.
    uiurcCsFt|t�r|f}n=|dkr=tjdd�}n|sLd}nt|�}||_||_||_|p|t	|_
d|_d|_d|_
d|_d|_d|_d|_d|_g|_d|_|d
kr�td��n||_|r9|rtd	��nt|�s9td
��q9n||_dS(Niu-iururUuUurbu=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'u4FileInput cannot use an opening hook in inplace modeu#FileInput openhook must be callable(u-F(ururUuUurb(u
isinstanceustruNoneusysuargvutupleu_filesu_inplaceu_backupuDEFAULT_BUFSIZEu_bufsizeu_savestdoutu_outputu	_filenameu_linenou_filelinenou_fileuFalseu_isstdinu_backupfilenameu_bufferu	_bufindexu
ValueErroru_modeucallableu	_openhook(uselfufilesuinplaceubackupubufsizeumodeuopenhook((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__init__�s<															uFileInput.__init__cCs|j�dS(N(uclose(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__del__�suFileInput.__del__cCs|j�f|_dS(N(unextfileu_files(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyuclose�s
uFileInput.closecCs|S(N((uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyu	__enter__�suFileInput.__enter__cCs|j�dS(N(uclose(uselfutypeuvalueu	traceback((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__exit__�suFileInput.__exit__cCs|S(N((uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__iter__�suFileInput.__iter__cCsyy|j|j}Wntk
r(Yn2X|jd7_|jd7_|jd7_|S|j�}|sut�n|S(Ni(u_bufferu	_bufindexu
IndexErroru_linenou_filelinenoureadlineu
StopIteration(uselfuline((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__next__�s
	uFileInput.__next__cCsQ||jkrtd��ny|j�SWntk
rLtd��YnXdS(Nuaccessing lines out of orderuend of input reached(u_linenouRuntimeErroru__next__u
StopIterationu
IndexError(uselfui((u./opt/alt/python33/lib64/python3.3/fileinput.pyu__getitem__s
uFileInput.__getitem__c
Cs�|j}d|_|r$|t_n|j}d|_|rI|j�n|j}d|_|rx|jrx|j�n|j}d|_|r�|jr�yt	j
|�Wq�tk
r�Yq�Xnd|_g|_
d|_dS(NiF(u_savestdoutusysustdoutu_outputucloseu_fileu_isstdinu_backupfilenameu_backupuosuunlinkuOSErroruFalseu_bufferu	_bufindex(uselfu
savestdoutuoutputufileubackupfilename((u./opt/alt/python33/lib64/python3.3/fileinput.pyunextfiles,				
		
		
		uFileInput.nextfilec$Cs�y|j|j}Wntk
r(Yn2X|jd7_|jd7_|jd7_|S|js�|jspdS|jd|_|jdd�|_d|_d|_d
|_
d|_|jdkr�d|_tj
|_d|_
q�|jrk|j|jpd|_ytj|j�Wntjk
r7YnXtj|j|j�t|j|j�|_ytj|jj��j}Wn'tk
r�t|jd�|_Yn�XtjtjBtjB}ttd�r�|tj O}ntj|j||�}tj!|d�|_y)ttd	�r:tj"|j|�nWntk
rOYnXtj#|_$|jt_#q�|j%r�|j%|j|j�|_q�t|j|j�|_n|jj&|j'�|_d|_|js�|j(�n|j)�S(Niuiu-u<stdin>u.bakuwuO_BINARYuchmodFT(*u_bufferu	_bufindexu
IndexErroru_linenou_filelinenou_fileu_filesu	_filenameuNoneuFalseu_isstdinu_backupfilenameusysustdinuTrueu_inplaceu_backupuosuunlinkuerrorurenameuopenu_modeufstatufilenoust_modeuOSErroru_outputuO_CREATuO_WRONLYuO_TRUNCuhasattruO_BINARYufdopenuchmodustdoutu_savestdoutu	_openhooku	readlinesu_bufsizeunextfileureadline(uselfulineupermumodeufd((u./opt/alt/python33/lib64/python3.3/fileinput.pyureadline*sj
								

			
uFileInput.readlinecCs|jS(N(u	_filename(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyufilenameisuFileInput.filenamecCs|jS(N(u_lineno(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyulinenolsuFileInput.linenocCs|jS(N(u_filelineno(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyu
filelinenoosuFileInput.filelinenocCs>|jr6y|jj�SWq:tk
r2dSYq:XndSdS(Nii����i����(u_fileufilenou
ValueError(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyufilenors	
uFileInput.filenocCs
|jdkS(Ni(u_filelineno(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyuisfirstline{suFileInput.isfirstlinecCs|jS(N(u_isstdin(uself((u./opt/alt/python33/lib64/python3.3/fileinput.pyuisstdin~suFileInput.isstdinNF(u__name__u
__module__u__qualname__u__doc__uNoneuFalseu__init__u__del__ucloseu	__enter__u__exit__u__iter__u__next__u__getitem__unextfileureadlineufilenameulinenou
filelinenoufilenouisfirstlineuisstdin(u
__locals__((u./opt/alt/python33/lib64/python3.3/fileinput.pyu	FileInput�s$$?	cCswtjj|�d}|dkr>ddl}|j||�S|dkrfddl}|j||�St||�SdS(Niu.gziu.bz2(uosupathusplitextugzipuopenubz2uBZ2File(ufilenameumodeuextugzipubz2((u./opt/alt/python33/lib64/python3.3/fileinput.pyuhook_compressed�suhook_compressedcs�fdd�}|S(Ncst||d��S(Nuencoding(uopen(ufilenameumode(uencoding(u./opt/alt/python33/lib64/python3.3/fileinput.pyuopenhook�suhook_encoded.<locals>.openhook((uencodinguopenhook((uencodingu./opt/alt/python33/lib64/python3.3/fileinput.pyuhook_encoded�suhook_encodedc
CsLddl}d}d}|jtjdd�d�\}}x>|D]6\}}|dkred}n|dkrD|}qDqDWx�t|d|d|�D]�}|dd�dkr�|dd�}n|dd�d	kr�|dd�}ntd
t�t�t	�t
�rdpd|f�q�Wtd
t�t�t	�f�dS(Niiuib:u-iu-buinplaceubackupu
u
u%d: %s[%d]%s %su*uu
%d: %s[%d]FTi����i����i����i����(ugetoptuFalseusysuargvuTrueuinputuprintulinenoufilenameu
filelinenouisfirstline(ugetoptuinplaceubackupuoptsuargsuouauline((u./opt/alt/python33/lib64/python3.3/fileinput.pyu_test�s"%	
!u_testu__main__i F(u__doc__usysuosu__all__uNoneu_stateuDEFAULT_BUFSIZEuFalseuinputucloseunextfileufilenameulinenou
filelinenoufilenouisfirstlineuisstdinu	FileInputuhook_compresseduhook_encodedu_testu__name__(((u./opt/alt/python33/lib64/python3.3/fileinput.pyu<module>Ps*
	

			�

Hacked By AnonymousFox1.0, Coded By AnonymousFox