Added bool support to MacConfig

This commit is contained in:
A_D authored and Athanasius committed 2021-04-01 14:45:45 +01:00
1 parent 9e1bb0a2a2
commit bb431b83c1
1 file changed
+11 -1
+11 -1
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.