mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-07-05 20:42:12 -07:00
+xlib.appargs
This commit is contained in:
parent
8843d874cf
commit
071bf80681
2 changed files with 20 additions and 0 deletions
3
xlib/appargs/__init__.py
Normal file
3
xlib/appargs/__init__.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
"""
|
||||
"""
|
||||
from .appargs import get_arg_bool, get_arg_str, set_arg_bool, set_arg_str
|
17
xlib/appargs/appargs.py
Normal file
17
xlib/appargs/appargs.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
|
||||
def set_arg_str(name : str, value : str):
|
||||
os.environ[name] = value
|
||||
|
||||
def set_arg_bool(name : str, value : bool):
|
||||
set_arg_str(name, '1' if value else '0')
|
||||
|
||||
def get_arg_str(name : str, default = None) -> str:
|
||||
return os.environ.get(name, default)
|
||||
|
||||
def get_arg_bool(name : str, default = False) -> bool:
|
||||
x = get_arg_str(name, default=None)
|
||||
if x is None:
|
||||
return default
|
||||
return bool(int(x))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue