mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-03-15 12:24:29 +00:00
Improve adherence to python coding standards and clear up IDE static analysis warnings
This commit is contained in:
@@ -106,7 +106,7 @@ def lat_lon_for_grid_sw_corner_plus_size(grid):
|
||||
# Return None if our Maidenhead string is invalid or too short
|
||||
length = len(grid)
|
||||
if length <= 0 or (length % 2) != 0:
|
||||
return (None, None, None, None)
|
||||
return None, None, None, None
|
||||
|
||||
lat = 0.0 # aggregated latitude
|
||||
lon = 0.0 # aggregated longitude
|
||||
@@ -124,17 +124,17 @@ def lat_lon_for_grid_sw_corner_plus_size(grid):
|
||||
# A-X (0-23) thereafter.
|
||||
max_cell_no = 17 if block == 0 else 23
|
||||
if lat_cell_no < 0 or lat_cell_no > max_cell_no or lon_cell_no < 0 or lon_cell_no > max_cell_no:
|
||||
return (None, None, None, None)
|
||||
return None, None, None, None
|
||||
else:
|
||||
# Numbers in this block
|
||||
try:
|
||||
lon_cell_no = int(grid[block * 2])
|
||||
lat_cell_no = int(grid[block * 2 + 1])
|
||||
except ValueError:
|
||||
return (None, None, None, None)
|
||||
return None, None, None, None
|
||||
# Bail if the values aren't in range 0-9
|
||||
if lat_cell_no < 0 or lat_cell_no > 9 or lon_cell_no < 0 or lon_cell_no > 9:
|
||||
return (None, None, None, None)
|
||||
return None, None, None, None
|
||||
|
||||
# Aggregate the angles
|
||||
lat += lat_cell_no * lat_cell_size
|
||||
|
||||
Reference in New Issue
Block a user