File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,23 @@ def get_headers(access_token):
2424 return headers
2525
2626def format_details (details , countries ):
27+ """
28+ Format details given a countries object.
29+
30+ The countries object can be retrieved from read_country_names.
31+ """
2732 details ["country_name" ] = countries .get (details .get ("country" ))
2833 details ["latitude" ], details ["longitude" ] = read_coords (
2934 details .get ("loc" )
3035 )
3136
3237def read_coords (location ):
38+ """
39+ Given a location of the form `<lat>,<lon>`, returns the latitude and
40+ longitude as a tuple.
41+
42+ Returns None for each tuple item if the form is invalid.
43+ """
3344 lat , lon = None , None
3445 coords = tuple (location .split ("," )) if location else ""
3546 if len (coords ) == 2 and coords [0 ] and coords [1 ]:
You can’t perform that action at this time.
0 commit comments