Skip to content

Commit 9274fbd

Browse files
committed
Merge branch 'stable' into dev
2 parents ab33017 + 449781d commit 9274fbd

File tree

12 files changed

+40
-38
lines changed

12 files changed

+40
-38
lines changed

compiler/gdsMill/pyx/box.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ def linealignpointvector_pt(self, a, dx, dy, px, py):
142142
def alignvector_pt(self, a, dx, dy, alignlinevector, alignpointvector):
143143
n = math.hypot(dx, dy)
144144
dx, dy = dx / n, dy / n
145-
linevectors = map(lambda (p1, p2), self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
146-
alignlinevector(a, dx, dy, *(p1 + p2)), self.successivepoints())
145+
linevectors = map(lambda p, self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
146+
alignlinevector(a, dx, dy, *(p[0] + p[1])), self.successivepoints())
147147
for linevector in linevectors:
148148
if type(linevector) is types.TupleType:
149149
return linevector

compiler/gdsMill/pyx/connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def __init__(self, box1, box2,
259259
if alength is not None: no_lengths += 1
260260

261261
if no_angles + no_lengths != 2:
262-
raise NotImplementedError, "Please specify exactly two angles or lengths"
262+
raise NotImplementedError("Please specify exactly two angles or lengths")
263263

264264
# calculate necessary angles and armlengths
265265
# always length1 and relangle1
@@ -301,7 +301,7 @@ def __init__(self, box1, box2,
301301
relangle1 = acos((distance**2 + length1**2 - length2**2) / (2.0*distance*length1))
302302
middle = self._middle_a(begin, dangle, length1, relangle1)
303303
else:
304-
raise NotImplementedError, "I found a strange combination of arguments"
304+
raise NotImplementedError("I found a strange combination of arguments")
305305

306306
connectorpath = path.path(path.moveto_pt(*self.box1.center),
307307
path.lineto_pt(*middle),

compiler/gdsMill/pyx/deformer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def is_zero(x):
135135
return []
136136

137137
if debug:
138-
print "fallback with exact zero value"
138+
print("fallback with exact zero value")
139139
return [(a, b)]
140140
# >>>
141141
def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
@@ -147,7 +147,7 @@ def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
147147
abs(b*T) < threshold * q1 and abs(1.5*a*abs(a)*curvA - D) < threshold * q1 and
148148
abs(a*T) < threshold * q2 and abs(1.5*b*abs(b)*curvB - E) < threshold * q2):
149149
if debug:
150-
print "fallback with T approx 0"
150+
print("fallback with T approx 0")
151151
return [(a, b)]
152152
return []
153153
# >>>
@@ -161,7 +161,7 @@ def fallback_smallcurv(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
161161
abs(1.5*b*b*curvB) < threshold * min(abs(a*T), abs(E)) and
162162
abs(a*T - E) < threshold * min(abs(a*T), abs(E))):
163163
if debug:
164-
print "fallback with curvB approx 0"
164+
print("fallback with curvB approx 0")
165165
result.append((a, b))
166166

167167
# is curvA approx zero?
@@ -171,7 +171,7 @@ def fallback_smallcurv(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
171171
abs(1.5*a*a*curvA) < threshold * min(abs(b*T), abs(D)) and
172172
abs(b*T - D) < threshold * min(abs(b*T), abs(D))):
173173
if debug:
174-
print "fallback with curvA approx 0"
174+
print("fallback with curvA approx 0")
175175
result.append((a, b))
176176

177177
return result
@@ -754,7 +754,7 @@ def deformsubpath(self, orig_nsp): # <<<
754754
# get the next parallel piece for the normpath
755755
try:
756756
next_parallel_normpath = self.deformsubpathitem(next_orig_nspitem, epsilon)
757-
except InvalidParamException, e:
757+
except InvalidParamException as e:
758758
invalid_nspitem_param = e.normsubpathitemparam
759759
# split the nspitem apart and continue with pieces that do not contain
760760
# the invalid point anymore. At the end, simply take one piece, otherwise two.

compiler/gdsMill/pyx/dvifile.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class TFMError(exceptions.Exception): pass
102102

103103
class char_info_word:
104104
def __init__(self, word):
105-
self.width_index = int((word & 0xFF000000L) >> 24) #make sign-safe
105+
self.width_index = int((word & 0xFF000000) >> 24) #make sign-safe
106106
self.height_index = (word & 0x00F00000) >> 20
107107
self.depth_index = (word & 0x000F0000) >> 16
108108
self.italic_index = (word & 0x0000FC00) >> 10
@@ -135,10 +135,10 @@ def __init__(self, name, debug=0):
135135
self.ne <= 256 and
136136
self.lf == 6+self.lh+(self.ec-self.bc+1)+self.nw+self.nh+self.nd
137137
+self.ni+self.nl+self.nk+self.ne+self.np):
138-
raise TFMError, "error in TFM pre-header"
138+
raise TFMError("error in TFM pre-header")
139139

140140
if debug:
141-
print "lh=%d" % self.lh
141+
print("lh=%d" % self.lh)
142142

143143
#
144144
# read header
@@ -160,9 +160,9 @@ def __init__(self, name, debug=0):
160160
self.fontfamily = None
161161

162162
if debug:
163-
print "(FAMILY %s)" % self.fontfamily
164-
print "(CODINGSCHEME %s)" % self.charcoding
165-
print "(DESINGSIZE R %f)" % 16.0*self.designsize/16777216L
163+
print("(FAMILY %s)" % self.fontfamily)
164+
print("(CODINGSCHEME %s)" % self.charcoding)
165+
print("(DESINGSIZE R %f)" % 16.0*self.designsize/16777216)
166166

167167
if self.lh > 17:
168168
self.sevenbitsave = self.file.readuchar()
@@ -201,7 +201,7 @@ def __init__(self, name, debug=0):
201201

202202
if self.lh > 18:
203203
# just ignore the rest
204-
print self.file.read((self.lh-18)*4)
204+
print(self.file.read((self.lh-18)*4))
205205

206206
#
207207
# read char_info
@@ -392,9 +392,9 @@ def readfontmap(filenames):
392392
if not (line=="" or line[0] in (" ", "%", "*", ";" , "#")):
393393
try:
394394
fm = fontmapping(line)
395-
except (RuntimeError, UnsupportedPSFragment), e:
395+
except (RuntimeError, UnsupportedPSFragment) as e:
396396
warnings.warn("Ignoring line %i in mapping file '%s': %s" % (lineno, mappath, e))
397-
except UnsupportedFontFormat, e:
397+
except UnsupportedFontFormat as e:
398398
pass
399399
else:
400400
fontmap[fm.texname] = fm
@@ -468,16 +468,16 @@ class fontinfo:
468468

469469
def __str__(self):
470470
return "font %s designed at %g TeX pts used at %g TeX pts" % (self.name,
471-
16.0*self.d/16777216L,
472-
16.0*self.q/16777216L)
471+
16.0*self.d/16777216,
472+
16.0*self.q/16777216)
473473
__repr__ = __str__
474474

