Skip to content

Commit 5c02be8

Browse files
committed
feat: add string to boolean function to config helper
1 parent bdb0962 commit 5c02be8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tools/confighelper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import os
22

3+
def str_to_bool(input):
4+
if input.lower() in ["true", "yes", "y", "1"]:
5+
return True
6+
elif input.lower() in ["false", "no", "n", "0"]:
7+
return False
8+
else:
9+
raise ValueError(f'"{input}" can no be converted to boolean')
10+
311
class DectWIPConfig():
412
import configparser
513
config = configparser.ConfigParser()

0 commit comments

Comments
 (0)