Port from Python 2 to 3, Python is dead, long live Python

Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
Abdulkadir Furkan Şanlı 2022-09-24 22:01:03 +02:00
parent 0282195c3f
commit a079c66949
Signed by: afk
GPG Key ID: C8F00588EE6ED1FE

42
naut.py
View File

@ -1,6 +1,6 @@
# !/usr/bin/python # !/usr/bin/python
from __future__ import division
from math import radians, cos, sin, asin, sqrt from math import radians, cos, sin, asin, sqrt
import numpy as np import numpy as np
import subprocess import subprocess
@ -62,8 +62,8 @@ def create_random_point(x0, y0, distance):
x = w * np.cos(t) x = w * np.cos(t)
x1 = x / np.cos(y0) x1 = x / np.cos(y0)
y = w * np.sin(t) y = w * np.sin(t)
print "u="+str(u) print("u="+str(u))
print "v="+str(v) print("v="+str(v))
return (x0+x1, y0+y) return (x0+x1, y0+y)
@ -103,9 +103,9 @@ for i in range(1, 2):
origplot = (latitude1, longitude1) origplot = (latitude1, longitude1)
dist = haversine(origplot[0], origplot[1], newplot[0], newplot[1]) dist = haversine(origplot[0], origplot[1], newplot[0], newplot[1])
dist = str(format(dist, '.2f')) dist = str(format(dist, '.2f'))
print "Distance between points is ", dist print("Distance between points is ", dist)
print "destination: "+dest_lat+" "+dest_long print("destination: "+dest_lat+" "+dest_long)
print "future_time: "+future_time print("future_time: "+future_time)
logfile.write(dtime+" homebase_lat="+orig_lat+" homebase_long="+orig_long+" dest_lat=" + logfile.write(dtime+" homebase_lat="+orig_lat+" homebase_long="+orig_long+" dest_lat=" +
dest_lat+" dest_long="+dest_long+" future_time="+future_time+" dist="+dist) dest_lat+" dest_long="+dest_long+" future_time="+future_time+" dist="+dist)
@ -119,21 +119,21 @@ for i in range(1, 2):
rabbit_msg2 = 'white rabbit...' rabbit_msg2 = 'white rabbit...'
logfile.write("\n") logfile.write("\n")
print init1_msg print(init1_msg)
time.sleep(5) time.sleep(5)
print msg_breaker print(msg_breaker)
print init_msg print(init_msg)
time.sleep(5) time.sleep(5)
print msg_breaker print(msg_breaker)
print rabbit_msg1 print(rabbit_msg1)
print msg_breaker print(msg_breaker)
print msg_space2 print(msg_space2)
print rabbit_msg2 print(rabbit_msg2)
time.sleep(5) time.sleep(5)
print msg_breaker print(msg_breaker)
print " "+future_time print(" "+future_time)
print msg_breaker print(msg_breaker)
print " "+dest_lat print(" "+dest_lat)
print msg_space print(msg_space)
print dest_long print(dest_long)
print "https://www.google.com/maps/search/?api=1&query="+dest_lat+","+dest_long+" Time: "+future_time print("https://www.google.com/maps/search/?api=1&query="+dest_lat+","+dest_long+" Time: "+future_time)