475475
def getsize_pt(self):
476476
""" return size of font in (PS) points """
477-
# The factor 16L/16777216L=2**(-20) converts a fix_word (here self.q)
477+
# The factor 16/16777216=2**(-20) converts a fix_word (here self.q)
478478
# to the corresponding float. Furthermore, we have to convert from TeX
479479
# points to points, hence the factor 72/72.27.
480-
return 16L*self.q/16777216L*72/72.27
480+
return 16*self.q/16777216*72/72.27
481481

482482
def _convert_tfm_to_dvi(self, length):
483483
# doing the integer math with long integers will lead to different roundings
@@ -1269,7 +1269,7 @@ def __init__(self, filename, scale, tfmconv, pyxconv, fontmap, debug=0):
12691269
# of the virtual font itself. Note that realscale has
12701270
# to be a fix_word (like s)
12711271
# XXX: check rounding
1272-
reals = int(round(self.scale * (16*self.ds/16777216L) * s))
1272+
reals = int(round(self.scale * (16*self.ds/16777216) * s))
12731273

12741274
# print ("defining font %s -- VF scale: %g, VF design size: %d, relative font size: %d => real size: %d" %
12751275
# (fontname, self.scale, self.ds, s, reals)

compiler/gdsMill/pyx/epsfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def processPS(self, file, writer, context, registry, bbox):
319319
try:
320320
epsfile=open(self.filename,"rb")
321321
except:
322-
raise IOError, "cannot open EPS file '%s'" % self.filename
322+
raise IOError("cannot open EPS file '%s'" % self.filename)
323323

