1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-20 10:57:37 +03:00

config/__init__: Remove use of typing.Union

This commit is contained in:
Athanasius 2022-12-23 12:14:54 +00:00
parent b3719347e8
commit 1e0d99a61f
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

View File

@ -40,7 +40,7 @@ import sys
import traceback
import warnings
from abc import abstractmethod
from typing import Any, Callable, List, Optional, Type, TypeVar, Union
from typing import Any, Callable, List, Optional, Type, TypeVar
import semantic_version
@ -293,7 +293,7 @@ class AbstractConfig(abc.ABC):
@staticmethod
def _suppress_call(
func: Callable[..., _T], exceptions: Union[Type[BaseException], List[Type[BaseException]]] = Exception,
func: Callable[..., _T], exceptions: Type[BaseException] | List[Type[BaseException]] = Exception,
*args: Any, **kwargs: Any
) -> Optional[_T]:
if exceptions is None:
@ -309,8 +309,8 @@ class AbstractConfig(abc.ABC):
def get(
self, key: str,
default: Union[list, str, bool, int, None] = None
) -> Union[list, str, bool, int, None]:
default: list | str | bool | int | None = None
) -> list | str | bool | int | None:
"""
Return the data for the requested key, or a default.
@ -399,7 +399,7 @@ class AbstractConfig(abc.ABC):
raise NotImplementedError
@abstractmethod
def set(self, key: str, val: Union[int, str, List[str], bool]) -> None:
def set(self, key: str, val: int | str | List[str] | bool) -> None:
"""
Set the given key's data to the given value.