From 7c6239ac841ea0749adb0f2799ea6f3a91919cf8 Mon Sep 17 00:00:00 2001 From: justvanrossum Date: Sun, 3 Mar 2019 13:02:27 +0100 Subject: [PATCH] Changed map(operator...) into explicit for loop --- Lib/fontTools/ttLib/tables/otTables.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py index 4d2bc574f..4e18d54be 100644 --- a/Lib/fontTools/ttLib/tables/otTables.py +++ b/Lib/fontTools/ttLib/tables/otTables.py @@ -698,18 +698,19 @@ class SingleSubst(FormatSwitchingBaseTable): def postRead(self, rawTable, font): mapping = {} input = _getGlyphsFromCoverageTable(rawTable["Coverage"]) - lenMapping = len(input) if self.Format == 1: delta = rawTable["DeltaGlyphID"] inputGIDS = [ font.getGlyphID(name) for name in input ] outGIDS = [ (glyphID + delta) % 65536 for glyphID in inputGIDS ] outNames = [ font.getGlyphName(glyphID) for glyphID in outGIDS ] - list(map(operator.setitem, [mapping]*lenMapping, input, outNames)) + for inp, out in zip(input, outNames): + mapping[inp] = out elif self.Format == 2: assert len(input) == rawTable["GlyphCount"], \ "invalid SingleSubstFormat2 table" subst = rawTable["Substitute"] - list(map(operator.setitem, [mapping]*lenMapping, input, subst)) + for inp, sub in zip(input, subst): + mapping[inp] = sub else: assert 0, "unknown format: %s" % self.Format self.mapping = mapping