autopep8, the formatting was all over the place to the point where it wouldn't run

Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
Abdulkadir Furkan Şanlı 2022-09-24 21:45:42 +02:00
parent 711c2ee938
commit 366de19017
Signed by: afk
GPG Key ID: C8F00588EE6ED1FE

12
naut.py
View File

@ -11,6 +11,8 @@ from time import strftime
import random
# haversine function to determine distance between two lat,long points
def haversine(lat1, lon1, lat2, lon2):
R = 3959.87433 # earth radius in miles
dLat = radians(lat2 - lat1)
@ -20,10 +22,13 @@ def haversine(lat1, lon1, lat2, lon2):
return R*c
# get a random enough number
def getfloat():
output = random.random()
return output
def str_time_prop(start, end, format, prop):
# get a time at a proportion of a range of two formatted times
stime = start
@ -33,12 +38,16 @@ def str_time_prop(start, end, format, prop):
return time.strftime(format, time.localtime(ptime))
# get random time in the future
def random_date(start, end, prop):
return str_time_prop(start, end, '%m/%d/%Y %I:%M%p', prop)
# function to generate a lat,long coordinate within a range
# inspiration from this post:
# https://gis.stackexchange.com/questions/25877/generating-random-locations-nearby
def create_random_point(x0, y0, distance):
# approximately 1609 meters in a mile
# 5 miles = about 8045
@ -97,7 +106,8 @@ for i in range(1,2):
print "Distance between points is ", dist
print "destination: "+dest_lat+" "+dest_long
print "future_time: "+future_time
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)
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)
msg_breaker = '~'
msg_space = '`'