|
|
|
@ -109,7 +109,9 @@ def _lower_strlist(input: T.List[str]) -> T.List[str]: |
|
|
|
|
return [i.lower() for i in input] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def variables_validator(contents: T.Union[T.List[str], T.Dict[str, str]]) -> T.Optional[str]: |
|
|
|
|
def variables_validator(contents: T.Union[str, T.List[str], T.Dict[str, str]]) -> T.Optional[str]: |
|
|
|
|
if isinstance(contents, str): |
|
|
|
|
contents = [contents] |
|
|
|
|
if isinstance(contents, dict): |
|
|
|
|
variables = contents |
|
|
|
|
else: |
|
|
|
@ -130,7 +132,9 @@ def variables_validator(contents: T.Union[T.List[str], T.Dict[str, str]]) -> T.O |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def variables_convertor(contents: T.Union[T.List[str], T.Dict[str, str]]) -> T.Dict[str, str]: |
|
|
|
|
def variables_convertor(contents: T.Union[str, T.List[str], T.Dict[str, str]]) -> T.Dict[str, str]: |
|
|
|
|
if isinstance(contents, str): |
|
|
|
|
contents = [contents] |
|
|
|
|
if isinstance(contents, dict): |
|
|
|
|
return contents |
|
|
|
|
variables = {} |
|
|
|
@ -433,7 +437,9 @@ SOURCES_KW: KwargInfo[T.List[T.Union[str, File, CustomTarget, CustomTargetIndex, |
|
|
|
|
|
|
|
|
|
VARIABLES_KW: KwargInfo[T.Dict[str, str]] = KwargInfo( |
|
|
|
|
'variables', |
|
|
|
|
(ContainerTypeInfo(list, str), ContainerTypeInfo(dict, str)), |
|
|
|
|
# str is listified by validator/convertor, cannot use listify=True here because |
|
|
|
|
# that would listify dict too. |
|
|
|
|
(str, ContainerTypeInfo(list, str), ContainerTypeInfo(dict, str)), # type: ignore |
|
|
|
|
validator=variables_validator, |
|
|
|
|
convertor=variables_convertor, |
|
|
|
|
default={}, |
|
|
|
|