mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
17 lines
387 B
Python
17 lines
387 B
Python
|
from random import choice
|
||
|
from string import ascii_letters, digits
|
||
|
|
||
|
|
||
|
def parse_bool(str):
|
||
|
str_lower = str.lower()
|
||
|
if str_lower == "false":
|
||
|
return False
|
||
|
elif str_lower == "true":
|
||
|
return True
|
||
|
else:
|
||
|
raise (ValueError(f'Can not parse a bool from "{str}"'))
|
||
|
|
||
|
|
||
|
def randomPassword():
|
||
|
return "".join(choice(ascii_letters + digits) for i in range(12))
|