-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove map related code in scripts handling both geo data and translations #6241
Remove map related code in scripts handling both geo data and translations #6241
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @raksooo)
gui/scripts/fetch-relay-locations.py
line 52 at r1 (raw file):
country_code, city_code = location_key.split("-") if country_name is None:
Can this ever be None
? Doesn't look like it. It can be an empty string, though.
gui/scripts/fetch-relay-locations.py
line 56 at r1 (raw file):
continue if city_name is None:
Can this ever be None
? Doesn't look like it. It can be an empty string, though.
gui/scripts/fetch-relay-locations.py
line 65 at r1 (raw file):
country = countries[country_code] cities = country["cities"] if location_key != "se-bet":
Is this still a thing? I can't recall seeing any "beta" relays.
2135ecc
to
9eabe74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 5 files reviewed, 2 unresolved discussions (waiting on @dlon)
gui/scripts/fetch-relay-locations.py
line 52 at r1 (raw file):
Previously, dlon (David Lönnhager) wrote…
Can this ever be
None
? Doesn't look like it. It can be an empty string, though.
I'm not very experienced with Python, but from my understanding this would be None
if location
doesn't have a country, which would only happen if the the relay list doesn't look as expected, and IMO it makes sense to account for that.
This code isn't new, it's been copied from the old scripts that did much more than what this one is doing.
gui/scripts/fetch-relay-locations.py
line 65 at r1 (raw file):
Previously, dlon (David Lönnhager) wrote…
Is this still a thing? I can't recall seeing any "beta" relays.
I've never read this script thoroughly enough to see this 😆 Removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @raksooo)
gui/scripts/fetch-relay-locations.py
line 42 at r1 (raw file):
for location_key in locations: location = locations.get(location_key)
This can be rewritten as
for location_key, location in location.items():
Code quote:
for location_key in locations:
location = locations.get(location_key)
gui/scripts/fetch-relay-locations.py
line 52 at r1 (raw file):
Previously, raksooo (Oskar Nyberg) wrote…
I'm not very experienced with Python, but from my understanding this would be
None
iflocation
doesn't have a country, which would only happen if the the relay list doesn't look as expected, and IMO it makes sense to account for that.This code isn't new, it's been copied from the old scripts that did much more than what this one is doing.
My bad, I must have gotten country_name
and country_code
mixed up. It would be less misleading to assign the variables immediately before checking if they're None
:
country_name = location.get('country')
if not country_name:
...
city_name = location.get('city')
if not city_name:
...
gui/scripts/fetch-relay-locations.py
line 125 at r2 (raw file):
extract_relay_translations() main()
Not too important, but typically you only call main()
if this is the top-level module:
if __name__ == '__main__':
main()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @raksooo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving code as is since this PR hasn't changed that code.
Reviewable status: complete! all files reviewed, all discussions resolved
This PR removes the parts that handle map data and translations of relay locations from the
extract-geo-data.py
andintegrate-into-app.py
scripts. It also renames those scripts. The remaining parts are for fetching the relay list and adding all locations to the translation template (relay-locations.pot
).This change is