2to3 --fix=repr
This commit is contained in:
parent
cd5aad92f2
commit
dc7e6f3e55
@ -116,7 +116,7 @@ class AFM:
|
|||||||
continue
|
continue
|
||||||
m = identifierRE.match(line)
|
m = identifierRE.match(line)
|
||||||
if m is None:
|
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]
|
pos = m.regs[1][1]
|
||||||
word = line[:pos]
|
word = line[:pos]
|
||||||
@ -135,7 +135,7 @@ class AFM:
|
|||||||
def parsechar(self, rest):
|
def parsechar(self, rest):
|
||||||
m = charRE.match(rest)
|
m = charRE.match(rest)
|
||||||
if m is None:
|
if m is None:
|
||||||
raise error("syntax error in AFM file: " + `rest`)
|
raise error("syntax error in AFM file: " + repr(rest))
|
||||||
things = []
|
things = []
|
||||||
for fr, to in m.regs[1:]:
|
for fr, to in m.regs[1:]:
|
||||||
things.append(rest[fr:to])
|
things.append(rest[fr:to])
|
||||||
@ -147,7 +147,7 @@ class AFM:
|
|||||||
def parsekernpair(self, rest):
|
def parsekernpair(self, rest):
|
||||||
m = kernRE.match(rest)
|
m = kernRE.match(rest)
|
||||||
if m is None:
|
if m is None:
|
||||||
raise error("syntax error in AFM file: " + `rest`)
|
raise error("syntax error in AFM file: " + repr(rest))
|
||||||
things = []
|
things = []
|
||||||
for fr, to in m.regs[1:]:
|
for fr, to in m.regs[1:]:
|
||||||
things.append(rest[fr:to])
|
things.append(rest[fr:to])
|
||||||
@ -172,7 +172,7 @@ class AFM:
|
|||||||
def parsecomposite(self, rest):
|
def parsecomposite(self, rest):
|
||||||
m = compositeRE.match(rest)
|
m = compositeRE.match(rest)
|
||||||
if m is None:
|
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)
|
charname = m.group(1)
|
||||||
ncomponents = int(m.group(2))
|
ncomponents = int(m.group(2))
|
||||||
rest = rest[m.regs[0][1]:]
|
rest = rest[m.regs[0][1]:]
|
||||||
@ -180,7 +180,7 @@ class AFM:
|
|||||||
while 1:
|
while 1:
|
||||||
m = componentRE.match(rest)
|
m = componentRE.match(rest)
|
||||||
if m is None:
|
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)
|
basechar = m.group(1)
|
||||||
xoffset = int(m.group(2))
|
xoffset = int(m.group(2))
|
||||||
yoffset = int(m.group(3))
|
yoffset = int(m.group(3))
|
||||||
@ -223,7 +223,7 @@ class AFM:
|
|||||||
lines.append(attr + " " + str(value))
|
lines.append(attr + " " + str(value))
|
||||||
|
|
||||||
# write char metrics
|
# write char metrics
|
||||||
lines.append("StartCharMetrics " + `len(self._chars)`)
|
lines.append("StartCharMetrics " + repr(len(self._chars)))
|
||||||
items = map(lambda (charname, (charnum, width, box)):
|
items = map(lambda (charname, (charnum, width, box)):
|
||||||
(charnum, (charname, width, box)),
|
(charnum, (charname, width, box)),
|
||||||
self._chars.items())
|
self._chars.items())
|
||||||
@ -245,7 +245,7 @@ class AFM:
|
|||||||
|
|
||||||
# write kerning info
|
# write kerning info
|
||||||
lines.append("StartKernData")
|
lines.append("StartKernData")
|
||||||
lines.append("StartKernPairs " + `len(self._kerning)`)
|
lines.append("StartKernPairs " + repr(len(self._kerning)))
|
||||||
items = self._kerning.items()
|
items = self._kerning.items()
|
||||||
items.sort() # XXX is order important?
|
items.sort() # XXX is order important?
|
||||||
for (leftchar, rightchar), value in items:
|
for (leftchar, rightchar), value in items:
|
||||||
|
@ -194,7 +194,7 @@ def _test():
|
|||||||
i.afixed = 1.5
|
i.afixed = 1.5
|
||||||
|
|
||||||
data = pack(format, i)
|
data = pack(format, i)
|
||||||
print 'data:', `data`
|
print 'data:', repr(data)
|
||||||
print unpack(format, data)
|
print unpack(format, data)
|
||||||
i2 = foo()
|
i2 = foo()
|
||||||
unpack(format, data, i2)
|
unpack(format, data, i2)
|
||||||
|
@ -143,7 +143,7 @@ def escape8bit(data):
|
|||||||
elif 32 <= n <= 127:
|
elif 32 <= n <= 127:
|
||||||
return c
|
return c
|
||||||
else:
|
else:
|
||||||
return "&#" + `n` + ";"
|
return "&#" + repr(n) + ";"
|
||||||
return string.join(map(escapechar, data), "")
|
return string.join(map(escapechar, data), "")
|
||||||
|
|
||||||
needswap = struct.pack("h", 1) == "\001\000"
|
needswap = struct.pack("h", 1) == "\001\000"
|
||||||
@ -162,7 +162,7 @@ def escape16bit(data):
|
|||||||
elif 32 <= n <= 127:
|
elif 32 <= n <= 127:
|
||||||
return chr(n)
|
return chr(n)
|
||||||
else:
|
else:
|
||||||
return "&#" + `n` + ";"
|
return "&#" + repr(n) + ";"
|
||||||
return string.join(map(escapenum, a), "")
|
return string.join(map(escapenum, a), "")
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ def readLWFN(path, onlyHeader=0):
|
|||||||
elif code == 0:
|
elif code == 0:
|
||||||
pass # comment, ignore
|
pass # comment, ignore
|
||||||
else:
|
else:
|
||||||
raise T1Error('bad chunk code: ' + `code`)
|
raise T1Error('bad chunk code: ' + repr(code))
|
||||||
finally:
|
finally:
|
||||||
Res.CloseResFile(resRef)
|
Res.CloseResFile(resRef)
|
||||||
data = string.join(data, '')
|
data = string.join(data, '')
|
||||||
@ -189,7 +189,7 @@ def readPFB(path, onlyHeader=0):
|
|||||||
elif code == 3:
|
elif code == 3:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise T1Error('bad chunk code: ' + `code`)
|
raise T1Error('bad chunk code: ' + repr(code))
|
||||||
if onlyHeader:
|
if onlyHeader:
|
||||||
break
|
break
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -251,7 +251,7 @@ class TTFont:
|
|||||||
idlefunc = None
|
idlefunc = None
|
||||||
|
|
||||||
writer = xmlWriter.XMLWriter(fileOrPath, idlefunc=idlefunc)
|
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)
|
ttLibVersion=version)
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ class TTFont:
|
|||||||
tempName = glyphName
|
tempName = glyphName
|
||||||
n = 1
|
n = 1
|
||||||
while tempName in allNames:
|
while tempName in allNames:
|
||||||
tempName = glyphName + "#" + `n`
|
tempName = glyphName + "#" + repr(n)
|
||||||
n = n + 1
|
n = n + 1
|
||||||
glyphOrder[i] = tempName
|
glyphOrder[i] = tempName
|
||||||
allNames[tempName] = 1
|
allNames[tempName] = 1
|
||||||
|
@ -58,7 +58,7 @@ class table__h_d_m_x(DefaultTable.DefaultTable):
|
|||||||
glyphNames = ttFont.getGlyphOrder()[:]
|
glyphNames = ttFont.getGlyphOrder()[:]
|
||||||
glyphNames.sort()
|
glyphNames.sort()
|
||||||
maxNameLen = max(map(len, glyphNames))
|
maxNameLen = max(map(len, glyphNames))
|
||||||
format = "%" + `maxNameLen` + 's:' + format + ' ;'
|
format = "%" + repr(maxNameLen) + 's:' + format + ' ;'
|
||||||
writer.write(format % (("ppem",) + tuple(ppems)))
|
writer.write(format % (("ppem",) + tuple(ppems)))
|
||||||
writer.newline()
|
writer.newline()
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
@ -109,7 +109,7 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
|
|||||||
# make up a new glyphName that's unique
|
# make up a new glyphName that's unique
|
||||||
n = allNames[glyphName]
|
n = allNames[glyphName]
|
||||||
allNames[glyphName] = n + 1
|
allNames[glyphName] = n + 1
|
||||||
glyphName = glyphName + "#" + `n`
|
glyphName = glyphName + "#" + repr(n)
|
||||||
self.glyphOrder[i] = glyphName
|
self.glyphOrder[i] = glyphName
|
||||||
mapping[glyphName] = psName
|
mapping[glyphName] = psName
|
||||||
else:
|
else:
|
||||||
|
@ -378,14 +378,14 @@ class Program:
|
|||||||
assembly.append("%s[ ] /* %s values pushed */" % (mnemonic, nValues))
|
assembly.append("%s[ ] /* %s values pushed */" % (mnemonic, nValues))
|
||||||
for j in range(pushBytes):
|
for j in range(pushBytes):
|
||||||
value = bytecode[i]
|
value = bytecode[i]
|
||||||
assembly.append(`value`)
|
assembly.append(repr(value))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
for j in range(pushWords):
|
for j in range(pushWords):
|
||||||
# cast to signed int16
|
# cast to signed int16
|
||||||
value = (bytecode[i] << 8) | bytecode[i+1]
|
value = (bytecode[i] << 8) | bytecode[i+1]
|
||||||
if value >= 0x8000:
|
if value >= 0x8000:
|
||||||
value = value - 0x10000
|
value = value - 0x10000
|
||||||
assembly.append(`value`)
|
assembly.append(repr(value))
|
||||||
i = i + 2
|
i = i + 2
|
||||||
else:
|
else:
|
||||||
assembly.append("INSTR%d[ ]" % op)
|
assembly.append("INSTR%d[ ]" % op)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user