Skip to content

Industry leading face manipulation platform

Allow deep nested wording

henryruhsb6156f6073e5
diff --git a/facefusion/types.py b/facefusion/types.py
index 0b7a42d1..7057b5d5 100755
--- a/facefusion/types.py
+++ b/facefusion/types.py
@@ -1,5 +1,5 @@
from collections import namedtuple
-from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, TypeAlias, TypedDict
+from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, TypeAlias, TypedDict, Union
import numpy
from numpy.typing import NDArray
@@ -354,3 +354,5 @@ State = TypedDict('State',
'step_index' : int
})
StateSet : TypeAlias = Dict[AppContext, State]
+
+Wording : TypeAlias = Union[str, Dict[str, str]]
diff --git a/facefusion/wording.py b/facefusion/wording.py
index a71d0200..14d92160 100755
--- a/facefusion/wording.py
+++ b/facefusion/wording.py
@@ -1,5 +1,7 @@
from typing import Any, Dict, Optional
+from facefusion.types import Wording
+
WORDING : Dict[str, Any] =\
{
'conda_not_activated': 'Conda is not activated',
@@ -341,13 +343,13 @@ WORDING : Dict[str, Any] =\
}
-def get(key: str) -> Optional[str]:
- current = WORDING
+def get(notation : str) -> Optional[Wording]:
+ wording = WORDING
- for fragment in key.split('.'):
- if fragment in current:
- current = current.get(fragment)
+ for fragment in notation.split('.'):
+ if fragment in wording:
+ wording = wording.get(fragment)
else:
return None
- return current
+ return wording