@@ -103,11 +103,11 @@ def _to_string(obj):
103103 return obj
104104
105105
106- def _write_csv (data : list [dict ], file : TextIO , header : bool = False , ** kwargs ) -> None :
106+ def _write_csv (data : list [dict ], file : TextIO , include_header : bool = False , ** kwargs ) -> None :
107107 columns = list (data [0 ].keys ())
108108 writer = csv .DictWriter (file , fieldnames = columns , lineterminator = "\n " , ** kwargs )
109109
110- if header :
110+ if include_header :
111111 writer .writeheader ()
112112
113113 for row in data :
@@ -123,7 +123,7 @@ def save_as_csv_without_header(data: list[dict], path: Path) -> None:
123123def save_as_csv_with_header (data : list [dict ], path : Path ) -> None :
124124 path .mkdir (parents = True , exist_ok = True )
125125 with open (path / "file.csv" , "w" , newline = "" ) as file :
126- _write_csv (data , file , header = True )
126+ _write_csv (data , file , include_header = True )
127127
128128
129129def save_as_csv_with_delimiter (data : list [dict ], path : Path ) -> None :
@@ -403,12 +403,12 @@ def save_as_xlsx(data: list[dict], path: Path) -> None:
403403 shutil .rmtree (root , ignore_errors = True )
404404 root .mkdir (parents = True , exist_ok = True )
405405
406- save_as_xlsx_with_options (data , root / "without_header" , header = False )
407- save_as_xlsx_with_options (data , root / "with_header" , header = True )
406+ save_as_xlsx_with_options (data , root / "without_header" , include_header = False )
407+ save_as_xlsx_with_options (data , root / "with_header" , include_header = True )
408408 save_as_xlsx_with_options (
409409 data ,
410410 root / "with_data_address" ,
411- header = False ,
411+ include_header = False ,
412412 sheet_name = "ABC" ,
413413 startcol = 10 ,
414414 startrow = 5 ,
@@ -420,12 +420,12 @@ def save_as_xls(data: list[dict], path: Path) -> None:
420420 shutil .rmtree (root , ignore_errors = True )
421421 root .mkdir (parents = True , exist_ok = True )
422422
423- save_as_xls_with_options (data , root / "without_header" , header = False )
424- save_as_xls_with_options (data , root / "with_header" , header = True )
423+ save_as_xls_with_options (data , root / "without_header" , include_header = False )
424+ save_as_xls_with_options (data , root / "with_header" , include_header = True )
425425 save_as_xls_with_options (
426426 data ,
427427 root / "with_data_address" ,
428- header = False ,
428+ include_header = False ,
429429 sheet_name = "ABC" ,
430430 startcol = 10 ,
431431 startrow = 5 ,
0 commit comments