2to3 --fix=repr
diff --git a/Lib/fontTools/afmLib.py b/Lib/fontTools/afmLib.py
index 04277d1..0eafbb3 100644
--- a/Lib/fontTools/afmLib.py
+++ b/Lib/fontTools/afmLib.py
@@ -116,7 +116,7 @@
continue
m = identifierRE.match(line)
if m is None:
- raise error("syntax error in AFM file: " + `line`)
+ raise error("syntax error in AFM file: " + repr(line))
pos = m.regs[1][1]
word = line[:pos]
@@ -135,7 +135,7 @@
def parsechar(self, rest):
m = charRE.match(rest)
if m is None:
- raise error("syntax error in AFM file: " + `rest`)
+ raise error("syntax error in AFM file: " + repr(rest))
things = []
for fr, to in m.regs[1:]:
things.append(rest[fr:to])
@@ -147,7 +147,7 @@
def parsekernpair(self, rest):
m = kernRE.match(rest)
if m is None:
- raise error("syntax error in AFM file: " + `rest`)
+ raise error("syntax error in AFM file: " + repr(rest))
things = []
for fr, to in m.regs[1:]:
things.append(rest[fr:to])
@@ -172,7 +172,7 @@
def parsecomposite(self, rest):
m = compositeRE.match(rest)
if m is None:
- raise error("syntax error in AFM file: " + `rest`)
+ raise error("syntax error in AFM file: " + repr(rest))
charname = m.group(1)
ncomponents = int(m.group(2))
rest = rest[m.regs[0][1]:]
@@ -180,7 +180,7 @@
while 1:
m = componentRE.match(rest)
if m is None:
- raise error("syntax error in AFM file: " + `rest`)
+ raise error("syntax error in AFM file: " + repr(rest))
basechar = m.group(1)
xoffset = int(m.group(2))
yoffset = int(m.group(3))
@@ -223,7 +223,7 @@
lines.append(attr + " " + str(value))
# write char metrics
- lines.append("StartCharMetrics " + `len(self._chars)`)
+ lines.append("StartCharMetrics " + repr(len(self._chars)))
items = map(lambda (charname, (charnum, width, box)):
(charnum, (charname, width, box)),
self._chars.items())
@@ -245,7 +245,7 @@
# write kerning info
lines.append("StartKernData")
- lines.append("StartKernPairs " + `len(self._kerning)`)
+ lines.append("StartKernPairs " + repr(len(self._kerning)))
items = self._kerning.items()
items.sort() # XXX is order important?
for (leftchar, rightchar), value in items:
diff --git a/Lib/fontTools/misc/sstruct.py b/Lib/fontTools/misc/sstruct.py
index 9ab11aa..e2759ef 100644
--- a/Lib/fontTools/misc/sstruct.py
+++ b/Lib/fontTools/misc/sstruct.py
@@ -194,7 +194,7 @@
i.afixed = 1.5
data = pack(format, i)
- print 'data:', `data`
+ print 'data:', repr(data)
print unpack(format, data)
i2 = foo()
unpack(format, data, i2)
diff --git a/Lib/fontTools/misc/xmlWriter.py b/Lib/fontTools/misc/xmlWriter.py
index 248dbfd..52d9a5c 100644
--- a/Lib/fontTools/misc/xmlWriter.py
+++ b/Lib/fontTools/misc/xmlWriter.py
@@ -143,7 +143,7 @@
elif 32 <= n <= 127:
return c
else:
- return "&#" + `n` + ";"
+ return "&#" + repr(n) + ";"
return string.join(map(escapechar, data), "")
needswap = struct.pack("h", 1) == "\001\000"
@@ -162,7 +162,7 @@
elif 32 <= n <= 127:
return chr(n)
else:
- return "&#" + `n` + ";"
+ return "&#" + repr(n) + ";"
return string.join(map(escapenum, a), "")
diff --git a/Lib/fontTools/t1Lib.py b/Lib/fontTools/t1Lib.py
index eda2e52..d119f32 100644
--- a/Lib/fontTools/t1Lib.py
+++ b/Lib/fontTools/t1Lib.py
@@ -166,7 +166,7 @@
elif code == 0:
pass # comment, ignore
else:
- raise T1Error('bad chunk code: ' + `code`)
+ raise T1Error('bad chunk code: ' + repr(code))
finally:
Res.CloseResFile(resRef)
data = string.join(data, '')
@@ -189,7 +189,7 @@
elif code == 3:
break
else:
- raise T1Error('bad chunk code: ' + `code`)
+ raise T1Error('bad chunk code: ' + repr(code))
if onlyHeader:
break
f.close()
diff --git a/Lib/fontTools/ttLib/__init__.py b/Lib/fontTools/ttLib/__init__.py
index 9f26e6c..d1d31f6 100644
--- a/Lib/fontTools/ttLib/__init__.py
+++ b/Lib/fontTools/ttLib/__init__.py
@@ -251,7 +251,7 @@
idlefunc = None
writer = xmlWriter.XMLWriter(fileOrPath, idlefunc=idlefunc)
- writer.begintag("ttFont", sfntVersion=`self.sfntVersion`[1:-1],
+ writer.begintag("ttFont", sfntVersion=repr(self.sfntVersion)[1:-1],
ttLibVersion=version)
writer.newline()
@@ -502,7 +502,7 @@
tempName = glyphName
n = 1
while tempName in allNames:
- tempName = glyphName + "#" + `n`
+ tempName = glyphName + "#" + repr(n)
n = n + 1
glyphOrder[i] = tempName
allNames[tempName] = 1
diff --git a/Lib/fontTools/ttLib/tables/_h_d_m_x.py b/Lib/fontTools/ttLib/tables/_h_d_m_x.py
index 50ebc33..4e35ccd 100644
--- a/Lib/fontTools/ttLib/tables/_h_d_m_x.py
+++ b/Lib/fontTools/ttLib/tables/_h_d_m_x.py
@@ -58,7 +58,7 @@
glyphNames = ttFont.getGlyphOrder()[:]
glyphNames.sort()
maxNameLen = max(map(len, glyphNames))
- format = "%" + `maxNameLen` + 's:' + format + ' ;'
+ format = "%" + repr(maxNameLen) + 's:' + format + ' ;'
writer.write(format % (("ppem",) + tuple(ppems)))
writer.newline()
writer.newline()
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
index 4a6ec1d..185dd9c 100644
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
@@ -109,7 +109,7 @@
# make up a new glyphName that's unique
n = allNames[glyphName]
allNames[glyphName] = n + 1
- glyphName = glyphName + "#" + `n`
+ glyphName = glyphName + "#" + repr(n)
self.glyphOrder[i] = glyphName
mapping[glyphName] = psName
else:
diff --git a/Lib/fontTools/ttLib/tables/ttProgram.py b/Lib/fontTools/ttLib/tables/ttProgram.py
index 2b65dad..a8c041a 100644
--- a/Lib/fontTools/ttLib/tables/ttProgram.py
+++ b/Lib/fontTools/ttLib/tables/ttProgram.py
@@ -378,14 +378,14 @@
assembly.append("%s[ ] /* %s values pushed */" % (mnemonic, nValues))
for j in range(pushBytes):
value = bytecode[i]
- assembly.append(`value`)
+ assembly.append(repr(value))
i = i + 1
for j in range(pushWords):
# cast to signed int16
value = (bytecode[i] << 8) | bytecode[i+1]
if value >= 0x8000:
value = value - 0x10000
- assembly.append(`value`)
+ assembly.append(repr(value))
i = i + 2
else:
assembly.append("INSTR%d[ ]" % op)