Files
facefusion/facefusion/args_store.py
T
Henry Ruhs 051aed6133 Scope for Args (#988)
* Add API scopes

* Add API scopes

* Add API scopes

* Add API scopes

* Add API scopes

* Add API scopes

* Add API scopes

* Add API scopes

* Remove system memory limit (#986)

* Add session_id, make token size more reasonable (#983)

* Add session_id, make token size more reasonable

* Use more direct approach

* Fix more stuff

* Fix ignore comments

* Fix naming

* Fix lint
2026-03-17 14:01:46 +01:00

67 lines
1.3 KiB
Python

from typing import List
from facefusion.types import Args, ArgsStore, Scope
ARGS_STORE : ArgsStore =\
{
'api': [],
'cli': [],
'sys': []
}
def get_api_args() -> List[str]:
return ARGS_STORE.get('api')
def get_sys_args() -> List[str]:
return ARGS_STORE.get('sys')
def get_cli_args() -> List[str]:
return ARGS_STORE.get('cli')
def register_args(keys : List[str], scopes : List[Scope]) -> None:
for key in keys:
for scope in scopes:
if scope == 'api':
ARGS_STORE['api'].append(key)
if scope == 'cli':
ARGS_STORE['cli'].append(key)
if scope == 'sys':
ARGS_STORE['sys'].append(key)
def filter_api_args(args : Args) -> Args:
api_args =\
{
key: args.get(key) for key in args if key in get_api_args() #type:ignore[literal-required]
}
return api_args
def filter_sys_args(args : Args) -> Args:
sys_args =\
{
key: args.get(key) for key in args if key in get_sys_args() #type:ignore[literal-required]
}
return sys_args
def filter_cli_args(args : Args) -> Args:
cli_args =\
{
key: args.get(key) for key in args if key in get_cli_args() #type:ignore[literal-required]
}
return cli_args
def filter_step_args(args : Args) -> Args:
step_args =\
{
key: args.get(key) for key in args if key in get_cli_args() and key not in get_sys_args() #type:ignore[literal-required]
}
return step_args