Skip to content

Commit a39fc7c

Browse files
committed
TYP: add type annotation pandas-dev#36024
1 parent d7f30b4 commit a39fc7c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pandas/io/excel/_xlwt.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Dict
2+
13
import pandas._libs.json as json
24

35
from pandas.io.excel._base import ExcelWriter
@@ -29,12 +31,12 @@ def save(self):
2931
"""
3032
Save workbook to disk.
3133
"""
32-
return self.book.save(self.path)
34+
self.book.save(self.path)
3335

3436
def write_cells(
3537
self, cells, sheet_name=None, startrow=0, startcol=0, freeze_panes=None
3638
):
37-
# Write the frame cells using xlwt.
39+
from xlwt import XFStyle
3840

3941
sheet_name = self._get_sheet_name(sheet_name)
4042

@@ -49,7 +51,7 @@ def write_cells(
4951
wks.set_horz_split_pos(freeze_panes[0])
5052
wks.set_vert_split_pos(freeze_panes[1])
5153

52-
style_dict = {}
54+
style_dict: Dict[str, XFStyle] = {}
5355

5456
for cell in cells:
5557
val, fmt = self._value_with_fmt(cell.val)
@@ -101,14 +103,14 @@ def _style_to_xlwt(
101103
f"{key}: {cls._style_to_xlwt(value, False)}"
102104
for key, value in item.items()
103105
]
104-
out = f"{(line_sep).join(it)} "
106+
out = f"{line_sep.join(it)} "
105107
return out
106108
else:
107109
it = [
108110
f"{key} {cls._style_to_xlwt(value, False)}"
109111
for key, value in item.items()
110112
]
111-
out = f"{(field_sep).join(it)} "
113+
out = f"{field_sep.join(it)} "
112114
return out
113115
else:
114116
item = f"{item}"

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ check_untyped_defs=False
223223
[mypy-pandas.io.excel._util]
224224
check_untyped_defs=False
225225

226-
[mypy-pandas.io.excel._xlwt]
227-
check_untyped_defs=False
228-
229226
[mypy-pandas.io.formats.console]
230227
check_untyped_defs=False
231228

0 commit comments

Comments
 (0)