2to3 --fix=types manual additions
Don't know why the tool didn't catch these.
diff --git a/Lib/fontTools/afmLib.py b/Lib/fontTools/afmLib.py
index da6c9f5..b5aa79b 100644
--- a/Lib/fontTools/afmLib.py
+++ b/Lib/fontTools/afmLib.py
@@ -6,7 +6,6 @@
import re
import string
-import types
__version__ = "$Id: afmLib.py,v 1.6 2003-05-24 12:50:47 jvr Exp $"
diff --git a/Lib/fontTools/misc/psCharStrings.py b/Lib/fontTools/misc/psCharStrings.py
index 162b1e3..6894e92 100644
--- a/Lib/fontTools/misc/psCharStrings.py
+++ b/Lib/fontTools/misc/psCharStrings.py
@@ -2,7 +2,6 @@
CFF dictionary data and Type1/Type2 CharStrings.
"""
-import types
import struct
import string
diff --git a/Lib/fontTools/misc/sstruct.py b/Lib/fontTools/misc/sstruct.py
index b5b7595..d57e956 100644
--- a/Lib/fontTools/misc/sstruct.py
+++ b/Lib/fontTools/misc/sstruct.py
@@ -55,7 +55,6 @@
import struct
import re
-import types
error = "sstruct.error"
diff --git a/Lib/fontTools/nfntLib.py b/Lib/fontTools/nfntLib.py
index 5e25c1b..2c340e5 100644
--- a/Lib/fontTools/nfntLib.py
+++ b/Lib/fontTools/nfntLib.py
@@ -1,7 +1,6 @@
import struct
from fontTools.misc import sstruct
import string
-import types
# FontRec header
diff --git a/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py b/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
index f5d0f02..57d896e 100644
--- a/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
+++ b/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
@@ -1,7 +1,6 @@
# Since bitmap glyph metrics are shared between EBLC and EBDT
# this class gets its own python file.
from fontTools.misc import sstruct
-from types import TupleType
from fontTools.misc.textTools import safeEval
@@ -40,7 +39,7 @@
def fromXML(self, name, attrs, content, ttFont):
metricNames = set(sstruct.getformat(self.__class__.binaryFormat)[1])
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
# Make sure this is a metric that is needed by GlyphMetrics.
diff --git a/Lib/fontTools/ttLib/tables/C_O_L_R_.py b/Lib/fontTools/ttLib/tables/C_O_L_R_.py
index 3713340..d4f9cdb 100644
--- a/Lib/fontTools/ttLib/tables/C_O_L_R_.py
+++ b/Lib/fontTools/ttLib/tables/C_O_L_R_.py
@@ -7,7 +7,6 @@
import struct
from fontTools.ttLib import sfnt
from fontTools.misc.textTools import safeEval, readHex
-from types import IntType, StringType
class table_C_O_L_R_(DefaultTable.DefaultTable):
@@ -104,11 +103,11 @@
if name == "ColorGlyph":
glyphName = attrs["name"]
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
layers = []
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
layer = LayerRecord()
layer.fromXML(element[0], element[1], element[2], ttFont)
@@ -119,7 +118,7 @@
def __getitem__(self, glyphSelector):
- if isinstance(glyphSelector, IntType):
+ if isinstance(glyphSelector, int):
# its a gid, convert to glyph name
glyphSelector = self.getGlyphName(glyphSelector)
@@ -129,7 +128,7 @@
return self.ColorLayers[glyphSelector]
def __setitem__(self, glyphSelector, value):
- if isinstance(glyphSelector, IntType):
+ if isinstance(glyphSelector, int):
# its a gid, convert to glyph name
glyphSelector = self.getGlyphName(glyphSelector)
@@ -151,7 +150,7 @@
def fromXML(self, eltname, attrs, content, ttFont):
for (name, value) in attrs.items():
if name == "name":
- if isinstance(value, IntType):
+ if isinstance(value, int):
value = ttFont.getGlyphName(value)
setattr(self, name, value)
else:
diff --git a/Lib/fontTools/ttLib/tables/C_P_A_L_.py b/Lib/fontTools/ttLib/tables/C_P_A_L_.py
index 58f47bd..d525642 100644
--- a/Lib/fontTools/ttLib/tables/C_P_A_L_.py
+++ b/Lib/fontTools/ttLib/tables/C_P_A_L_.py
@@ -7,7 +7,6 @@
import struct
from fontTools.ttLib import sfnt
from fontTools.misc.textTools import safeEval, readHex
-from types import IntType, StringType
class table_C_P_A_L_(DefaultTable.DefaultTable):
@@ -59,11 +58,11 @@
if name == "palette":
palette = []
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
palette = []
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
color = Color()
color.fromXML(element[0], element[1], element[2], ttFont)
diff --git a/Lib/fontTools/ttLib/tables/E_B_D_T_.py b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
index 2a1a0d8..7a1dbb6 100644
--- a/Lib/fontTools/ttLib/tables/E_B_D_T_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
@@ -5,7 +5,6 @@
import struct
from fontTools.misc import sstruct
import itertools
-from types import TupleType
from fontTools.misc.textTools import safeEval, readHex, hexStr, deHexStr
from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat
@@ -155,7 +154,7 @@
bitmapGlyphDict = {}
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name[4:].startswith(_bitmapGlyphSubclassPrefix[4:]):
@@ -191,7 +190,7 @@
self.name = attrs['name']
componentNames = set(sstruct.getformat(ebdtComponentFormat)[1][1:])
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name in componentNames:
@@ -287,7 +286,7 @@
dataRows = []
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attr, content = element
# Chop off 'imagedata' from the tag to get just the option.
@@ -328,7 +327,7 @@
dataRows = []
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attr, content = element
if name == 'row':
@@ -415,7 +414,7 @@
def fromXML(self, name, attrs, content, ttFont):
self.readMetrics(name, attrs, content, ttFont)
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attr, content = element
# Chop off 'imagedata' from the tag to get just the option.
@@ -464,7 +463,7 @@
def readMetrics(self, name, attrs, content, ttFont):
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == curMetricsName:
@@ -671,13 +670,13 @@
def fromXML(self, name, attrs, content, ttFont):
self.readMetrics(name, attrs, content, ttFont)
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attr, content = element
if name == 'components':
self.componentArray = []
for compElement in content:
- if not isinstance(compElement, TupleType):
+ if not isinstance(compElement, tuple):
continue
name, attrs, content = compElement
if name == 'ebdtComponent':
diff --git a/Lib/fontTools/ttLib/tables/E_B_L_C_.py b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
index d2fc80a..8bff48a 100644
--- a/Lib/fontTools/ttLib/tables/E_B_L_C_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
@@ -4,7 +4,6 @@
import struct
from fontTools.misc import sstruct
import itertools
-from types import TupleType
from collections import deque
from fontTools.misc.textTools import safeEval
from .BitmapGlyphMetrics import BigGlyphMetrics, bigGlyphMetricsFormat, SmallGlyphMetrics, smallGlyphMetricsFormat
@@ -242,7 +241,7 @@
def fromXML(self, name, attrs, content, ttFont, locator):
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == 'bitmapSizeTable':
@@ -282,7 +281,7 @@
# bitmap size table. Only read the information from these names.
dataNames = set(self._getXMLMetricNames())
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == 'sbitLineMetrics':
@@ -311,7 +310,7 @@
def fromXML(self, name, attrs, content, ttFont):
metricNames = set(sstruct.getformat(sbitLineMetricsFormat)[1])
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name in metricNames:
@@ -378,7 +377,7 @@
self.names = []
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == 'glyphLoc':
@@ -494,7 +493,7 @@
def readMetrics(self, name, attrs, content, ttFont):
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == 'imageSize':
diff --git a/Lib/fontTools/ttLib/tables/G_M_A_P_.py b/Lib/fontTools/ttLib/tables/G_M_A_P_.py
index 1189fc4..7791457 100644
--- a/Lib/fontTools/ttLib/tables/G_M_A_P_.py
+++ b/Lib/fontTools/ttLib/tables/G_M_A_P_.py
@@ -1,6 +1,5 @@
from . import DefaultTable
from fontTools.misc import sstruct
-from types import StringType
from fontTools.misc.textTools import safeEval, num2binary, binary2num
GMAPFormat = """
@@ -120,7 +119,7 @@
gmapRecord = GMAPRecord()
self.gmapRecords.append(gmapRecord)
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
name, attrs, content = element
gmapRecord.fromXML(name, attrs, content, ttFont)
diff --git a/Lib/fontTools/ttLib/tables/G_P_K_G_.py b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
index 971f938..f3f8bbb 100644
--- a/Lib/fontTools/ttLib/tables/G_P_K_G_.py
+++ b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
@@ -2,7 +2,6 @@
from . import DefaultTable
from fontTools.misc import sstruct
import array
-from types import StringType
from fontTools.misc.textTools import safeEval, readHex
from fontTools import ttLib
@@ -112,7 +111,7 @@
if not hasattr(self, "GMAPs"):
self.GMAPs = []
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
itemName, itemAttrs, itemContent = element
if itemName == "hexdata":
@@ -121,7 +120,7 @@
if not hasattr(self, "glyphlets"):
self.glyphlets = []
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
itemName, itemAttrs, itemContent = element
if itemName == "hexdata":
diff --git a/Lib/fontTools/ttLib/tables/M_E_T_A_.py b/Lib/fontTools/ttLib/tables/M_E_T_A_.py
index 4c51e74..9137a76 100644
--- a/Lib/fontTools/ttLib/tables/M_E_T_A_.py
+++ b/Lib/fontTools/ttLib/tables/M_E_T_A_.py
@@ -3,8 +3,9 @@
from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval
import string
-from types import FloatType, ListType, StringType, TupleType
import sys
+
+
METAHeaderFormat = """
> # big endian
tableVersionMajor: H
@@ -173,7 +174,7 @@
glyphRec = GlyphRecord()
self.glyphRecords.append(glyphRec)
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
name, attrs, content = element
glyphRec.fromXML(name, attrs, content, ttFont)
@@ -208,7 +209,7 @@
stringRec = StringRecord()
self.stringRecs.append(stringRec)
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
stringRec.fromXML(name, attrs, content, ttFont)
stringRec.stringLen = len(stringRec.string)
diff --git a/Lib/fontTools/ttLib/tables/O_S_2f_2.py b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
index 7428719..45db54f 100644
--- a/Lib/fontTools/ttLib/tables/O_S_2f_2.py
+++ b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
@@ -1,7 +1,6 @@
from . import DefaultTable
from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval, num2binary, binary2num
-from types import TupleType
import warnings
@@ -172,7 +171,7 @@
if name == "panose":
self.panose = panose = Panose()
for element in content:
- if isinstance(element, TupleType):
+ if isinstance(element, tuple):
name, attrs, content = element
panose.fromXML(name, attrs, content, ttFont)
elif name in ("ulUnicodeRange1", "ulUnicodeRange2",
diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py
index 3b68b35..f92d4e7 100644
--- a/Lib/fontTools/ttLib/tables/S_V_G_.py
+++ b/Lib/fontTools/ttLib/tables/S_V_G_.py
@@ -51,7 +51,6 @@
except ImportError:
import xml.etree.ElementTree as ET
import string
-import types
import re
XML = ET.XML
diff --git a/Lib/fontTools/ttLib/tables/V_O_R_G_.py b/Lib/fontTools/ttLib/tables/V_O_R_G_.py
index eb0b99c..a095dcd 100644
--- a/Lib/fontTools/ttLib/tables/V_O_R_G_.py
+++ b/Lib/fontTools/ttLib/tables/V_O_R_G_.py
@@ -3,7 +3,6 @@
import struct
from fontTools.ttLib import sfnt
from fontTools.misc.textTools import safeEval, readHex
-from types import IntType, StringType
class table_V_O_R_G_(DefaultTable.DefaultTable):
@@ -86,7 +85,7 @@
if name == "VOriginRecord":
vOriginRec = VOriginRecord()
for element in content:
- if isinstance(element, StringType):
+ if isinstance(element, str):
continue
name, attrs, content = element
vOriginRec.fromXML(name, attrs, content, ttFont)
@@ -96,7 +95,7 @@
def __getitem__(self, glyphSelector):
- if isinstance(glyphSelector, IntType):
+ if isinstance(glyphSelector, int):
# its a gid, convert to glyph name
glyphSelector = self.getGlyphName(glyphSelector)
@@ -106,7 +105,7 @@
return self.VOriginRecords[glyphSelector]
def __setitem__(self, glyphSelector, value):
- if isinstance(glyphSelector, IntType):
+ if isinstance(glyphSelector, int):
# its a gid, convert to glyph name
glyphSelector = self.getGlyphName(glyphSelector)
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index 1a0a0cd..5d4e7ce 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -5,7 +5,6 @@
import operator
from fontTools import ttLib
from fontTools.misc.textTools import safeEval, readHex
-from types import TupleType
class table__c_m_a_p(DefaultTable.DefaultTable):
@@ -207,7 +206,7 @@
self.cmap = {}
cmap = self.cmap
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "map":
@@ -526,7 +525,7 @@
cmap = self.cmap
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "map":
@@ -818,7 +817,7 @@
cmap = self.cmap
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
nameMap, attrsMap, dummyContent = element
if nameMap != "map":
@@ -887,7 +886,7 @@
cmap = self.cmap
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "map":
@@ -1029,7 +1028,7 @@
cmap = self.cmap
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "map":
@@ -1185,7 +1184,7 @@
uvsDict = self.uvsDict
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "map":
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
index fe41050..1f3ee8f 100644
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
@@ -23,7 +23,6 @@
from fontTools.misc.arrayTools import calcBounds
from . import ttProgram
import array
-from types import StringType, TupleType
import warnings
class table__g_l_y_f(DefaultTable.DefaultTable):
@@ -124,7 +123,7 @@
setattr(glyph, attr, safeEval(attrs.get(attr, '0')))
self.glyphs[glyphName] = glyph
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
glyph.fromXML(name, attrs, content, ttFont)
@@ -290,7 +289,7 @@
coordinates = GlyphCoordinates()
flags = []
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name != "pt":
@@ -318,7 +317,7 @@
elif name == "instructions":
self.program = ttProgram.Program()
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
self.program.fromXML(name, attrs, content, ttFont)
@@ -971,7 +970,7 @@
def reprflag(flag):
bin = ""
- if isinstance(flag, StringType):
+ if isinstance(flag, str):
flag = ord(flag)
while flag:
if flag & 0x01:
diff --git a/Lib/fontTools/ttLib/tables/_k_e_r_n.py b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
index b987a05..f96eb7b 100644
--- a/Lib/fontTools/ttLib/tables/_k_e_r_n.py
+++ b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
@@ -2,7 +2,6 @@
import struct
from fontTools.ttLib import sfnt
from fontTools.misc.textTools import safeEval, readHex
-from types import TupleType
import warnings
@@ -147,7 +146,7 @@
if not hasattr(self, "kernTable"):
self.kernTable = {}
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
self.kernTable[(attrs["l"], attrs["r"])] = safeEval(attrs["v"])
diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
index aa5f966..4a09413 100644
--- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py
+++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
@@ -3,7 +3,6 @@
from fontTools.misc import sstruct
from fontTools.misc.textTools import safeEval
import string
-import types
nameRecordFormat = """
> # big endian
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
index e26c3a0..838c83a 100644
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
@@ -6,7 +6,6 @@
import array
from fontTools import ttLib
from fontTools.misc.textTools import safeEval, readHex
-from types import TupleType
postFormat = """
@@ -194,7 +193,7 @@
elif name == "psNames":
self.mapping = {}
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == "psName":
@@ -202,7 +201,7 @@
elif name == "extraNames":
self.extraNames = []
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
if name == "psName":
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index 98bc2d4..a2a1077 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -1,7 +1,6 @@
from .DefaultTable import DefaultTable
from . import otData
import struct
-from types import TupleType
class OverflowErrorRecord:
def __init__(self, overflowTuple):
@@ -828,12 +827,12 @@
for k, v in attrs.items():
setattr(self, k, int(v))
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
value = getattr(otTables, name)()
for elem2 in content:
- if not isinstance(elem2, TupleType):
+ if not isinstance(elem2, tuple):
continue
name2, attrs2, content2 = elem2
value.fromXML(name2, attrs2, content2, font)
diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py
index b587022..e75335c 100644
--- a/Lib/fontTools/ttLib/tables/otConverters.py
+++ b/Lib/fontTools/ttLib/tables/otConverters.py
@@ -1,4 +1,3 @@
-from types import TupleType
from fontTools.misc.textTools import safeEval
from .otBase import ValueRecordFactory
@@ -198,7 +197,7 @@
if Format is not None:
table.Format = int(Format)
for element in content:
- if isinstance(element, TupleType):
+ if isinstance(element, tuple):
name, attrs, content = element
table.fromXML(name, attrs, content, font)
else:
diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py
index 2ad5765..ea1330c 100644
--- a/Lib/fontTools/ttLib/tables/otTables.py
+++ b/Lib/fontTools/ttLib/tables/otTables.py
@@ -6,7 +6,6 @@
"""
import operator
from .otBase import BaseTable, FormatSwitchingBaseTable
-from types import TupleType
import warnings
@@ -345,7 +344,7 @@
set = []
alternates[glyphName] = set
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
set.append(attrs["glyph"])
@@ -412,7 +411,7 @@
ligs = []
ligatures[glyphName] = ligs
for element in content:
- if not isinstance(element, TupleType):
+ if not isinstance(element, tuple):
continue
name, attrs, content = element
lig = Ligature()