2to3 --fix=raise
diff --git a/Lib/fontTools/ttLib/tables/C_F_F_.py b/Lib/fontTools/ttLib/tables/C_F_F_.py
index 6162a87..53427b4 100644
--- a/Lib/fontTools/ttLib/tables/C_F_F_.py
+++ b/Lib/fontTools/ttLib/tables/C_F_F_.py
@@ -29,7 +29,7 @@
def getGlyphOrder(self):
if self._gaveGlyphOrder:
from fontTools import ttLib
- raise ttLib.TTLibError, "illegal use of getGlyphOrder()"
+ raise ttLib.TTLibError("illegal use of getGlyphOrder()")
self._gaveGlyphOrder = 1
return self.cff[self.cff.fontNames[0]].getGlyphOrder()
diff --git a/Lib/fontTools/ttLib/tables/DefaultTable.py b/Lib/fontTools/ttLib/tables/DefaultTable.py
index b32057d..2578eb7 100644
--- a/Lib/fontTools/ttLib/tables/DefaultTable.py
+++ b/Lib/fontTools/ttLib/tables/DefaultTable.py
@@ -30,7 +30,7 @@
from fontTools.misc.textTools import readHex
from fontTools import ttLib
if name != "hexdata":
- raise ttLib.TTLibError, "can't handle '%s' element" % name
+ raise ttLib.TTLibError("can't handle '%s' element" % name)
self.decompile(readHex(content), ttFont)
def __repr__(self):
diff --git a/Lib/fontTools/ttLib/tables/E_B_D_T_.py b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
index 6ab1e05..758e633 100644
--- a/Lib/fontTools/ttLib/tables/E_B_D_T_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
@@ -390,9 +390,9 @@
def __getattr__(self, attr):
# Allow lazy decompile.
if attr[:2] == '__':
- raise AttributeError, attr
+ raise AttributeError(attr)
if not hasattr(self, "data"):
- raise AttributeError, attr
+ raise AttributeError(attr)
self.decompile()
del self.data
return getattr(self, attr)
diff --git a/Lib/fontTools/ttLib/tables/E_B_L_C_.py b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
index 9c671c5..89b8348 100644
--- a/Lib/fontTools/ttLib/tables/E_B_L_C_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
@@ -332,9 +332,9 @@
def __getattr__(self, attr):
# Allow lazy decompile.
if attr[:2] == '__':
- raise AttributeError, attr
+ raise AttributeError(attr)
if not hasattr(self, "data"):
- raise AttributeError, attr
+ raise AttributeError(attr)
self.decompile()
del self.data, self.ttFont
return getattr(self, attr)
diff --git a/Lib/fontTools/ttLib/tables/O_S_2f_2.py b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
index 7adbc18..a40e1e1 100644
--- a/Lib/fontTools/ttLib/tables/O_S_2f_2.py
+++ b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
@@ -113,7 +113,7 @@
self.usUpperOpticalPointSize /= 20.
elif self.version != 0:
from fontTools import ttLib
- raise ttLib.TTLibError, "unknown format for OS/2 table: version %s" % self.version
+ raise ttLib.TTLibError("unknown format for OS/2 table: version %s" % self.version)
if len(data):
warnings.warn("too much 'OS/2' table data")
@@ -135,7 +135,7 @@
data = sstruct.pack(OS2_format_5, d)
else:
from fontTools import ttLib
- raise ttLib.TTLibError, "unknown format for OS/2 table: version %s" % self.version
+ raise ttLib.TTLibError("unknown format for OS/2 table: version %s" % self.version)
self.panose = panose
return data
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index a4ac714..918f89a 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -107,9 +107,9 @@
def __getattr__(self, attr):
# allow lazy decompilation of subtables.
if attr[:2] == '__': # don't handle requests for member functions like '__lt__'
- raise AttributeError, attr
+ raise AttributeError(attr)
if self.data == None:
- raise AttributeError, attr
+ raise AttributeError(attr)
self.decompile(None, None) # use saved data.
self.data = None # Once this table has been decompiled, make sure we don't
# just return the original data. Also avoids recursion when
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
index dfe3b5f..965fd79 100644
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
@@ -43,7 +43,7 @@
next = int(loca[i+1])
glyphdata = data[last:next]
if len(glyphdata) != (next - last):
- raise ttLib.TTLibError, "not enough 'glyf' table data"
+ raise ttLib.TTLibError("not enough 'glyf' table data")
glyph = Glyph(glyphdata)
self.glyphs[glyphName] = glyph
last = next
@@ -284,7 +284,7 @@
def fromXML(self, (name, attrs, content), ttFont):
if name == "contour":
if self.numberOfContours < 0:
- raise ttLib.TTLibError, "can't mix composites and contours in glyph"
+ raise ttLib.TTLibError("can't mix composites and contours in glyph")
self.numberOfContours = self.numberOfContours + 1
coordinates = GlyphCoordinates()
flags = []
@@ -307,7 +307,7 @@
self.endPtsOfContours.append(len(self.coordinates)-1)
elif name == "component":
if self.numberOfContours > 0:
- raise ttLib.TTLibError, "can't mix composites and contours in glyph"
+ raise ttLib.TTLibError("can't mix composites and contours in glyph")
self.numberOfContours = -1
if not hasattr(self, "components"):
self.components = []
@@ -559,7 +559,7 @@
def __getitem__(self, componentIndex):
if not self.isComposite():
- raise ttLib.TTLibError, "can't use glyph as sequence"
+ raise ttLib.TTLibError("can't use glyph as sequence")
return self.components[componentIndex]
def getCoordinates(self, glyfTable):
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
index 02e3819..4a6ec1d 100644
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
@@ -38,7 +38,7 @@
self.decode_format_3_0(data, ttFont)
else:
# supported format
- raise ttLib.TTLibError, "'post' table format %f not supported" % self.formatType
+ raise ttLib.TTLibError("'post' table format %f not supported" % self.formatType)
def compile(self, ttFont):
data = sstruct.pack(postFormat, self)
@@ -50,7 +50,7 @@
pass # we're done
else:
# supported format
- raise ttLib.TTLibError, "'post' table format %f not supported" % self.formatType
+ raise ttLib.TTLibError("'post' table format %f not supported" % self.formatType)
return data
def getGlyphOrder(self):
@@ -59,7 +59,7 @@
or its relatives instead!
"""
if not hasattr(self, "glyphOrder"):
- raise ttLib.TTLibError, "illegal use of getGlyphOrder()"
+ raise ttLib.TTLibError("illegal use of getGlyphOrder()")
glyphOrder = self.glyphOrder
del self.glyphOrder
return glyphOrder
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index d556e63..cf99408 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -280,7 +280,7 @@
overflowErrorRecord = self.getOverflowErrorRecord(item)
- raise OTLOffsetOverflowError, overflowErrorRecord
+ raise OTLOffsetOverflowError(overflowErrorRecord)
return "".join(items)
@@ -514,14 +514,14 @@
if self.recurse > 2:
# shouldn't ever get here - we should only get to two levels of recursion.
# this guards against self.decompile NOT setting compileStatus to other than 1.
- raise AttributeError, attr
+ raise AttributeError(attr)
if self.compileStatus == 1:
self.ensureDecompiled()
val = getattr(self, attr)
self.recurse -=1
return val
- raise AttributeError, attr
+ raise AttributeError(attr)
"""Generic base class for all OpenType (sub)tables."""
diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py
index 0555720..eb83214 100644
--- a/Lib/fontTools/ttLib/tables/otConverters.py
+++ b/Lib/fontTools/ttLib/tables/otConverters.py
@@ -58,19 +58,19 @@
def read(self, reader, font, tableDict):
"""Read a value from the reader."""
- raise NotImplementedError, self
+ raise NotImplementedError(self)
def write(self, writer, font, tableDict, value, repeatIndex=None):
"""Write a value to the writer."""
- raise NotImplementedError, self
+ raise NotImplementedError(self)
def xmlRead(self, attrs, content, font):
"""Read a value from XML."""
- raise NotImplementedError, self
+ raise NotImplementedError(self)
def xmlWrite(self, xmlWriter, font, value, name, attrs):
"""Write a value to XML."""
- raise NotImplementedError, self
+ raise NotImplementedError(self)
class SimpleValue(BaseConverter):
diff --git a/Lib/fontTools/ttLib/tables/ttProgram.py b/Lib/fontTools/ttLib/tables/ttProgram.py
index 490b0ab..2b65dad 100644
--- a/Lib/fontTools/ttLib/tables/ttProgram.py
+++ b/Lib/fontTools/ttLib/tables/ttProgram.py
@@ -278,7 +278,7 @@
while pos < lenAssembly:
m = _tokenRE.match(assembly, pos)
if m is None:
- raise tt_instructions_error, "Syntax error in TT program (%s)" % assembly[pos-5:pos+15]
+ raise tt_instructions_error("Syntax error in TT program (%s)" % assembly[pos-5:pos+15])
dummy, mnemonic, arg, number, comment = m.groups()
pos = m.regs[0][1]
if comment:
@@ -292,7 +292,7 @@
elif mnemonic not in ("NPUSHB", "NPUSHW", "PUSHB", "PUSHW"):
op, argBits = mnemonicDict[mnemonic]
if len(arg) != argBits:
- raise tt_instructions_error, "Incorrect number of argument bits (%s[%s])" % (mnemonic, arg)
+ raise tt_instructions_error("Incorrect number of argument bits (%s[%s])" % (mnemonic, arg))
if arg:
arg = binary2num(arg)
push(op + arg)
@@ -304,7 +304,7 @@
while pos < lenAssembly:
m = _tokenRE.match(assembly, pos)
if m is None:
- raise tt_instructions_error, "Syntax error in TT program (%s)" % assembly[pos:pos+15]
+ raise tt_instructions_error("Syntax error in TT program (%s)" % assembly[pos:pos+15])
dummy, mnemonic, arg, number, comment = m.groups()
if number is None and comment is None:
break
@@ -330,7 +330,7 @@
push(op)
push(nArgs)
else:
- raise tt_instructions_error, "More than 255 push arguments (%s)" % nArgs
+ raise tt_instructions_error("More than 255 push arguments (%s)" % nArgs)
if words:
for value in args:
push((value >> 8) & 0xff)