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

Method close

Lib/_pyio.py:387–396  ·  view source on GitHub ↗

Flush and close the IO object. This method has no effect if the file is already closed.

(self)

Source from the content-addressed store, hash-verified

385 __closed = False
386
387 def close(self):
388 """Flush and close the IO object.
389
390 This method has no effect if the file is already closed.
391 """
392 if not self.__closed:
393 try:
394 self.flush()
395 finally:
396 self.__closed = True
397
398 def __del__(self):
399 """Destructor. Calls close()."""

Callers 10

__del__Method · 0.95
__exit__Method · 0.95
openFunction · 0.45
closeMethod · 0.45
closeMethod · 0.45
closeMethod · 0.45
closeMethod · 0.45
__init__Method · 0.45
closeMethod · 0.45
closeMethod · 0.45

Calls 1

flushMethod · 0.95

Tested by

no test coverage detected