File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,23 @@ def isvalidtype(val):
225225 return False
226226
227227
228+ def is_valid_map_coordinate (val : int | float | str ) -> bool :
229+ """
230+ test for valid map coordinate:
231+ must be 0-100 and limited to 2 decimal places.
232+ """
233+ if isinstance (val , str ):
234+ try :
235+ val = float (val )
236+ except ValueError :
237+ return False
238+
239+ if not isinstance (val , (int , float )):
240+ return False
241+
242+ return 0 <= val <= 100 and round (val , 2 ) == val
243+
244+
228245# =============================================================================
229246# Line Preprocessing (matches Perl read_config_file behavior)
230247# =============================================================================
Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ def test_apuse_csv():
2121 ds .isvalidwifi5chan ,
2222 ds .isint ,
2323 ds .isintorempty ,
24- ds .isintorempty ,
25- ds .isintorempty ,
24+ ds .is_valid_map_coordinate ,
25+ ds .is_valid_map_coordinate ,
2626 ],
2727 }
2828 result , err = ds .test_csvfile (meta )
You can’t perform that action at this time.
0 commit comments