1
1
from collections import defaultdict
2
2
import datetime
3
+ from typing import DefaultDict
3
4
4
5
from odf .config import (
5
6
ConfigItem ,
@@ -32,7 +33,7 @@ def __init__(self, path, engine=None, encoding=None, mode="w", **engine_kwargs):
32
33
super ().__init__ (path , mode = mode , ** engine_kwargs )
33
34
34
35
self .book = OpenDocumentSpreadsheet ()
35
- self .style_dict = {}
36
+ self ._style_dict = {}
36
37
37
38
def save (self ):
38
39
"""
@@ -59,8 +60,8 @@ def write_cells(
59
60
if _validate_freeze_panes (freeze_panes ):
60
61
self ._create_freeze_panes (sheet_name , freeze_panes )
61
62
62
- rows = defaultdict (TableRow )
63
- col_count = defaultdict (int )
63
+ rows : DefautDict = defaultdict (TableRow )
64
+ col_count : DefaultDict = defaultdict (int )
64
65
65
66
for cell in sorted (cells , key = lambda cell : (cell .row , cell .col )):
66
67
# fill with empty cells if needed
@@ -133,10 +134,10 @@ def _process_style(self, style):
133
134
if style is None :
134
135
return None
135
136
style_key = json .dumps (style )
136
- if style_key in self .style_dict :
137
- return self .style_dict [style_key ]
138
- name = f"pd{ len (self .style_dict )+ 1 } "
139
- self .style_dict [style_key ] = name
137
+ if style_key in self ._style_dict :
138
+ return self ._style_dict [style_key ]
139
+ name = f"pd{ len (self ._style_dict )+ 1 } "
140
+ self ._style_dict [style_key ] = name
140
141
odf_style = Style (name = name , family = "table-cell" )
141
142
if "font" in style :
142
143
font = style ["font" ]
0 commit comments