Commit cbda41c7 authored by Landon DeCoito's avatar Landon DeCoito

messed with parscript

parent 78ad2372
...@@ -25,8 +25,26 @@ class eventException: #this class is just an exception for our use ...@@ -25,8 +25,26 @@ class eventException: #this class is just an exception for our use
def __str__(self): def __str__(self):
return self.__message return self.__message
def doTheTime(strin):
strin = strin.replace(" ", "")
strin = strin.split("-")
returnlist = ["",""]
try:
returnlist[1] = convertTime(strin[1])
except ValueError:
raise eventException(str(strin))
if not (strin[0][-2:] == "am") and not (strin[0][-2:] == "pm"):
if (strin[1][-2:] == "am"):
returnlist[0] = convertTime(strin[0] + "am")
else:
returnlist[0] = convertTime(strin[0] + "pm")
else:
returnlist[0] = convertTime(strin[0])
return returnlist
#convertTime accepts strings in the form of ""
def convertTime(stri): #this function is used for splicing the event times. def convertTime(stri): #this function is used for splicing the event times.
if (stri[-2:] == "pm" or stri[-2:] == "PM"]): #checks to see if the time presented is pm if (stri[-2:] == "pm" or stri[-2:] == "PM"): #checks to see if the time presented is pm
if not ((stri[0] == "1") and (stri[1] == "2")): #if the time is pm, then the 12:00 hour is noon and shouldn't get 12 added to it if not ((stri[0] == "1") and (stri[1] == "2")): #if the time is pm, then the 12:00 hour is noon and shouldn't get 12 added to it
try: #this try block works with the exception handler to add 12 to any pm times try: #this try block works with the exception handler to add 12 to any pm times
stri = stri.replace(stri[0:2], str(int(stri[0:2]) + 12), 1) stri = stri.replace(stri[0:2], str(int(stri[0:2]) + 12), 1)
...@@ -256,5 +274,4 @@ def load_data(): ...@@ -256,5 +274,4 @@ def load_data():
dictlist.append({"id":uniqueid, "error":error}) dictlist.append({"id":uniqueid, "error":error})
return dictlist return dictlist
#everything in the house is fuzzy, stupid dogs were acting like pollinators, if that's how you even spell it #everything in the house is fuzzy, stupid dogs were acting like pollinators, if that's how you even spell it
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment