Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some spacing and applied snake case #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ndbcbuoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() '''
Expand All @@ -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!"

Expand Down Expand Up @@ -99,16 +99,16 @@ 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):
df = pd.DataFrame(self.create_dict())
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])
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion sendtext.py → send_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
18 changes: 9 additions & 9 deletions waveTask/tasker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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


Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -134,16 +134,16 @@ 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):
df = pd.DataFrame(self.create_dict())
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])
Expand All @@ -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):
Expand Down