mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-07 13:32:09 -07:00
added missing file
This commit is contained in:
parent
7b70e7eec1
commit
5f80ea0513
1 changed files with 26 additions and 0 deletions
26
utils/console_utils.py
Normal file
26
utils/console_utils.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
|
||||||
|
def input_int(s, default_value, valid_list=None):
|
||||||
|
try:
|
||||||
|
inp = input(s)
|
||||||
|
i = int(inp)
|
||||||
|
if (valid_list is not None) and (i not in valid_list):
|
||||||
|
return default_value
|
||||||
|
return i
|
||||||
|
except:
|
||||||
|
return default_value
|
||||||
|
|
||||||
|
def input_bool(s, default_value):
|
||||||
|
try:
|
||||||
|
return bool ( {"y":True,"n":False,"1":True,"0":False}.get(input(s).lower(), default_value) )
|
||||||
|
except:
|
||||||
|
return default_value
|
||||||
|
|
||||||
|
def input_str(s, default_value, valid_list=None):
|
||||||
|
try:
|
||||||
|
inp = input(s)
|
||||||
|
if (valid_list is not None) and (inp.lower() not in valid_list):
|
||||||
|
return default_value
|
||||||
|
return inp
|
||||||
|
except:
|
||||||
|
return default_value
|
Loading…
Add table
Add a link
Reference in a new issue