-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.py
More file actions
33 lines (29 loc) · 848 Bytes
/
validate.py
File metadata and controls
33 lines (29 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Python file that contains static function that can be used for validating input from the user.
@author: Jackson Goth
"""
# Return True if float is actually a float, False otherwise
def is_valid_float(i):
if i == None or i == '':
return False
try:
j = float(i)
except ValueError:
return False
return True
# Return True if int is actually an int, False otherwise
def is_valid_int(i):
if i == None or i == '':
return False
try:
j = int(i)
except ValueError:
return False
return True
# Return a string containing which prices we want to include (formatted to specification of Fusion API)
def parse_price(price):
price_setting = ''
for i in range(int(price) - 1):
price_setting += str(i + 1) + ','
price_setting += price
return price_setting