diff --git a/ndbcbuoy.py b/ndbcbuoy.py index 02e023c..78f1e3b 100644 --- a/ndbcbuoy.py +++ b/ndbcbuoy.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd -from sendtext import sendtext #sendtext(height,period) +from send_text import send_text #sendtext(height,period) class BuoyData: ''' Initializes to buoy#46224. To change #, set_buoy_n(#). To save the url, set_buoy_url() ''' @@ -27,7 +27,7 @@ def send_sms(self): height = d[1][1] period = d[1][2] if height > 2: #adjust number to reflect wave height(ft) preference - return sendtext(height, period) + return send_text(height, period) else: return f"Nope. Waves bigger than {height} in my toilet bowl!" @@ -99,8 +99,8 @@ def create_dict(self): wave_data = {} n = 0 for i in cleaned_data[2::2]: # i = every 2nd data item - wave_data[n] = [i[5:16], float("{:.2f}".format(float(i[33:36])*3.281)),float("{:.2f}".format(float(i[39:42]))),i[49:52]] - n +=1 + wave_data[n] = [i[5:16], float("{:.2f}".format(float(i[33:36])*3.281)), float("{:.2f}".format(float(i[39:42]))), i[49:52]] + n += 1 return wave_data def get_dataframe(self): @@ -108,7 +108,7 @@ def get_dataframe(self): return df def display_wave_data(self): - x , y1, y2, y3 = [], [], [], [] + x, y1, y2, y3 = [], [], [], [] wave_data = self.buoy_request() for i in wave_data.items(): x.append(i[1][0]) @@ -119,8 +119,8 @@ def display_wave_data(self): y1.reverse() y2.reverse() y3.reverse() - plt.plot(x, y1, label ='ft') - plt.plot(x,y2, label='sec') + plt.plot(x, y1, label='ft') + plt.plot(x, y2, label='sec') plt.show() def save_buoy_details(self): diff --git a/sendtext.py b/send_text.py similarity index 94% rename from sendtext.py rename to send_text.py index d3d99b1..2267188 100644 --- a/sendtext.py +++ b/send_text.py @@ -16,5 +16,5 @@ def sendtext(height, period): client.messages.create( to="+", # phone to send SMS to from_="+", # twilio account phone - body= sms_body) + body=sms_body) return sms_body diff --git a/twiliokey.py b/twilio_key.py similarity index 100% rename from twiliokey.py rename to twilio_key.py diff --git a/waveTask/tasker.py b/waveTask/tasker.py index 83adcfc..2330727 100644 --- a/waveTask/tasker.py +++ b/waveTask/tasker.py @@ -18,7 +18,7 @@ def get_sid(self): def get_auth(self): return self.auth_token_key -def sendtext(height, period): +def send_text(height, period): ''' requires a height and period variable, SMS decision is based on height''' key = TwilioKey() @@ -33,7 +33,7 @@ def sendtext(height, period): client.messages.create( to="PHONE NUMBER TO SEND TO", from_="YOUR OWN TWILIO PHONE NUMBER", - body= sms_body) + body=sms_body) return sms_body @@ -48,7 +48,7 @@ def __init__(self): self.save_content_to_file() def __repr__(self): - return {self.buoy:self.url} + return {self.buoy: self.url} def __str__(self): return self.url @@ -61,7 +61,7 @@ def send_sms(self): if height > 2: #adjust number to reflect wave height(ft) preference print( f"! ! ! ! ! ! \n" \ f"GO SURF! Waves are {height}ft @ {period}s") - return sendtext(height, period) + return send_text(height, period) else: return f"! ! ! ! ! ! \n" \ f"Nope, I'v seen waves bigger than {height}ft in my toilet bowl!\n\n" @@ -134,8 +134,8 @@ def create_dict(self): wave_data = {} n = 0 for i in cleaned_data[2::2]: # i = every 2nd data item - wave_data[n] = [i[5:16], float("{:.2f}".format(float(i[33:36])*3.281)),float("{:.2f}".format(float(i[39:42]))),i[49:52]] - n +=1 + wave_data[n] = [i[5:16], float("{:.2f}".format(float(i[33:36])*3.281)), float("{:.2f}".format(float(i[39:42]))), i[49:52]] + n += 1 return wave_data def get_dataframe(self): @@ -143,7 +143,7 @@ def get_dataframe(self): return df def display_wave_data(self): - x , y1, y2, y3 = [], [], [], [] + x, y1, y2, y3 = [], [], [], [] wave_data = self.buoy_request() for i in wave_data.items(): x.append(i[1][0]) @@ -154,8 +154,8 @@ def display_wave_data(self): y1.reverse() y2.reverse() y3.reverse() - plt.plot(x, y1, label ='ft') - plt.plot(x,y2, label='sec') + plt.plot(x, y1, label='ft') + plt.plot(x, y2, label='sec') plt.show() def save_buoy_details(self):