Skip to content

Commit 2cb60c7

Browse files
kashifkhanKashif Khan
and
Kashif Khan
authored
TYP: define gen and gen2 as Iterable (#45139)
Co-authored-by: Kashif Khan <[email protected]>
1 parent ccb25ab commit 2cb60c7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/io/formats/excel.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -649,20 +649,21 @@ def _format_header_regular(self) -> Iterable[ExcelCell]:
649649
)
650650

651651
def _format_header(self) -> Iterable[ExcelCell]:
652+
gen: Iterable[ExcelCell]
653+
652654
if isinstance(self.columns, MultiIndex):
653655
gen = self._format_header_mi()
654656
else:
655657
gen = self._format_header_regular()
656658

657-
gen2 = ()
659+
gen2: Iterable[ExcelCell] = ()
660+
658661
if self.df.index.names:
659662
row = [x if x is not None else "" for x in self.df.index.names] + [
660663
""
661664
] * len(self.columns)
662665
if reduce(lambda x, y: x and y, map(lambda x: x != "", row)):
663-
# error: Incompatible types in assignment (expression has type
664-
# "Generator[ExcelCell, None, None]", variable has type "Tuple[]")
665-
gen2 = ( # type: ignore[assignment]
666+
gen2 = (
666667
ExcelCell(self.rowcounter, colindex, val, self.header_style)
667668
for colindex, val in enumerate(row)
668669
)

0 commit comments

Comments
 (0)