diff options
author | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
commit | ee3e224e396494cd0d69bb6167087a071a20349c (patch) | |
tree | 5becd28570e58a03c6e1e231d0db24c264a73f88 /kvmd/validators/basic.py | |
parent | 4b75221e9470b4a009955d7677f16adf8e23e302 (diff) |
new typing style
Diffstat (limited to 'kvmd/validators/basic.py')
-rw-r--r-- | kvmd/validators/basic.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/kvmd/validators/basic.py b/kvmd/validators/basic.py index e72ad558..059ec226 100644 --- a/kvmd/validators/basic.py +++ b/kvmd/validators/basic.py @@ -22,11 +22,8 @@ import re -from typing import List from typing import Type from typing import Callable -from typing import Optional -from typing import Union from typing import Any from . import ValidatorError @@ -63,11 +60,11 @@ def valid_bool(arg: Any) -> bool: def valid_number( arg: Any, - min: Union[int, float, None]=None, # pylint: disable=redefined-builtin - max: Union[int, float, None]=None, # pylint: disable=redefined-builtin - type: Union[Type[int], Type[float]]=int, # pylint: disable=redefined-builtin + min: (int | float | None)=None, # pylint: disable=redefined-builtin + max: (int | float | None)=None, # pylint: disable=redefined-builtin + type: (Type[int] | Type[float])=int, # pylint: disable=redefined-builtin name: str="", -) -> Union[int, float]: +) -> (int | float): name = (name or type.__name__) @@ -103,9 +100,9 @@ def valid_float_f01(arg: Any) -> float: def valid_string_list( arg: Any, delim: str=r"[,\t ]+", - subval: Optional[Callable[[Any], Any]]=None, + subval: (Callable[[Any], Any] | None)=None, name: str="", -) -> List[str]: +) -> list[str]: if not name: name = "string list" |