1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Added bool support to MacConfig

This commit is contained in:
A_D 2020-11-23 08:01:27 +02:00 committed by Athanasius
parent 9e1bb0a2a2
commit bb431b83c1

View File

@ -582,7 +582,17 @@ class MacConfig(AbstractConfig):
logger.error(f'__raw_get returned {res!r} which cannot be parsed to an int: {e}')
return default
def set(self, key: str, val: Union[int, str, List[str]]) -> None:
def get_bool(self, key: str, default: Optional[bool] = None) -> Optional[bool]:
res = self.__raw_get(key)
if res is None:
return default
elif not isinstance(res, bool):
raise ValueError(f'__raw_get returned unexpected type {type(res)=} {res!r}')
return res
def set(self, key: str, val: Union[int, str, List[str], bool]) -> None:
"""
Set sets the given key to the given value.