Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
output_file.close()
# Y times [ 2x i signed ints for every hole: x coords, y coords ]
# write hole polygon_data
path = 'hole_data.bin'
print('writing file "', path, '"')
output_file = open(path, 'wb')
for x_coords, y_coords in all_holes:
for x in x_coords:
output_file.write(pack(b'
def _holes_of_line(self, line=0):
try:
amount_of_holes, hole_id = self.hole_registry[line]
for i in range(amount_of_holes):
self.hole_coord_amount.seek(NR_BYTES_H * hole_id)
nr_of_values = unpack(DTYPE_FORMAT_H, self.hole_coord_amount.read(NR_BYTES_H))[0]
self.hole_adr2data.seek(NR_BYTES_I * hole_id)
self.hole_data.seek(unpack(DTYPE_FORMAT_I, self.hole_adr2data.read(NR_BYTES_I))[0])
yield array([self.fromfile(self.hole_data, dtype=DTYPE_FORMAT_SIGNED_I_NUMPY, count=nr_of_values),
self.fromfile(self.hole_data, dtype=DTYPE_FORMAT_SIGNED_I_NUMPY, count=nr_of_values)])
hole_id += 1
except KeyError:
return
def _holes_of_line(self, line=0):
try:
amount_of_holes, hole_id = self.hole_registry[line]
for i in range(amount_of_holes):
self.hole_coord_amount.seek(NR_BYTES_H * hole_id)
nr_of_values = unpack(DTYPE_FORMAT_H, self.hole_coord_amount.read(NR_BYTES_H))[0]
self.hole_adr2data.seek(NR_BYTES_I * hole_id)
self.hole_data.seek(unpack(DTYPE_FORMAT_I, self.hole_adr2data.read(NR_BYTES_I))[0])
yield array([self.fromfile(self.hole_data, dtype=DTYPE_FORMAT_SIGNED_I_NUMPY, count=nr_of_values),
self.fromfile(self.hole_data, dtype=DTYPE_FORMAT_SIGNED_I_NUMPY, count=nr_of_values)])
hole_id += 1
except KeyError:
return