def geohash(): if (len(sys.argv) != 4): print("Wrong argument count") return antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), sys.argv[3].encode('utf-8'))
def geohashing(): import antigravity, sys argv = sys.argv if (len(argv) != 4): print("Invalid Argument exception") else: antigravity.geohash(float(argv[1]), float(argv[2]), argv[3].encode())
def geohash_it(latitude, longitude, datedow): """ Calculate geohash from latitude longitude datedow then print it on stdout. https://xkcd.com/353/ https://xkcd.com/426/ """ geohash(float(latitude), float(longitude), str(datedow).encode("utf-8"))
def main(): if len(sys.argv) == 4: try: antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), sys.argv[3].encode()) except ValueError as e: print(e) else: print("Usage : python3 geohashing.py latitude longitude date") print("Exemple : python3 geohashing.py 37.421542 -122.085589 2005-05-26-10458.68")
def geohashing(argv): if (len(argv) != 4): return try: geohash(float(argv[1]), float(argv[2]), bytes(argv[3], 'utf-8')) except: print("Error, please try again with different values\nValid function call example: 'python3 geohashing.py 37.421542 -122.085589 2005-05-26-10458.68'")
def ge_hash(): if len(sys.argv) == 4 and valid_format(sys.argv[3]) == True: try: geohash(float(sys.argv[1]), float(sys.argv[2]), sys.argv[3].encode('utf-8')) except Exception as e: print(e) else: print("Not valid quantity of the input arguments")
def func(argv): try: if len(argv) != 5: raise Exception( "Usage: ./geohashing.py <lat> <long> <AAAA-MM-DD> <dow>") seq = (argv[3], argv[4]) s = "-".join(seq) antigravity.geohash(float(argv[1]), float(argv[2]), bytes(s, 'utf-8')) except Exception as e: print(e)
def geohashing(latitude, longitude, date, indice_dow): """ Pour utiliser geohash, voici un extrait de la doc : geohash(latitude, longitude, datedow) Compute geohash() using the Munroe algorithm. >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68') 37.857713 -122.544543 """ date_dow = date + "-" + str(indice_dow) antigravity.geohash(latitude, longitude, date_dow.encode('ascii'))
def moon(): try: if (len(sys.argv) != 4): raise Exception( "Usage: geohashing.py 37.421542 -122.085589 \"2005-05-26-10458.68\"" ) antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), bytes(sys.argv[3], 'utf-8')) except Exception as e: print(e)
def do_the_geohash(): lat = float(input('Latitude(float): ')) long = float(input('Longitude(float): ')) if iscoordinate(lat, long): dow = input('DateDow(AAAA-MM-DD-DOW): ') antigravity.geohash(lat, long, bytes(dow, 'UTF-8')) else: print("Wrong coordinates") print("Latitude between -90 and 90 degrees.") print("Longitude between -180 and 180 degrees") do_the_geohash()
def run(argc, argv): try: if (argc != 4): raise Exception( "Usage: python3 geohashing.py latitude longitude datedow\nExample: python3 geohashing.py 37.421542, -122.085589, \"2005-05-26-10458.68\"" ) latitude = argv[1] longitude = argv[2] datedow = argv[3] antigravity.geohash(float(latitude), float(longitude), bytes(datedow, 'utf-8')) except Exception as e: print(e)
def main(): if (len(sys.argv) == 4): try: latitude = float(sys.argv[3]) except: return print("latitude required type: float") try: longitude = float(sys.argv[2]) except: return print("longitude required type: float") try: date = sys.argv[1].encode('utf-8') except: return print("date required type: string") antigravity.geohash(latitude, longitude, date) else: print("Three arguments is required -> date / longitude / latitude")
def my_var(): if (len(sys.argv) == 4): return antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), sys.argv[3].encode()) else: print('Not enough data! Should be 3!\n') print( 'Give me your coordinates, date and time in the following format: \n37.421542 -122.085589 2005-05-26-10458.68' ) sys.exit()
def main(): if (len(sys.argv) != 5): print("Error : wrong number of arguments for geohashing.\n" "waiting following arguments:\n" "- latitude (ex: 37.421542)\n" "- longitude (ex: -122.085589)\n" "- date (ex : 2005-05-26)\n" "- dow (ex: 10458.68)\n") return try: latitude = float(sys.argv[1]) longitude = float(sys.argv[2]) date = sys.argv[3] dow = float(sys.argv[4]) except ValueError: print("Error : wrong type for latitude, longitude or dow") return tmp = "{}-{}".format(date, dow).encode('ascii') geohash(latitude, longitude, tmp)
def geohashing(coordonnees): if len(coordonnees) != 4: print( "4 arguments sont nécessaires : <lat> <long> <date> <indice_dow>") print( "Exemple : geohashing.py 37.421542 -122.085589 2005-05-26 10458.68" ) exit(1) try: lat = float(coordonnees[0]) long = float(coordonnees[1]) date = coordonnees[2] indice_dow = float(coordonnees[3]) date_dow = date + '-' + str(indice_dow) antigravity.geohash(lat, long, date_dow.encode('ascii')) except ValueError: print("latitude,longitude et indice_dow doivent être de type float") print( "Exemple : geohashing.py 37.421542 -122.085589 2005-05-26 10458.68" )
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import antigravity, sys #for test : # ./geohashing.py 37.421542 -122.085589 2005-05-26-10458.68 if __name__ == '__main__': if len(sys.argv) != 4: print("""il faut 3 arguments : lat: 37.421542 long: -122.085589 date sous cette forme avec l'heure-minute-seconde convertie en seconde 2005-05-26-10458.68""") sys.exit(0) antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), sys.argv[3].encode())
def geohashing(lat, long, datedow): antigravity.geohash(lat, long, datedow.encode('ascii'))
def calculate_geohash(latitude, longitude, date_index): """calculates geohash""" # print(latitude, longitude, date_index, type(date_index.encode())) antigravity.geohash(latitude, longitude, date_index.encode())
# Hayrff rkcyvpvgyl fvyraprq. # Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. # Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. # Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu. # Abj vf orggre guna arire. # Nygubhtu arire vf bsgra orggre guna *evtug* abj. # Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn. # Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. # Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!""" # # d = {} # for c in (65, 97): # for i in range(26): # d[chr(i+c)] = chr((i+13) % 26 + c) # # print("".join([d.get(c, c) for c in s])) # # import this # import antigravity # from math import pi # π = pi # r = 6 # area = π * r**2 # # résumé = 'knows Python' # 'Python' in résumé from antigravity import geohash # Your location, a date and that date's (or most recent) DJIA opening. geohash(37.421542, -122.085589, b'2005-05-26-10458.68') 37.857713 - 122.544543
print( 'Je ne comprends pas cet exercice !!! ai essaye plusieurs fois avec la localisation de 42' ) print( 'Mais renvoie a perpette alors qu il est suppose me donner des endroits proches de 42!!!!!!' ) print() print('voici un exple utilise dans le web ....') print( ' e1r7p22% ./geohashing.py 37.421542 -122.085589 2005-05-26 10458.68' ) print(' 37.857713 -122.544543') print() print('Comment verifier:') print(' e1r12p13% python3') print(' >>> import antigravity') print(' >>> import antigravity') print( " >>> antigravity.geohash(37.421542, -122.085589, b'2005-05-26-10458.68" ) print(' 37.857713 -122.544543') print() sys.exit(1) #main(sys.argv) argv = sys.argv seq = (argv[3], argv[4]) s = "-".join(seq) antigravity.geohash(float(argv[1]), float(argv[2]), bytes(s, 'utf-8'))
def main(argv): seq = (argv[3], argv[4]) s = "-".join(seq) #antigravity.geohash(float(argv[1]), float(argv[2]), bytes(s, 'utf-8')) print('s=', s) antigravity.geohash(float(argv[1]), float(argv[2]), b's')
def geohashing(params): date_dow = params[2] + "-" + str(params[3]) antigravity.geohash(params[0], params[1], date_dow.encode('ascii')) sys.exit(0)
def Traitement(lat, lon, reste): antigravity.geohash(lat, lon, reste.encode())
# -*- coding: utf-8 -*- import antigravity import sys if __name__ == '__main__': if len(sys.argv) == 4: try: antigravity.geohash(float(sys.argv[1]), float(sys.argv[2]), bytes(sys.argv[3], 'UTF-8')) except Exception as e: print(e) else: print("Wront numbers of argument.\nExample of valid call: %s" % ( "python3 geohashing.py 37.421542 -122.085589 2005-05-26-10458.68"))
def update_event(self, inp=-1): self.set_output_val( 0, antigravity.geohash(self.input(0), self.input(1), self.input(2)))
import sys import antigravity def terminal_arguments(): term_args = sys.argv[1:] if len(term_args) != 3: raise Exception( 'Three arguments only (latitude, longitude, today\'s Dow opening)') try: term_args[0], term_args[1] = float(term_args[0]), float(term_args[1]) int(term_args[2]) term_args[2] = term_args[2].encode('utf-8') except: raise ValueError('Wrong type of argument.') return term_args if __name__ == '__main__': geo_args = terminal_arguments() print(antigravity.geohash(geo_args[0], geo_args[1], geo_args[2]))
break if len(datedow) != 3 or check == 1: print("Wrong value of datedow!\n" "Right format: 2005-05-26-10458.68") return False return True def check_correctness(latitude: str, longitude: str, datedow: str): res = datedow.split('-') try: latitude_val = float(latitude) longtitude_val = float(longitude) last_part_of_dow = float(res[3]) except ValueError: print("Wrong value of parameter!\n" "Right format: 12.089") return if check_param(res[0:-1]) is False: return None datedow_val = bytes(datedow, 'utf-8') return [latitude_val, longtitude_val, datedow_val] if __name__ == '__main__': if len(sys.argv) == 4: result = check_correctness(sys.argv[1], sys.argv[2], sys.argv[3]) if result is not None: antigravity.geohash(result[0], result[1], result[2]) else: print("usage: 12.089 (latitude), -122.085589 (longitude), 2005-05-26-10458.68 (datedow)")
import sys import antigravity if __name__ == "__main__": try: if len(sys.argv) == 4: latitude = float(sys.argv[1]) longitude = float(sys.argv[2]) datedow = sys.argv[3].encode('utf-8') antigravity.geohash(latitude, longitude, datedow) else: raise IOError except (IOError, ValueError): print( "Usage: python3 geohashing.py longitude latitude datedow\n" "longitude et latitude are floats and datedow must follow the below format\n" "Example: python3 geohashing.py 37.421542 -122.085589 2005-05-26-10458.68" )
def geohash(lat, longi, datedow): antigravity.geohash(lat, longi, datedow)
def get_geohash(latitude, longitude, date, dow_jones_index): return antigravity.geohash(latitude, longitude, ('%s-%s' % (date, dow_jones_index)).encode('utf-8'))