Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
mason-today-web
Commits
cbda41c7
Commit
cbda41c7
authored
Mar 29, 2018
by
Landon DeCoito
Browse files
messed with parscript
parent
78ad2372
Changes
1
Hide whitespace changes
Inline
Side-by-side
mason-today/parscript.py
View file @
cbda41c7
...
...
@@ -25,8 +25,26 @@ class eventException: #this class is just an exception for our use
def
__str__
(
self
):
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.
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
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
)
...
...
@@ -256,5 +274,4 @@ def load_data():
dictlist
.
append
({
"id"
:
uniqueid
,
"error"
:
error
})
return
dictlist
#everything in the house is fuzzy, stupid dogs were acting like pollinators, if that's how you even spell it
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment