MCPcopy Index your code
hub / github.com/python/cpython / nextfile

Method nextfile

Lib/fileinput.py:260–288  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

258 # repeat with next file
259
260 def nextfile(self):
261 savestdout = self._savestdout
262 self._savestdout = None
263 if savestdout:
264 sys.stdout = savestdout
265
266 output = self._output
267 self._output = None
268 try:
269 if output:
270 output.close()
271 finally:
272 file = self._file
273 self._file = None
274 try:
275 del self._readline # restore FileInput._readline
276 except AttributeError:
277 pass
278 try:
279 if file and not self._isstdin:
280 file.close()
281 finally:
282 backupfilename = self._backupfilename
283 self._backupfilename = None
284 if backupfilename and not self._backup:
285 try: os.unlink(backupfilename)
286 except OSError: pass
287
288 self._isstdin = False
289
290 def readline(self):
291 while True:

Callers 6

closeMethod · 0.95
__next__Method · 0.95
readlineMethod · 0.95
test_buffer_sizesMethod · 0.95
test_filenoMethod · 0.95
nextfileFunction · 0.45

Calls 2

closeMethod · 0.45
unlinkMethod · 0.45

Tested by 2

test_buffer_sizesMethod · 0.76
test_filenoMethod · 0.76