diff options
author | Devaev Maxim <[email protected]> | 2019-04-08 04:58:32 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-04-08 04:58:32 +0300 |
commit | 9243d2a00c86aa9b5df2b1df20d2ba57be0bed47 (patch) | |
tree | 4d86bf39d432af121fff66a863864719c885d84d /kvmd/validators/__init__.py | |
parent | 7eca51f17b7c2c95b54d4c2b77caa6c8554ef4f4 (diff) |
refactoring
Diffstat (limited to 'kvmd/validators/__init__.py')
-rw-r--r-- | kvmd/validators/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kvmd/validators/__init__.py b/kvmd/validators/__init__.py index f4b0f1fa..5556f564 100644 --- a/kvmd/validators/__init__.py +++ b/kvmd/validators/__init__.py @@ -23,8 +23,11 @@ import re from typing import List +from typing import Mapping +from typing import Sequence from typing import Callable from typing import NoReturn +from typing import Union from typing import Any @@ -54,13 +57,13 @@ def check_not_none_string(arg: Any, name: str, strip: bool=True) -> str: return arg -def check_in_list(arg: Any, name: str, variants: List) -> Any: +def check_in_list(arg: Any, name: str, variants: Union[Sequence, Mapping]) -> Any: if arg not in variants: raise_error(arg, name) return arg -def check_string_in_list(arg: Any, name: str, variants: List[str], lower: bool=True) -> Any: +def check_string_in_list(arg: Any, name: str, variants: Union[Sequence[str], Mapping[str, Any]], lower: bool=True) -> Any: arg = check_not_none_string(arg, name) if lower: arg = arg.lower() |