ee=SrSSKrSSKrSSKrSSKJr /SQrSqSSSSSS.SjjrSr S r S r S r S r S rSrSr"SS5rSSS.SjrSSjrSr\S:Xa\"5 gg)a Helper class to quickly write a loop over all standard input files. Typical use is: import fileinput for line in fileinput.input(encoding="utf-8"): 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 and the optional arguments mode and openhook are ignored. 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 OSError 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=True 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="." 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. N) GenericAlias) inputclosenextfilefilenamelineno filelinenofileno isfirstlineisstdin FileInputhook_compressed hook_encodedrmodeopenhookencodingerrorsc |[(a [R(a [S5e[XX#UXVS9q[$)zReturn 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,. zinput() already activer)_state_file RuntimeErrorr )filesinplacebackuprrrrs //opt/imh/python3.13/lib/python3.13/fileinput.pyrrNs3v&,,344 uv8 (9F McD[nSqU(aUR5 gg)zClose the sequence.N)rr)states rrr]s E F   rcV[(d [S5e[R5$)a 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. no active input())rrrrrrres" 6.// ?? rcV[(d [S5e[R5$)zf Return the name of the file currently being read. Before the first line has been read, returns None. r")rrrr#rrrrss" 6.// ?? rcV[(d [S5e[R5$)z 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. r")rrrr#rrrr|s! 6.// ==?rcV[(d [S5e[R5$)z 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. r")rrr r#rrr r s$ 6.//    rcV[(d [S5e[R5$)z[ Return the file number of the current file. When no file is currently opened, returns -1. r")rrr r#rrr r s! 6.// ==?rcV[(d [S5e[R5$)zY Returns true the line just read is the first line of its file, otherwise returns false. r")rrr r#rrr r s$ 6.//    rcV[(d [S5e[R5$)zQ Returns true if the last line was read from sys.stdin, otherwise returns false. r")rrr r#rrr r s" 6.// >> rc\rSrSrSrSSSSSS.SjjrSrSrS rS r S r S r S r Sr SrSrSrSrSrSrSr\"\5rSrg)r aFileInput([files[, inplace[, backup]]], *, mode=None, openhook=None) 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. Nrrc[U[5(aU4nOb[U[R5(a[R"U54nO+Uc[ R SSnU(dSnO [U5nXlX l X0l SUl SUl SUl SUlSUlSUlSUlSUlX`lXpl[ R*R,(a'SU;a!UcUcSSKnUR1S[2S5 US;a [5S 5eX@lUR9S S 5UlU(a-U(a [5S 5e[=U5(d [5S 5eXPlg)N)-rFbz"'encoding' argument not specified.)rrbz*FileInput opening mode must be 'r' or 'rb'rwz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable) isinstancestrosPathLikefspathsysargvtuple_files_inplace_backup _savestdout_output _filename _startlineno _filelinenor_isstdin_backupfilename _encoding_errorsflagswarn_default_encodingwarningswarnEncodingWarning ValueError_modereplace _write_modecallable _openhook) selfrrrrrrrrIs r__init__FileInput.__init__sE eS ! !HE r{{ + +YYu%(E} e       #!  II + +4H$49I  MM>)1 . { "IJ J <<S1  !WXXH%% !FGG!rc$UR5 gNrrRs r__del__FileInput.__del__  rcLUR5 SUlg!SUlf=f)Nr#)rr;rXs rrFileInput.closes  MMODK"DKs #cU$rVr#rXs r __enter__FileInput.__enter__ rc$UR5 grVrW)rRtypevalue tracebacks r__exit__FileInput.__exit__r[rcU$rVr#rXs r__iter__FileInput.__iter__rarcUR5nU(aU=RS- slU$UR(d[eUR 5 MWNr-) _readlinerBr StopIterationrrRlines r__next__FileInput.__next__sE>>#D  A%  ::## MMOrcURnSUlU(a U[lURnSUlU(aUR 5 UR nSUlU?U(a!UR(dUR 5 URnSUl U(a'UR(d[R"U5 SUlg![a N~f=f![a N$f=f!URnSUl U(aFUR(d5[R"U5 SUlf![a SUlff=fSUlf=f!UR nSUlU?O![a Of=fU(a!UR(dUR 5 URnSUl U(a8UR(d'[R"U5 O![a Of=fSUlf!URnSUl U(aFUR(d5[R"U5 SUlf![a SUlff=fSUlf=f=f)NF)r>r8stdoutr?rrrmAttributeErrorrCrDr=r5unlinkOSError)rR savestdoutoutputfilebackupfilenames rrFileInput.nextfiles%%  #CJ  & ::DDJ N & JJL!%!5!5'+$!$,,>2!& "  #(D( "&!5!5'+$!$,,>2!& #(D % ) % !::DDJ N!   & JJL!%!5!5'+$!$,,>2"(D( % "&!5!5'+$!$,,>2!& #(D % ) % sE%%C((C9;C) C&%C&) C65C69,E"%E;E" E E"E E"%I<:E=<I<= F I< F  I<(H6+I<!G87I<8 HI<H I<,I9<II9 I. $ I9-I. . I99I<cUR5nU(aU=RS- slU$UR(dU$UR5 MSrl)rmrBrrros rreadlineFileInput.readline"sD>>#D  A%  :: MMOrcUR(dSUR;aggURSUlURSSUlUR5UlSUlSUlSUlSUlSUR;aUR=(d SnOSnURS:XadS UlSUR;a/[[RS [R5UlO[RUlS UlGOUR(Ga[R"UR5UR =(d S -Ul[R""UR5 [R&"URUR5 [)URURXR*S 9Ul[R,"UR R/55R0n[R2[R4-[R6-n[9[S5(aU[R:-n[R("URX25n[R<"X@R>XR*S 9Ul [RB"URU5 [RDUl#UR@[l"OURH(ayURc,URIURUR5UlOnURIURURURUR*S 9UlO.[)URURXR*S 9UlUR RJUl&URM5$![$a GNxf=f![$a GN,f=f![$a2 [)URUR>XR*S 9Ul GNkf=f)Nr/rrr-Flocaler.zbufferTz.bakrrO_BINARY)'r;rMr@rrArBrrCrDrEgetattrr8stdinr<r5r7r=rvrwrenameopenrFfstatr st_modeO_CREATO_WRONLYO_TRUNChasattrrfdopenrOr?chmodrtr>rQr~rm)rRrpermrfds rrmFileInput._readline-s{{djj Qkk!"o  KKM    djj ~~1HH >>S &DNdjj $SYY#))D  YY  DM}}}IIdnn-1GH$IId223 $..$*>*>?!$"6"6 +3LLJ 88DJJ$5$5$78@@D :: 3bjj@Dr:.. +||$UDL6$':: !\\ >>~~-%)^^DNNDJJ%O %)^^ NNDJJX\XdXd&4&f "&dnndjj8\h\h!iDJ,,~~M*#P#'8H8H19,,$PDLPs6' O2!8P!P2 P?P PP8QQcUR$rV)r@rXs rrFileInput.filenamevs ~~rc4URUR-$rV)rArBrXs rrFileInput.linenoys  4#3#333rcUR$rVrBrXs rr FileInput.filelineno|src|UR(aURR5$g![a gf=f)N)rr rLrXs rr FileInput.filenos: :: zz((**  s . ;;c URS:H$rlrrXs rr FileInput.isfirstlines1$$rcUR$rV)rCrXs rr FileInput.isstdins }}r)r=rDrErFrrBr@r;r<rCrMrQr?rmr>rArONFr)__name__ __module__ __qualname____firstlineno____doc__rSrYrr_rfrirqrr~rmrrr r r r classmethodr__class_getitem____static_attributes__r#rrr r su -"D4-"^ &<G R4 %$L1rr rcUcSU;aSn[RRU5SnUS:XaSSKnUR X5nO&US:XaSSKnUR X5nO [ XX#S9$SU;a[R"XbUS9nU$)Nr/rr-z.gzrz.bz2r) r5pathsplitextgziprbz2BZ2Fileio TextIOWrapper)rrrrextrstreamrs rrrsCtO ''  8 $Q 'C e|8* X,HXEE $!!&FK Mrc^^UU4SjnU$)Nc>[XTTS9$)Nr)r)rrrrs rrhook_encoded..openhooksHXfEErr#)rrrs`` rrrsF Orc SSKnSnSnUR[RSSS5up4UHupVUS:XaSnUS:XdMUnM [XAUS9HdnUS SS :XaUSS nUS SS :XaUSS n[ S [ 5[ 5[5[5=(a S =(d SU4-5 Mf [ S[ 5[ 5[54-5 g)NrFr-zib:z-iTz-b)rrr  z%d: %s[%d]%s %s*rz %d: %s[%d]) getoptr8r9rprintrrr r )rrroptsargsoarps r_testrsG Fsxx|U3JD 9g 9qfdF; 9 T#2Yd 9 T#2Yd 68XZ#.=#8S#>B#FF G<  ,&(HJ = =>r__main__rrV)rrr8r5typesr__all__rrrrrrr r r r r rrrrr#rrrsAF    d   c2c2L15T& ? z Gr