MCPcopy Index your code
hub / github.com/RustPython/RustPython / close

Method close

Lib/_pyio.py:1783–1795  ·  view source on GitHub ↗

Close the file. A closed file cannot be used for further I/O operations. close() may be called more than once without error.

(self)

Source from the content-addressed store, hash-verified

1781 return size
1782
1783 def close(self):
1784 """Close the file.
1785
1786 A closed file cannot be used for further I/O operations. close() may be
1787 called more than once without error.
1788 """
1789 if not self.closed:
1790 self._stat_atopen = None
1791 try:
1792 if self._closefd and self._fd >= 0:
1793 os.close(self._fd)
1794 finally:
1795 super().close()
1796
1797 def seekable(self):
1798 """True if file supports random-access."""

Callers 12

testErrorsMethod · 0.95
testAblesMethod · 0.95
testUnicodeOpenMethod · 0.95
testBytesOpenMethod · 0.95
testUtf8BytesOpenMethod · 0.95
testBooleanFdMethod · 0.95
testBadModeArgumentMethod · 0.95
testTruncateMethod · 0.95
bug801631Method · 0.95
testAppendMethod · 0.95
test_fileio_closefdMethod · 0.95

Calls 2

superClass · 0.85
closeMethod · 0.45

Tested by 12

testErrorsMethod · 0.76
testAblesMethod · 0.76
testUnicodeOpenMethod · 0.76
testBytesOpenMethod · 0.76
testUtf8BytesOpenMethod · 0.76
testBooleanFdMethod · 0.76
testBadModeArgumentMethod · 0.76
testTruncateMethod · 0.76
bug801631Method · 0.76
testAppendMethod · 0.76
test_fileio_closefdMethod · 0.76