Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb9250a

Browse files
committed
Reformatted to respect maximum line length
1 parent 240c5df commit eb9250a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/matplotlib/afm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ def _parse_char_metrics(fh):
197197
line = line.rstrip()
198198
if line.startswith(b'EndCharMetrics'):
199199
return ascii_d, name_d
200-
vals = filter(lambda s: s != b'', line.split(b';')) # Split into a list of metrics
201-
vals = dict(map(lambda s: tuple(s.strip().split(b' ', 1)), vals)) # Split out the metric identifier and use as key for a dictionary
202-
if b'C' not in vals.keys() or b'WX' not in vals.keys() or b'N' not in vals.keys() or b'B' not in vals.keys() :
200+
# Split metric line into dictonary keyed by the metric identifiers
201+
vals = filter(lambda s: s != b'', line.split(b';'))
202+
vals = dict(map(lambda s: tuple(s.strip().split(b' ', 1)), vals))
203+
# check for the required metrics
204+
if any([id not in vals.keys() for id in (b'C', b'WX', b'N', b'B')]) :
203205
raise RuntimeError('Bad char metrics line: %s' % line)
204206
num = _to_int(vals[b'C'])
205207
wx = _to_float(vals[b'WX'])

0 commit comments

Comments
 (0)