Cannot use parameterized arguments in 3

This commit is contained in:
mmcwilliams 2024-06-28 09:35:43 -04:00
parent c3ecddcf3d
commit ff090f2744
1 changed files with 4 additions and 2 deletions

View File

@ -77,17 +77,18 @@ class WordHasher(object):
self.six_wordlist = HUMAN_WORDLIST
self.three_wordlist = GOOGLE_WORDLIST
def three_words(self, (lat, lon)):
def three_words(self, lat_long):
"""Convert coordinate to a combination of three words
The coordinate is defined by latitude and longitude
in degrees.
"""
lat, lon = lat_long
gh = geohash.encode(lat, lon, 9)
words = "-".join(self.three_wordlist[p] for p in self.to_rugbits(self.geo_to_int(gh)))
return words
def six_words(self, (lat, lon)):
def six_words(self, lat_long):
"""Convert coordinate to a combination of six words
The coordinate is defined by latitude and longitude
@ -96,6 +97,7 @@ class WordHasher(object):
With six words the word list contains only words
which are short, easy to pronounce and easy distinguish.
"""
lat, lon = lat_long
gh = geohash.encode(lat, lon, 9)
words = "-".join(self.six_wordlist[p] for p in self.to_bytes(self.pad(gh)))
return words