MCPcopy
hub / github.com/jmcnamara/XlsxWriter / close

Method close

xlsxwriter/workbook.py:373–404  ·  view source on GitHub ↗

Call finalization code and close file. Args: None. Returns: Nothing.

(self)

Source from the content-addressed store, hash-verified

371 return 0
372
373 def close(self) -> None:
374 """
375 Call finalization code and close file.
376
377 Args:
378 None.
379
380 Returns:
381 Nothing.
382
383 """
384 # pylint: disable=raise-missing-from
385 if not self.fileclosed:
386 try:
387 self._store_workbook()
388 except IOError as e:
389 raise FileCreateError(e)
390 except LargeZipFile:
391 raise FileSizeError(
392 "Filesize would require ZIP64 extensions. "
393 "Use workbook.use_zip64()."
394 )
395
396 self.fileclosed = True
397
398 # Ensure all constant_memory temp files are closed.
399 if self.constant_memory:
400 for worksheet in self.worksheets():
401 worksheet._opt_close()
402
403 else:
404 warn("Calling close() on already closed file.")
405
406 def set_size(self, width: int, height: int) -> None:
407 """

Callers 15

time_xlsxwriterFunction · 0.95
time_xlsxwriterFunction · 0.95
__exit__Method · 0.95
test_create_fileMethod · 0.95
test_create_fileMethod · 0.95
test_close_file_twiceMethod · 0.95
test_create_fileMethod · 0.95
test_create_fileMethod · 0.95
test_create_fileMethod · 0.95
test_create_fileMethod · 0.95
test_create_fileMethod · 0.95

Calls 5

_store_workbookMethod · 0.95
worksheetsMethod · 0.95
FileCreateErrorClass · 0.85
FileSizeErrorClass · 0.85
_opt_closeMethod · 0.80

Tested by 15

test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_close_file_twiceMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76
test_create_fileMethod · 0.76