use strict zip
This commit is contained in:
parent
5614eea3b4
commit
38e9d5c250
@ -202,7 +202,7 @@ def ell(
|
||||
if extension < 0:
|
||||
ext_floor = -numpy.floor(extension)
|
||||
raise BuildError(f'Position is too close by at least {ext_floor}. Total extensions would be\n\t'
|
||||
+ '\n\t'.join(f'{key}: {off}' for key, off in zip(ports.keys(), offsets)))
|
||||
+ '\n\t'.join(f'{key}: {off}' for key, off in zip(ports.keys(), offsets, strict=True)))
|
||||
|
||||
result = dict(zip(ports.keys(), offsets))
|
||||
result = dict(zip(ports.keys(), offsets, strict=True))
|
||||
return result
|
||||
|
@ -294,14 +294,14 @@ class PortList(metaclass=ABCMeta):
|
||||
Raises:
|
||||
`PortError` if the ports are not properly aligned.
|
||||
"""
|
||||
a_names, b_names = list(zip(*connections.items()))
|
||||
a_names, b_names = list(zip(*connections.items(), strict=True))
|
||||
a_ports = [self.ports[pp] for pp in a_names]
|
||||
b_ports = [self.ports[pp] for pp in b_names]
|
||||
|
||||
a_types = [pp.ptype for pp in a_ports]
|
||||
b_types = [pp.ptype for pp in b_ports]
|
||||
type_conflicts = numpy.array([at != bt and at != 'unk' and bt != 'unk'
|
||||
for at, bt in zip(a_types, b_types)])
|
||||
type_conflicts = numpy.array([at != bt and 'unk' not in (at, bt)
|
||||
for at, bt in zip(a_types, b_types, strict=True)])
|
||||
|
||||
if type_conflicts.any():
|
||||
msg = 'Ports have conflicting types:\n'
|
||||
@ -502,8 +502,8 @@ class PortList(metaclass=ABCMeta):
|
||||
o_offsets[:, 1] *= -1
|
||||
o_rotations *= -1
|
||||
|
||||
type_conflicts = numpy.array([st != ot and st != 'unk' and ot != 'unk'
|
||||
for st, ot in zip(s_types, o_types)])
|
||||
type_conflicts = numpy.array([st != ot and 'unk' not in (st, ot)
|
||||
for st, ot in zip(s_types, o_types, strict=True)])
|
||||
if type_conflicts.any():
|
||||
msg = 'Ports have conflicting types:\n'
|
||||
for nn, (k, v) in enumerate(map_in.items()):
|
||||
|
@ -324,7 +324,7 @@ class Arc(Shape):
|
||||
|
||||
mins = []
|
||||
maxs = []
|
||||
for a, sgn in zip(a_ranges, (-1, +1)):
|
||||
for a, sgn in zip(a_ranges, (-1, +1), strict=True):
|
||||
wh = sgn * self.width / 2
|
||||
rx = self.radius_x + wh
|
||||
ry = self.radius_y + wh
|
||||
@ -435,7 +435,7 @@ class Arc(Shape):
|
||||
|
||||
mins = []
|
||||
maxs = []
|
||||
for a, sgn in zip(a_ranges, (-1, +1)):
|
||||
for a, sgn in zip(a_ranges, (-1, +1), strict=True):
|
||||
wh = sgn * self.width / 2
|
||||
rx = self.radius_x + wh
|
||||
ry = self.radius_y + wh
|
||||
|
@ -135,7 +135,7 @@ class Shape(PositionableImpl, Rotatable, Mirrorable, Copyable, Scalable,
|
||||
|
||||
vertex_lists = []
|
||||
p_verts = polygon.vertices + polygon.offset
|
||||
for v, v_next in zip(p_verts, numpy.roll(p_verts, -1, axis=0)):
|
||||
for v, v_next in zip(p_verts, numpy.roll(p_verts, -1, axis=0), strict=True):
|
||||
dv = v_next - v
|
||||
|
||||
# Find x-index bounds for the line # TODO: fix this and err_xmin/xmax for grids smaller than the line / shape
|
||||
|
@ -29,7 +29,7 @@ def annotations_lt(aa: annotations_t, bb: annotations_t) -> bool:
|
||||
if len(va) != len(vb):
|
||||
return len(va) < len(vb)
|
||||
|
||||
for aaa, bbb in zip(va, vb):
|
||||
for aaa, bbb in zip(va, vb, strict=True):
|
||||
if aaa != bbb:
|
||||
return annotation2key(aaa) < annotation2key(bbb)
|
||||
return False
|
||||
@ -55,7 +55,7 @@ def annotations_eq(aa: annotations_t, bb: annotations_t) -> bool:
|
||||
if len(va) != len(vb):
|
||||
return False
|
||||
|
||||
for aaa, bbb in zip(va, vb):
|
||||
for aaa, bbb in zip(va, vb, strict=True):
|
||||
if aaa != bbb:
|
||||
return False
|
||||
|
||||
|
@ -236,7 +236,7 @@ def pack_patterns(
|
||||
locations, reject_inds = packer(sizes, containers, presort=presort, allow_rejects=allow_rejects)
|
||||
|
||||
pat = Pattern()
|
||||
for pp, oo, loc in zip(patterns, offsets, locations):
|
||||
for pp, oo, loc in zip(patterns, offsets, locations, strict=True):
|
||||
pat.ref(pp, offset=oo + loc)
|
||||
|
||||
rejects = [patterns[ii] for ii in reject_inds]
|
||||
|
Loading…
Reference in New Issue
Block a user