2to3 --fix=has_key
This commit is contained in:
parent
553c3bbe4e
commit
bc5e1cb195
@ -208,7 +208,7 @@ class AFM:
|
||||
# a preferred order
|
||||
attrs = self._attrs
|
||||
for attr in preferredAttributeOrder:
|
||||
if attrs.has_key(attr):
|
||||
if attr in attrs:
|
||||
value = attrs[attr]
|
||||
if attr == "FontBBox":
|
||||
value = "%s %s %s %s" % value
|
||||
@ -269,13 +269,13 @@ class AFM:
|
||||
writelines(path, lines, sep)
|
||||
|
||||
def has_kernpair(self, pair):
|
||||
return self._kerning.has_key(pair)
|
||||
return pair in self._kerning
|
||||
|
||||
def kernpairs(self):
|
||||
return self._kerning.keys()
|
||||
|
||||
def has_char(self, char):
|
||||
return self._chars.has_key(char)
|
||||
return char in self._chars
|
||||
|
||||
def chars(self):
|
||||
return self._chars.keys()
|
||||
@ -290,7 +290,7 @@ class AFM:
|
||||
self._composites[glyphName] = components
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if self._attrs.has_key(attr):
|
||||
if attr in self._attrs:
|
||||
return self._attrs[attr]
|
||||
else:
|
||||
raise AttributeError, attr
|
||||
|
@ -724,7 +724,7 @@ def _builddicts():
|
||||
assert len(unicode) == 4
|
||||
unicode = int(unicode, 16)
|
||||
glyphName = m.group(2)
|
||||
if AGL2UV.has_key(glyphName):
|
||||
if glyphName in AGL2UV:
|
||||
# the above table contains identical duplicates
|
||||
assert AGL2UV[glyphName] == unicode
|
||||
else:
|
||||
|
@ -526,7 +526,7 @@ class CharStrings:
|
||||
return self.charStrings.values()
|
||||
|
||||
def has_key(self, name):
|
||||
return self.charStrings.has_key(name)
|
||||
return name in self.charStrings
|
||||
|
||||
def __len__(self):
|
||||
return len(self.charStrings)
|
||||
@ -788,7 +788,7 @@ class CharsetConverter:
|
||||
if DEBUG:
|
||||
print " charset end at %s" % file.tell()
|
||||
else: # offset == 0 -> no charset data.
|
||||
if isCID or not parent.rawDict.has_key("CharStrings"):
|
||||
if isCID or "CharStrings" not in parent.rawDict:
|
||||
assert value == 0 # We get here only when processing fontDicts from the FDArray of CFF-CID fonts. Only the real topDict references the chrset.
|
||||
charset = None
|
||||
elif value == 0:
|
||||
@ -992,7 +992,7 @@ class EncodingConverter(SimpleConverter):
|
||||
xmlWriter.newline()
|
||||
|
||||
def xmlRead(self, (name, attrs, content), parent):
|
||||
if attrs.has_key("name"):
|
||||
if "name" in attrs:
|
||||
return attrs["name"]
|
||||
encoding = [".notdef"] * 256
|
||||
for element in content:
|
||||
@ -1613,9 +1613,9 @@ class IndexedStrings:
|
||||
def getSID(self, s):
|
||||
if not hasattr(self, "stringMapping"):
|
||||
self.buildStringMapping()
|
||||
if cffStandardStringMapping.has_key(s):
|
||||
if s in cffStandardStringMapping:
|
||||
SID = cffStandardStringMapping[s]
|
||||
elif self.stringMapping.has_key(s):
|
||||
elif s in self.stringMapping:
|
||||
SID = self.stringMapping[s]
|
||||
else:
|
||||
SID = len(self.strings) + cffStandardStringCount
|
||||
|
@ -67,7 +67,7 @@ def pack(format, object):
|
||||
object = object.__dict__
|
||||
for name in names:
|
||||
value = object[name]
|
||||
if fixes.has_key(name):
|
||||
if name in fixes:
|
||||
# fixed point conversion
|
||||
value = int(round(value*fixes[name]))
|
||||
elements.append(value)
|
||||
@ -86,7 +86,7 @@ def unpack(format, data, object=None):
|
||||
for i in range(len(names)):
|
||||
name = names[i]
|
||||
value = elements[i]
|
||||
if fixes.has_key(name):
|
||||
if name in fixes:
|
||||
# fixed point conversion
|
||||
value = value / fixes[name]
|
||||
dict[name] = value
|
||||
|
@ -78,13 +78,13 @@ class XMLReader:
|
||||
print msg
|
||||
if tag == "GlyphOrder":
|
||||
tableClass = ttLib.GlyphOrder
|
||||
elif attrs.has_key("ERROR"):
|
||||
elif "ERROR" in attrs:
|
||||
tableClass = DefaultTable
|
||||
else:
|
||||
tableClass = ttLib.getTableClass(tag)
|
||||
if tableClass is None:
|
||||
tableClass = DefaultTable
|
||||
if tag == 'loca' and self.ttFont.has_key(tag):
|
||||
if tag == 'loca' and tag in self.ttFont:
|
||||
# Special-case the 'loca' table as we need the
|
||||
# original if the 'glyf' table isn't recompiled.
|
||||
self.currentTable = self.ttFont[tag]
|
||||
|
@ -290,7 +290,7 @@ class TTFont:
|
||||
debugmsg("Done dumping TTX")
|
||||
|
||||
def _tableToXML(self, writer, tag, progress, quiet):
|
||||
if self.has_key(tag):
|
||||
if tag in self:
|
||||
table = self[tag]
|
||||
report = "Dumping '%s' table..." % tag
|
||||
else:
|
||||
@ -302,7 +302,7 @@ class TTFont:
|
||||
else:
|
||||
if not quiet:
|
||||
print report
|
||||
if not self.has_key(tag):
|
||||
if tag not in self:
|
||||
return
|
||||
xmlTag = tagToXML(tag)
|
||||
if hasattr(table, "ERROR"):
|
||||
@ -322,7 +322,7 @@ class TTFont:
|
||||
"""Import a TTX file (an XML-based text format), so as to recreate
|
||||
a font object.
|
||||
"""
|
||||
if self.has_key("maxp") and self.has_key("post"):
|
||||
if "maxp" in self and "post" in self:
|
||||
# Make sure the glyph order is loaded, as it otherwise gets
|
||||
# lost if the XML doesn't contain the glyph order, yet does
|
||||
# contain the table which was originally used to extract the
|
||||
@ -337,12 +337,12 @@ class TTFont:
|
||||
def isLoaded(self, tag):
|
||||
"""Return true if the table identified by 'tag' has been
|
||||
decompiled and loaded into memory."""
|
||||
return self.tables.has_key(tag)
|
||||
return tag in self.tables
|
||||
|
||||
def has_key(self, tag):
|
||||
if self.isLoaded(tag):
|
||||
return 1
|
||||
elif self.reader and self.reader.has_key(tag):
|
||||
elif self.reader and tag in self.reader:
|
||||
return 1
|
||||
elif tag == "GlyphOrder":
|
||||
return 1
|
||||
@ -407,11 +407,11 @@ class TTFont:
|
||||
self.tables[tag] = table
|
||||
|
||||
def __delitem__(self, tag):
|
||||
if not self.has_key(tag):
|
||||
if tag not in self:
|
||||
raise KeyError, "'%s' table not found" % tag
|
||||
if self.tables.has_key(tag):
|
||||
if tag in self.tables:
|
||||
del self.tables[tag]
|
||||
if self.reader and self.reader.has_key(tag):
|
||||
if self.reader and tag in self.reader:
|
||||
del self.reader[tag]
|
||||
|
||||
def setGlyphOrder(self, glyphOrder):
|
||||
@ -422,10 +422,10 @@ class TTFont:
|
||||
return self.glyphOrder
|
||||
except AttributeError:
|
||||
pass
|
||||
if self.has_key('CFF '):
|
||||
if 'CFF ' in self:
|
||||
cff = self['CFF ']
|
||||
self.glyphOrder = cff.getGlyphOrder()
|
||||
elif self.has_key('post'):
|
||||
elif 'post' in self:
|
||||
# TrueType font
|
||||
glyphOrder = self['post'].getGlyphOrder()
|
||||
if glyphOrder is None:
|
||||
@ -490,9 +490,9 @@ class TTFont:
|
||||
allNames = {}
|
||||
for i in range(numGlyphs):
|
||||
tempName = glyphOrder[i]
|
||||
if reversecmap.has_key(tempName):
|
||||
if tempName in reversecmap:
|
||||
unicode = reversecmap[tempName]
|
||||
if agl.UV2AGL.has_key(unicode):
|
||||
if unicode in agl.UV2AGL:
|
||||
# get name from the Adobe Glyph List
|
||||
glyphName = agl.UV2AGL[unicode]
|
||||
else:
|
||||
@ -501,7 +501,7 @@ class TTFont:
|
||||
hex(unicode)[2:], 4))
|
||||
tempName = glyphName
|
||||
n = 1
|
||||
while allNames.has_key(tempName):
|
||||
while tempName in allNames:
|
||||
tempName = glyphName + "#" + `n`
|
||||
n = n + 1
|
||||
glyphOrder[i] = tempName
|
||||
@ -554,7 +554,7 @@ class TTFont:
|
||||
self._buildReverseGlyphOrderDict()
|
||||
glyphOrder = self.getGlyphOrder()
|
||||
d = self._reverseGlyphOrderDict
|
||||
if not d.has_key(glyphName):
|
||||
if glyphName not in d:
|
||||
if glyphName in glyphOrder:
|
||||
self._buildReverseGlyphOrderDict()
|
||||
return self.getGlyphID(glyphName)
|
||||
@ -605,7 +605,7 @@ class TTFont:
|
||||
tableClass = getTableClass(tag)
|
||||
for masterTable in tableClass.dependencies:
|
||||
if masterTable not in done:
|
||||
if self.has_key(masterTable):
|
||||
if masterTable in self:
|
||||
self._writeTable(masterTable, writer, done)
|
||||
else:
|
||||
done.append(masterTable)
|
||||
@ -622,7 +622,7 @@ class TTFont:
|
||||
if self.verbose:
|
||||
debugmsg("compiling '%s' table" % tag)
|
||||
return self.tables[tag].compile(self)
|
||||
elif self.reader and self.reader.has_key(tag):
|
||||
elif self.reader and tag in self.reader:
|
||||
if self.verbose:
|
||||
debugmsg("Reading '%s' table from disk" % tag)
|
||||
return self.reader[tag]
|
||||
@ -641,11 +641,11 @@ class TTFont:
|
||||
If the font contains both a 'CFF ' and a 'glyf' table, you can use
|
||||
the 'preferCFF' argument to specify which one should be taken.
|
||||
"""
|
||||
if preferCFF and self.has_key("CFF "):
|
||||
if preferCFF and "CFF " in self:
|
||||
return self["CFF "].cff.values()[0].CharStrings
|
||||
if self.has_key("glyf"):
|
||||
if "glyf" in self:
|
||||
return _TTGlyphSet(self)
|
||||
if self.has_key("CFF "):
|
||||
if "CFF " in self:
|
||||
return self["CFF "].cff.values()[0].CharStrings
|
||||
raise TTLibError, "Font contains no outlines"
|
||||
|
||||
@ -667,7 +667,7 @@ class _TTGlyphSet:
|
||||
return self._ttFont["glyf"].keys()
|
||||
|
||||
def has_key(self, glyphName):
|
||||
return self._ttFont["glyf"].has_key(glyphName)
|
||||
return glyphName in self._ttFont["glyf"]
|
||||
|
||||
__contains__ = has_key
|
||||
|
||||
|
@ -172,20 +172,20 @@ class SFNTResourceWriter:
|
||||
names = {}
|
||||
for code, name in cmap.cmap.items():
|
||||
names[name] = code
|
||||
if self.ttFont.has_key('kern'):
|
||||
if 'kern' in self.ttFont:
|
||||
kern = self.ttFont['kern'].getkern(0)
|
||||
if kern:
|
||||
fondkerning = []
|
||||
for (left, right), value in kern.kernTable.items():
|
||||
if names.has_key(left) and names.has_key(right):
|
||||
if left in names and right in names:
|
||||
fondkerning.append((names[left], names[right], scale * value))
|
||||
fondkerning.sort()
|
||||
fond.kernTables = {0: fondkerning}
|
||||
if self.ttFont.has_key('hmtx'):
|
||||
if 'hmtx' in self.ttFont:
|
||||
hmtx = self.ttFont['hmtx']
|
||||
fondwidths = [2048] * 256 + [0, 0] # default width, + plus two zeros.
|
||||
for name, (width, lsb) in hmtx.metrics.items():
|
||||
if names.has_key(name):
|
||||
if name in names:
|
||||
fondwidths[names[name]] = scale * width
|
||||
fond.widthTables = {0: fondwidths}
|
||||
fond.save()
|
||||
|
@ -68,7 +68,9 @@ class SFNTReader:
|
||||
self.flavorData = WOFFFlavorData(self)
|
||||
|
||||
def has_key(self, tag):
|
||||
return self.tables.has_key(tag)
|
||||
return tag in self.tables
|
||||
|
||||
__contains__ = has_key
|
||||
|
||||
def keys(self):
|
||||
return self.tables.keys()
|
||||
@ -132,7 +134,7 @@ class SFNTWriter:
|
||||
def __setitem__(self, tag, data):
|
||||
"""Write raw table data to disk."""
|
||||
reuse = False
|
||||
if self.tables.has_key(tag):
|
||||
if tag in self.tables:
|
||||
# We've written this table to file before. If the length
|
||||
# of the data is still the same, we allow overwriting it.
|
||||
entry = self.tables[tag]
|
||||
|
@ -114,7 +114,7 @@ class table_C_O_L_R_(DefaultTable.DefaultTable):
|
||||
layer.fromXML(element, ttFont)
|
||||
layers.append (layer)
|
||||
operator.setitem(self, glyphName, layers)
|
||||
elif attrs.has_key("value"):
|
||||
elif "value" in attrs:
|
||||
value = safeEval(attrs["value"])
|
||||
setattr(self, name, value)
|
||||
|
||||
@ -124,7 +124,7 @@ class table_C_O_L_R_(DefaultTable.DefaultTable):
|
||||
# its a gid, convert to glyph name
|
||||
glyphSelector = self.getGlyphName(glyphSelector)
|
||||
|
||||
if not self.ColorLayers.has_key(glyphSelector):
|
||||
if glyphSelector not in self.ColorLayers:
|
||||
return None
|
||||
|
||||
return self.ColorLayers[glyphSelector]
|
||||
@ -136,7 +136,7 @@ class table_C_O_L_R_(DefaultTable.DefaultTable):
|
||||
|
||||
if value:
|
||||
self.ColorLayers[glyphSelector] = value
|
||||
elif self.ColorLayers.has_key(glyphSelector):
|
||||
elif glyphSelector in self.ColorLayers:
|
||||
del self.ColorLayers[glyphSelector]
|
||||
|
||||
class LayerRecord:
|
||||
|
@ -69,7 +69,7 @@ class table_C_P_A_L_(DefaultTable.DefaultTable):
|
||||
color.fromXML(element, ttFont)
|
||||
palette.append (color)
|
||||
self.palettes.append(palette)
|
||||
elif attrs.has_key("value"):
|
||||
elif "value" in attrs:
|
||||
value = safeEval(attrs["value"])
|
||||
setattr(self, name, value)
|
||||
|
||||
|
@ -48,7 +48,7 @@ class table_T_S_I__1(DefaultTable.DefaultTable):
|
||||
if len(data) % 2:
|
||||
data = data + "\015" # align on 2-byte boundaries, fill with return chars. Yum.
|
||||
name = glyphNames[i]
|
||||
if self.glyphPrograms.has_key(name):
|
||||
if name in self.glyphPrograms:
|
||||
text = self.glyphPrograms[name]
|
||||
else:
|
||||
text = ""
|
||||
@ -65,7 +65,7 @@ class table_T_S_I__1(DefaultTable.DefaultTable):
|
||||
if len(data) % 2:
|
||||
data = data + "\015" # align on 2-byte boundaries, fill with return chars.
|
||||
code, name = codes[i]
|
||||
if self.extraPrograms.has_key(name):
|
||||
if name in self.extraPrograms:
|
||||
text = self.extraPrograms[name]
|
||||
else:
|
||||
text = ""
|
||||
|
@ -93,7 +93,7 @@ class table_V_O_R_G_(DefaultTable.DefaultTable):
|
||||
continue
|
||||
vOriginRec.fromXML(element, ttFont)
|
||||
self.VOriginRecords[vOriginRec.glyphName] = vOriginRec.vOrigin
|
||||
elif attrs.has_key("value"):
|
||||
elif "value" in attrs:
|
||||
value = safeEval(attrs["value"])
|
||||
setattr(self, name, value)
|
||||
|
||||
@ -103,7 +103,7 @@ class table_V_O_R_G_(DefaultTable.DefaultTable):
|
||||
# its a gid, convert to glyph name
|
||||
glyphSelector = self.getGlyphName(glyphSelector)
|
||||
|
||||
if not self.VOriginRecords.has_key(glyphSelector):
|
||||
if glyphSelector not in self.VOriginRecords:
|
||||
return self.defaultVertOriginY
|
||||
|
||||
return self.VOriginRecords[glyphSelector]
|
||||
@ -115,7 +115,7 @@ class table_V_O_R_G_(DefaultTable.DefaultTable):
|
||||
|
||||
if value != self.defaultVertOriginY:
|
||||
self.VOriginRecords[glyphSelector] = value
|
||||
elif self.VOriginRecords.has_key(glyphSelector):
|
||||
elif glyphSelector in self.VOriginRecords:
|
||||
del self.VOriginRecords[glyphSelector]
|
||||
|
||||
class VOriginRecord:
|
||||
|
@ -35,7 +35,7 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
|
||||
if not length:
|
||||
print "Error: cmap subtable is reported as having zero length: platformID %s, platEncID %s, format %s offset %s. Skipping table." % (platformID, platEncID,format, offset)
|
||||
continue
|
||||
if not cmap_classes.has_key(format):
|
||||
if format not in cmap_classes:
|
||||
table = cmap_format_unknown(format)
|
||||
else:
|
||||
table = cmap_classes[format](format)
|
||||
@ -45,7 +45,7 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
|
||||
# any other data gets decompiled only when an attribute of the
|
||||
# subtable is referenced.
|
||||
table.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||
if seenOffsets.has_key(offset):
|
||||
if offset in seenOffsets:
|
||||
table.cmap = tables[seenOffsets[offset]].cmap
|
||||
else:
|
||||
seenOffsets[offset] = i
|
||||
@ -64,7 +64,7 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
|
||||
offset = seen[id(table.cmap)]
|
||||
except KeyError:
|
||||
chunk = table.compile(ttFont)
|
||||
if done.has_key(chunk):
|
||||
if chunk in done:
|
||||
offset = done[chunk]
|
||||
else:
|
||||
offset = seen[id(table.cmap)] = done[chunk] = totalOffset + len(tableData)
|
||||
@ -87,7 +87,7 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
|
||||
if not hasattr(self, "tables"):
|
||||
self.tables = []
|
||||
format = safeEval(name[12:])
|
||||
if not cmap_classes.has_key(format):
|
||||
if format not in cmap_classes:
|
||||
table = cmap_format_unknown(format)
|
||||
else:
|
||||
table = cmap_classes[format](format)
|
||||
|
@ -144,7 +144,7 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
|
||||
return self.glyphs.keys()
|
||||
|
||||
def has_key(self, glyphName):
|
||||
return self.glyphs.has_key(glyphName)
|
||||
return glyphName in self.glyphs
|
||||
|
||||
__contains__ = has_key
|
||||
|
||||
@ -864,23 +864,23 @@ class GlyphComponent:
|
||||
|
||||
def fromXML(self, (name, attrs, content), ttFont):
|
||||
self.glyphName = attrs["glyphName"]
|
||||
if attrs.has_key("firstPt"):
|
||||
if "firstPt" in attrs:
|
||||
self.firstPt = safeEval(attrs["firstPt"])
|
||||
self.secondPt = safeEval(attrs["secondPt"])
|
||||
else:
|
||||
self.x = safeEval(attrs["x"])
|
||||
self.y = safeEval(attrs["y"])
|
||||
if attrs.has_key("scale01"):
|
||||
if "scale01" in attrs:
|
||||
scalex = safeEval(attrs["scalex"])
|
||||
scale01 = safeEval(attrs["scale01"])
|
||||
scale10 = safeEval(attrs["scale10"])
|
||||
scaley = safeEval(attrs["scaley"])
|
||||
self.transform = [[scalex, scale01], [scale10, scaley]]
|
||||
elif attrs.has_key("scalex"):
|
||||
elif "scalex" in attrs:
|
||||
scalex = safeEval(attrs["scalex"])
|
||||
scaley = safeEval(attrs["scaley"])
|
||||
self.transform = [[scalex, 0], [0, scaley]]
|
||||
elif attrs.has_key("scale"):
|
||||
elif "scale" in attrs:
|
||||
scale = safeEval(attrs["scale"])
|
||||
self.transform = [[scale, 0], [0, scale]]
|
||||
self.flags = safeEval(attrs["flags"])
|
||||
|
@ -39,7 +39,7 @@ class table__h_h_e_a(DefaultTable.DefaultTable):
|
||||
|
||||
def recalc(self, ttFont):
|
||||
hmtxTable = ttFont['hmtx']
|
||||
if ttFont.has_key('glyf'):
|
||||
if 'glyf' in ttFont:
|
||||
glyfTable = ttFont['glyf']
|
||||
INFINITY = 100000
|
||||
advanceWidthMax = 0
|
||||
|
@ -36,7 +36,7 @@ class table__k_e_r_n(DefaultTable.DefaultTable):
|
||||
else:
|
||||
version, length = struct.unpack(">HH", data[:4])
|
||||
length = int(length)
|
||||
if not kern_classes.has_key(version):
|
||||
if version not in kern_classes:
|
||||
subtable = KernTable_format_unkown(version)
|
||||
else:
|
||||
subtable = kern_classes[version]()
|
||||
@ -75,7 +75,7 @@ class table__k_e_r_n(DefaultTable.DefaultTable):
|
||||
if not hasattr(self, "kernTables"):
|
||||
self.kernTables = []
|
||||
format = safeEval(attrs["format"])
|
||||
if not kern_classes.has_key(format):
|
||||
if format not in kern_classes:
|
||||
subtable = KernTable_format_unkown(format)
|
||||
else:
|
||||
subtable = kern_classes[format]()
|
||||
|
@ -38,7 +38,7 @@ class table__m_a_x_p(DefaultTable.DefaultTable):
|
||||
assert len(data) == 0
|
||||
|
||||
def compile(self, ttFont):
|
||||
if ttFont.has_key('glyf'):
|
||||
if 'glyf' in ttFont:
|
||||
if ttFont.isLoaded('glyf') and ttFont.recalcBBoxes:
|
||||
self.recalc(ttFont)
|
||||
else:
|
||||
|
@ -58,7 +58,7 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
|
||||
lastoffset = 0
|
||||
done = {} # remember the data so we can reuse the "pointers"
|
||||
for name in self.names:
|
||||
if done.has_key(name.string):
|
||||
if name.string in done:
|
||||
name.offset, name.length = done[name.string]
|
||||
else:
|
||||
name.offset, name.length = done[name.string] = len(stringData), len(name.string)
|
||||
|
@ -105,7 +105,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
allNames = {}
|
||||
for i in range(ttFont['maxp'].numGlyphs):
|
||||
glyphName = psName = self.glyphOrder[i]
|
||||
if allNames.has_key(glyphName):
|
||||
if glyphName in allNames:
|
||||
# make up a new glyphName that's unique
|
||||
n = allNames[glyphName]
|
||||
allNames[glyphName] = n + 1
|
||||
@ -132,11 +132,11 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
extraDict[extraNames[i]] = i
|
||||
for glyphID in range(numGlyphs):
|
||||
glyphName = glyphOrder[glyphID]
|
||||
if self.mapping.has_key(glyphName):
|
||||
if glyphName in self.mapping:
|
||||
psName = self.mapping[glyphName]
|
||||
else:
|
||||
psName = glyphName
|
||||
if extraDict.has_key(psName):
|
||||
if psName in extraDict:
|
||||
index = 258 + extraDict[psName]
|
||||
elif psName in standardGlyphOrder:
|
||||
index = standardGlyphOrder.index(psName)
|
||||
|
@ -36,7 +36,7 @@ class table__v_h_e_a(DefaultTable.DefaultTable):
|
||||
|
||||
def recalc(self, ttFont):
|
||||
vtmxTable = ttFont['vmtx']
|
||||
if ttFont.has_key('glyf'):
|
||||
if 'glyf' in ttFont:
|
||||
if not ttFont.isLoaded('glyf'):
|
||||
return
|
||||
glyfTable = ttFont['glyf']
|
||||
|
@ -320,7 +320,7 @@ class OTTableWriter(object):
|
||||
item._doneWriting()
|
||||
else:
|
||||
item._doneWriting(internedTables)
|
||||
if internedTables.has_key(item):
|
||||
if item in internedTables:
|
||||
items[i] = item = internedTables[item]
|
||||
else:
|
||||
internedTables[item] = item
|
||||
@ -359,7 +359,7 @@ class OTTableWriter(object):
|
||||
if hasattr(item, "name") and (item.name == "Coverage"):
|
||||
sortCoverageLast = 1
|
||||
break
|
||||
if not done.has_key(item):
|
||||
if item not in done:
|
||||
item._gatherTables(tables, extTables, done)
|
||||
else:
|
||||
index = max(item.parent.keys())
|
||||
@ -380,7 +380,7 @@ class OTTableWriter(object):
|
||||
newDone = {}
|
||||
item._gatherTables(extTables, None, newDone)
|
||||
|
||||
elif not done.has_key(item):
|
||||
elif item not in done:
|
||||
item._gatherTables(tables, extTables, done)
|
||||
else:
|
||||
index = max(item.parent.keys())
|
||||
|
@ -38,7 +38,7 @@ def buildConverters(tableSpec, tableNamespace):
|
||||
for cls in conv.featureParamTypes.values():
|
||||
convertersByName[cls.__name__] = Table(name, repeat, aux, cls)
|
||||
converters.append(conv)
|
||||
assert not convertersByName.has_key(name)
|
||||
assert name not in convertersByName
|
||||
convertersByName[name] = conv
|
||||
return converters, convertersByName
|
||||
|
||||
|
@ -662,7 +662,7 @@ def _buildClasses():
|
||||
# XxxFormatN subtable, we only add the "base" table
|
||||
name = m.group(1)
|
||||
baseClass = FormatSwitchingBaseTable
|
||||
if not namespace.has_key(name):
|
||||
if name not in namespace:
|
||||
# the class doesn't exist yet, so the base implementation is used.
|
||||
cls = new.classobj(name, (baseClass,), {})
|
||||
namespace[name] = cls
|
||||
|
Loading…
x
Reference in New Issue
Block a user