Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# write corresponding zone id for every shortcut (iff unique)
path = 'shortcuts_unique_id.bin'
print('writing file "', path, '"')
output_file = open(path, 'wb')
if poly_zone_ids[-1] >= INVALID_ZONE_ID:
raise ValueError(
'There are too many zones for this data type (H). The shortcuts_unique_id file need a Invalid Id!')
for x in range(360 * NR_SHORTCUTS_PER_LNG):
for y in range(180 * NR_SHORTCUTS_PER_LAT):
try:
shortcuts_this_entry = shortcuts[(x, y)]
unique_id = poly_zone_ids[shortcuts_this_entry[0]]
for nr in shortcuts_this_entry:
if poly_zone_ids[nr] != unique_id:
# there is a polygon from a different zone (hence an invalid id should be written)
unique_id = INVALID_ZONE_ID
break
output_file.write(pack(b'
# write Line_Nrs for every shortcut
path = 'shortcuts_data.bin'
print('writing file "', path, '"')
output_file = open(path, 'wb')
for entries in shortcut_entries:
for entry in entries:
if entry > nr_of_lines:
raise ValueError(entry)
output_file.write(pack(b'= INVALID_ZONE_ID:
raise ValueError(
'There are too many zones for this data type (H). The shortcuts_unique_id file need a Invalid Id!')
for x in range(360 * NR_SHORTCUTS_PER_LNG):
for y in range(180 * NR_SHORTCUTS_PER_LAT):
try:
shortcuts_this_entry = shortcuts[(x, y)]
unique_id = poly_zone_ids[shortcuts_this_entry[0]]
for nr in shortcuts_this_entry:
if poly_zone_ids[nr] != unique_id:
# there is a polygon from a different zone (hence an invalid id should be written)
unique_id = INVALID_ZONE_ID
break
output_file.write(pack(b'
raise ValueError(
'There are too many zones for this data type (H). The shortcuts_unique_id file need a Invalid Id!')
for x in range(360 * NR_SHORTCUTS_PER_LNG):
for y in range(180 * NR_SHORTCUTS_PER_LAT):
try:
shortcuts_this_entry = shortcuts[(x, y)]
unique_id = poly_zone_ids[shortcuts_this_entry[0]]
for nr in shortcuts_this_entry:
if poly_zone_ids[nr] != unique_id:
# there is a polygon from a different zone (hence an invalid id should be written)
unique_id = INVALID_ZONE_ID
break
output_file.write(pack(b' nr_of_lines:
raise ValueError(line, nr_of_lines)
output_file.write(pack(b'