324324
file.write("BeginEPSF\n")
325325

compiler/gdsMill/pyx/font/afm.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ def _processline_trackkern(self, line, i):
365365
else:
366366
raise AFMError("Unsupported key %s in kerning data section" % key)
367367

368-
def _processline_kernpairs(self, line, (direction, i)):
368+
def _processline_kernpairs(self, line, arg):
369+
direction = arg[0]
370+
i = arg[1]
369371
try:
370372
key, args = line.split(None, 1)
371373
except ValueError:
@@ -484,6 +486,6 @@ def parse(self):
484486

485487
if __name__ == "__main__":
486488
a = AFMfile("/opt/local/share/texmf-dist/fonts/afm/yandy/lucida/lbc.afm")
487-
print a.charmetrics[0].name
489+
print(a.charmetrics[0].name)
488490
a = AFMfile("/usr/share/enscript/hv.afm")
489-
print a.charmetrics[32].name
491+
print(a.charmetrics[32].name)

compiler/gdsMill/pyx/font/t1font.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,9 @@ def _cmds(self, code):
815815
elif 251 <= x <= 254: # mid size ints
816816
cmds.append(-((x - 251)*256) - code.pop(0) - 108)
817817
else: # x = 255, i.e. full size ints
818-
y = ((code.pop(0)*256l+code.pop(0))*256+code.pop(0))*256+code.pop(0)
819-
if y > (1l << 31):
820-
cmds.append(y - (1l << 32))
818+
y = ((code.pop(0)*256+code.pop(0))*256+code.pop(0))*256+code.pop(0)
819+
if y > (1 << 31):
820+
cmds.append(y - (1 << 32))
821821
else:
822822
cmds.append(y)
823823
return cmds
@@ -843,7 +843,7 @@ def _code(self, cmds):
843843
code.append(b)
844844
else:
845845
if cmd < 0:
846-
cmd += 1l << 32
846+
cmd += 1 << 32
847847
cmd, x4 = divmod(cmd, 256)
848848
cmd, x3 = divmod(cmd, 256)
849849
x1, x2 = divmod(cmd, 256)

compiler/gdsMill/pyx/graph/axis/texter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(self, plus="", minus="-",
143143
skipexp1=None,
144144
nomantissaexp=r"{10^{%s}}",
145145
minusnomantissaexp=r"{-10^{%s}}",
146-
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10L, 1)),
146+
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10, 1)),
147147
skipmantissa1=0, skipallmantissa1=1,
148148
mantissatexter=decimal()):
149149
r"""initializes the instance

compiler/gdsMill/pyx/graph/axis/tick.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def initfromstring(self, s):
5151
if autolong:
5252
self.denom = 10 ** len(commaparts[1])
5353
else:
54-
self.denom = 10L ** len(commaparts[1])
54+
self.denom = 10 ** len(commaparts[1])
5555
neg = len(commaparts[0]) and commaparts[0][0] == "-"
5656
if neg:
5757
commaparts[0] = commaparts[0][1:]

compiler/gdsMill/sram_examples/cell6tDemo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@
8282
# inputPath = "./gdsFiles/arrayLayout.gds")
8383

8484

85-
print "LIB: %s" , gds_file_in
86-
print "\nCompleted ", gds_file_out
85+
print("LIB: %s" , gds_file_in)
86+
print("\nCompleted ", gds_file_out)

0 commit comments

Comments
 (0)