Skip to content

TYP: typing errors in _xlsxwriter.py #35994 #35995

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 6 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
1 change: 0 additions & 1 deletion pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def __new__(cls, path, engine=None, **kwargs):
return object.__new__(cls)

# declare external properties you can count on
book = None
curr_sheet = None
path = None

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/excel/_odswriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(

super().__init__(path, mode=mode, **engine_kwargs)

self.book: OpenDocumentSpreadsheet = OpenDocumentSpreadsheet()
self.book = OpenDocumentSpreadsheet()
self._style_dict: Dict[str, str] = {}

def save(self) -> None:
Expand Down
8 changes: 5 additions & 3 deletions pandas/io/excel/_xlsxwriter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Dict, List, Tuple

import pandas._libs.json as json

from pandas.io.excel._base import ExcelWriter
Expand All @@ -8,7 +10,7 @@ class _XlsxStyler:
# Map from openpyxl-oriented styles to flatter xlsxwriter representation
# Ordering necessary for both determinism and because some are keyed by
# prefixes of others.
STYLE_MAPPING = {
STYLE_MAPPING: Dict[str, List[Tuple[Tuple[str, ...], str]]] = {
"font": [
(("name",), "font_name"),
(("sz",), "font_size"),
Expand Down Expand Up @@ -170,7 +172,7 @@ def __init__(
**engine_kwargs,
):
# Use the xlsxwriter module as the Excel writer.
import xlsxwriter
from xlsxwriter import Workbook

if mode == "a":
raise ValueError("Append mode is not supported with xlsxwriter!")
Expand All @@ -184,7 +186,7 @@ def __init__(
**engine_kwargs,
)

self.book = xlsxwriter.Workbook(path, **engine_kwargs)
self.book = Workbook(path, **engine_kwargs)

def save(self):
"""
Expand Down