Skip to content

Commit e8c89f7

Browse files
committed
Reformat with black
1 parent 3668838 commit e8c89f7

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

python/afdko/otfautohint/report.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
class GlyphReport:
2020
"""Class to store stem and zone data from a particular glyph"""
21-
def __init__(self, name: str="", all_stems=False):
21+
22+
def __init__(self, name: str = "", all_stems=False):
2223
self.name = name
23-
self.hstems: Dict[float,int] = {}
24-
self.vstems: Dict[float,int] = {}
25-
self.hstems_pos: set[Tuple[Number,Number]] = set()
26-
self.vstems_pos: set[Tuple[Number,Number]] = set()
27-
self.char_zones: set[Tuple[Number,Number]] = set()
24+
self.hstems: Dict[float, int] = {}
25+
self.vstems: Dict[float, int] = {}
26+
self.hstems_pos: set[Tuple[Number, Number]] = set()
27+
self.vstems_pos: set[Tuple[Number, Number]] = set()
28+
self.char_zones: set[Tuple[Number, Number]] = set()
2829
self.stem_zone_stems: set[Tuple[Number, Number]] = set()
2930
self.all_stems = all_stems
3031

@@ -59,7 +60,7 @@ def round_value(val: float) -> int:
5960
else:
6061
return int(val - 0.5)
6162

62-
def parse_stem_dict(self, stem_dict: Dict[float, int]) -> Dict[float,int]:
63+
def parse_stem_dict(self, stem_dict: Dict[float, int]) -> Dict[float, int]:
6364
"""
6465
stem_dict: {45.5: 1, 47.0: 2}
6566
"""
@@ -76,8 +77,8 @@ def parse_zone_dicts(self, char_dict, stem_dict):
7677
all_zones_dict.update(stem_dict)
7778
# key: zone height
7879
# value: zone count
79-
top_dict: Dict[Number,int] = defaultdict(int)
80-
bot_dict: Dict[Number,int] = defaultdict(int)
80+
top_dict: Dict[Number, int] = defaultdict(int)
81+
bot_dict: Dict[Number, int] = defaultdict(int)
8182
for bot, top in all_zones_dict:
8283
top = self.round_value(top)
8384
top_dict[top] += 1
@@ -147,20 +148,16 @@ def _get_lists(self, options):
147148
# item 0: stem count
148149
# item 1: stem width
149150
# item 2: list of glyph names
150-
h_stem_list = self.assemble_rep_list(
151-
h_stem_items_dict, h_stem_count_dict)
151+
h_stem_list = self.assemble_rep_list(h_stem_items_dict, h_stem_count_dict)
152152

153-
v_stem_list = self.assemble_rep_list(
154-
v_stem_items_dict, v_stem_count_dict)
153+
v_stem_list = self.assemble_rep_list(v_stem_items_dict, v_stem_count_dict)
155154

156155
# item 0: zone count
157156
# item 1: zone height
158157
# item 2: list of glyph names
159-
top_zone_list = self.assemble_rep_list(
160-
top_zone_items_dict, top_zone_count_dict)
158+
top_zone_list = self.assemble_rep_list(top_zone_items_dict, top_zone_count_dict)
161159

162-
bot_zone_list = self.assemble_rep_list(
163-
bot_zone_items_dict, bot_zone_count_dict)
160+
bot_zone_list = self.assemble_rep_list(bot_zone_items_dict, bot_zone_count_dict)
164161

165162
return h_stem_list, v_stem_list, top_zone_list, bot_zone_list
166163

@@ -190,32 +187,36 @@ def _sort_val_reversed(t):
190187

191188
def save(self, path, options):
192189
h_stems, v_stems, top_zones, bot_zones = self._get_lists(options)
193-
items = ([h_stems, self._sort_count],
194-
[v_stems, self._sort_count],
195-
[top_zones, self._sort_val_reversed],
196-
[bot_zones, self._sort_val])
190+
items = (
191+
[h_stems, self._sort_count],
192+
[v_stems, self._sort_count],
193+
[top_zones, self._sort_val_reversed],
194+
[bot_zones, self._sort_val],
195+
)
197196
atime = time.asctime()
198197
suffixes = (".hstm.txt", ".vstm.txt", ".top.txt", ".bot.txt")
199-
titles = ("Horizontal Stem List for %s on %s\n" % (path, atime),
200-
"Vertical Stem List for %s on %s\n" % (path, atime),
201-
"Top Zone List for %s on %s\n" % (path, atime),
202-
"Bottom Zone List for %s on %s\n" % (path, atime),
203-
)
204-
headers = (["count width glyphs\n"] * 2 +
205-
["count height glyphs\n"] * 2)
198+
titles = (
199+
"Horizontal Stem List for %s on %s\n" % (path, atime),
200+
"Vertical Stem List for %s on %s\n" % (path, atime),
201+
"Top Zone List for %s on %s\n" % (path, atime),
202+
"Bottom Zone List for %s on %s\n" % (path, atime),
203+
)
204+
headers = ["count width glyphs\n"] * 2 + [
205+
"count height glyphs\n"
206+
] * 2
206207

207208
for i, item in enumerate(items):
208209
reps, sortFunc = item
209210
if not reps:
210211
continue
211-
fName = f'{path}{suffixes[i]}'
212+
fName = f"{path}{suffixes[i]}"
212213
title = titles[i]
213214
header = headers[i]
214215
with open(fName, "w") as fp:
215216
fp.write(title)
216217
fp.write(header)
217218
reps.sort(key=sortFunc)
218219
for rep in reps:
219-
gnames = ' '.join(rep[2])
220+
gnames = " ".join(rep[2])
220221
fp.write(f"{rep[0]:5} {rep[1]:5} [{gnames}]\n")
221222
log.info("Wrote %s" % fName)

0 commit comments

Comments
 (0)