Files
facefusion/facefusion/capability_store.py
T
Henry Ruhs a2a02cfd8a Better args types part2 (#1051)
* remove helper methods finally

* state becomes the total truth now

* state becomes the total truth now

* state becomes the total truth now

* state becomes the total truth now

* add ini file
2026-03-17 14:02:16 +01:00

55 lines
1.2 KiB
Python

from argparse import Action
from typing import Dict, List
from facefusion.types import CapabilitySet, CapabilityStore, Scope
CAPABILITY_STORE : CapabilityStore =\
{
'api': {},
'cli': {},
'sys': {}
}
def get_api_capability_set() -> Dict[str, CapabilitySet]:
return CAPABILITY_STORE.get('api')
def get_cli_capability_set() -> Dict[str, CapabilitySet]:
return CAPABILITY_STORE.get('cli')
def get_sys_capability_set() -> Dict[str, CapabilitySet]:
return CAPABILITY_STORE.get('sys')
def get_api_arguments() -> List[str]:
return list(get_api_capability_set().keys())
def get_cli_arguments() -> List[str]:
return list(get_cli_capability_set().keys())
def get_sys_arguments() -> List[str]:
return list(get_sys_capability_set().keys())
def register_capability_set(actions : List[Action], scopes : List[Scope]) -> None:
for action in actions:
value : CapabilitySet =\
{
'default': action.default
}
if action.choices:
value['choices'] = list(action.choices)
for scope in scopes:
if scope == 'api':
CAPABILITY_STORE['api'][action.dest] = value
if scope == 'cli':
CAPABILITY_STORE['cli'][action.dest] = value
if scope == 'sys':
CAPABILITY_STORE['sys'][action.dest] = value