forked from jan/fatamorgana
use strict zip
This commit is contained in:
parent
dc9ed8e794
commit
691ce03150
@ -1485,13 +1485,13 @@ class ArbitraryRepetition:
|
|||||||
size = write_uint(stream, 10)
|
size = write_uint(stream, 10)
|
||||||
size += write_uint(stream, len(self.x_displacements) - 1)
|
size += write_uint(stream, len(self.x_displacements) - 1)
|
||||||
size += sum(Delta(x, y).write(stream)
|
size += sum(Delta(x, y).write(stream)
|
||||||
for x, y in zip(self.x_displacements, self.y_displacements))
|
for x, y in zip(self.x_displacements, self.y_displacements, strict=True))
|
||||||
else:
|
else:
|
||||||
size = write_uint(stream, 11)
|
size = write_uint(stream, 11)
|
||||||
size += write_uint(stream, len(self.x_displacements) - 1)
|
size += write_uint(stream, len(self.x_displacements) - 1)
|
||||||
size += write_uint(stream, gcd)
|
size += write_uint(stream, gcd)
|
||||||
size += sum(Delta(x // gcd, y // gcd).write(stream)
|
size += sum(Delta(x // gcd, y // gcd).write(stream)
|
||||||
for x, y in zip(self.x_displacements, self.y_displacements))
|
for x, y in zip(self.x_displacements, self.y_displacements, strict=True))
|
||||||
return size
|
return size
|
||||||
|
|
||||||
def __eq__(self, other: Any) -> bool:
|
def __eq__(self, other: Any) -> bool:
|
||||||
|
@ -2632,22 +2632,22 @@ def dedup_field(record, r_field: str, modals: Modals, m_field: str) -> None:
|
|||||||
Args:
|
Args:
|
||||||
InvalidDataError: if both fields are `None`
|
InvalidDataError: if both fields are `None`
|
||||||
"""
|
"""
|
||||||
r = getattr(record, r_field)
|
rr = getattr(record, r_field)
|
||||||
m = getattr(modals, m_field)
|
mm = getattr(modals, m_field)
|
||||||
if r is not None:
|
if rr is not None:
|
||||||
if m_field in ('polygon_point_list', 'path_point_list'):
|
if m_field in ('polygon_point_list', 'path_point_list'):
|
||||||
if _USE_NUMPY:
|
if _USE_NUMPY:
|
||||||
equal = numpy.array_equal(m, r)
|
equal = numpy.array_equal(mm, rr)
|
||||||
else:
|
else:
|
||||||
equal = (m is not None) and all(tuple(mm) == tuple(rr) for mm, rr in zip(m, r))
|
equal = (mm is not None) and all(tuple(mmm) == tuple(rrr) for mmm, rrr in zip(mm, rr, strict=True))
|
||||||
else:
|
else:
|
||||||
equal = (m is not None) and m == r
|
equal = (mm is not None) and mm == rr
|
||||||
|
|
||||||
if equal:
|
if equal:
|
||||||
setattr(record, r_field, None)
|
setattr(record, r_field, None)
|
||||||
else:
|
else:
|
||||||
setattr(modals, m_field, r)
|
setattr(modals, m_field, rr)
|
||||||
elif m is None:
|
elif mm is None:
|
||||||
raise InvalidDataError('Unfillable field')
|
raise InvalidDataError('Unfillable field')
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ def write_file_1(buf: IO[bytes]) -> IO[bytes]:
|
|||||||
+ [0b11, 0b10]
|
+ [0b11, 0b10]
|
||||||
)
|
)
|
||||||
|
|
||||||
for t, (x, x_en) in enumerate(zip(wh, wh_en)):
|
for t, (x, x_en) in enumerate(zip(wh, wh_en, strict=True)):
|
||||||
write_uint(buf, 26) # CTRAPEZOID record
|
write_uint(buf, 26) # CTRAPEZOID record
|
||||||
write_byte(buf, 0b1000_1011 | (x_en << 5)) # TWHX_YRDL
|
write_byte(buf, 0b1000_1011 | (x_en << 5)) # TWHX_YRDL
|
||||||
write_uint(buf, 1) # layer
|
write_uint(buf, 1) # layer
|
||||||
|
Loading…
Reference in New Issue
Block a user