Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
# print((x,y,this_lines_shortcuts))
except KeyError:
nr_of_entries_in_shortcut.append(0)
amount_of_shortcuts = len(nr_of_entries_in_shortcut)
print_shortcut_statistics()
if amount_of_shortcuts != 360 * 180 * NR_SHORTCUTS_PER_LNG * NR_SHORTCUTS_PER_LAT:
print(amount_of_shortcuts)
raise ValueError('this number of shortcut zones is wrong')
print('The number of filled shortcut zones are:', amount_filled_shortcuts, '(=',
round((amount_filled_shortcuts / amount_of_shortcuts) * 100, 2), '% of all shortcuts)')
# for every shortcut
def id_of(self, line=0):
self.poly_zone_ids.seek(NR_BYTES_H * line)
return unpack(DTYPE_FORMAT_H, self.poly_zone_ids.read(NR_BYTES_H))[0]