2to3 --fix=repr
This commit is contained in:
parent
cd5aad92f2
commit
dc7e6f3e55
@ -116,7 +116,7 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
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 @@ class AFM:
|
||||
|
||||
# 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:
|
||||
|
@ -194,7 +194,7 @@ def _test():
|
||||
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)
|
||||
|
@ -143,7 +143,7 @@ def escape8bit(data):
|
||||
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 @@ def escape16bit(data):
|
||||
elif 32 <= n <= 127:
|
||||
return chr(n)
|
||||
else:
|
||||
return "&#" + `n` + ";"
|
||||
return "&#" + repr(n) + ";"
|
||||
return string.join(map(escapenum, a), "")
|
||||
|
||||
|
||||
|
@ -166,7 +166,7 @@ def readLWFN(path, onlyHeader=0):
|
||||
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 @@ def readPFB(path, onlyHeader=0):
|
||||
elif code == 3:
|
||||
break
|
||||
else:
|
||||
raise T1Error('bad chunk code: ' + `code`)
|
||||
raise T1Error('bad chunk code: ' + repr(code))
|
||||
if onlyHeader:
|
||||
break
|
||||
f.close()
|
||||
|
@ -251,7 +251,7 @@ class TTFont:
|
||||
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 @@ class TTFont:
|
||||
tempName = glyphName
|
||||
n = 1
|
||||
while tempName in allNames:
|
||||
tempName = glyphName + "#" + `n`
|
||||
tempName = glyphName + "#" + repr(n)
|
||||
n = n + 1
|
||||
glyphOrder[i] = tempName
|
||||
allNames[tempName] = 1
|
||||
|
@ -58,7 +58,7 @@ class table__h_d_m_x(DefaultTable.DefaultTable):
|
||||
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()
|
||||
|
@ -109,7 +109,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
||||
# 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:
|
||||
|
@ -378,14 +378,14 @@ class Program:
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user