Skip to content

TYP: add type annotation to _xlwt.py #36024 #36025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pandas/io/excel/_xlwt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Dict

import pandas._libs.json as json

from pandas.io.excel._base import ExcelWriter
Expand Down Expand Up @@ -29,12 +31,12 @@ def save(self):
"""
Save workbook to disk.
"""
return self.book.save(self.path)
self.book.save(self.path)

def write_cells(
self, cells, sheet_name=None, startrow=0, startcol=0, freeze_panes=None
):
# Write the frame cells using xlwt.
from xlwt import XFStyle

sheet_name = self._get_sheet_name(sheet_name)

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

style_dict = {}
style_dict: Dict[str, XFStyle] = {}

for cell in cells:
val, fmt = self._value_with_fmt(cell.val)
Expand Down Expand Up @@ -101,14 +103,14 @@ def _style_to_xlwt(
f"{key}: {cls._style_to_xlwt(value, False)}"
for key, value in item.items()
]
out = f"{(line_sep).join(it)} "
out = f"{line_sep.join(it)} "
return out
else:
it = [
f"{key} {cls._style_to_xlwt(value, False)}"
for key, value in item.items()
]
out = f"{(field_sep).join(it)} "
out = f"{field_sep.join(it)} "
return out
else:
item = f"{item}"
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ check_untyped_defs=False
[mypy-pandas.io.excel._util]
check_untyped_defs=False

[mypy-pandas.io.excel._xlwt]
check_untyped_defs=False

[mypy-pandas.io.formats.console]
check_untyped_defs=False

Expand Down