mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
Config.__getitem__(): Raise KeyError if need be
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8a316ead21
commit
2efe2f97fa
1 changed files with 4 additions and 1 deletions
|
|
@ -107,7 +107,10 @@ class Config(): # export
|
||||||
self.__conf.dump(DEBUG, "superposed configuration")
|
self.__conf.dump(DEBUG, "superposed configuration")
|
||||||
|
|
||||||
def __getitem__(self, key: str) -> Optional[str]:
|
def __getitem__(self, key: str) -> Optional[str]:
|
||||||
return self.get(key)
|
ret = self.get(key)
|
||||||
|
if ret is None:
|
||||||
|
raise KeyError(key)
|
||||||
|
return ret
|
||||||
|
|
||||||
def __setitem__(self, key: str, value: str):
|
def __setitem__(self, key: str, value: str):
|
||||||
return self.set(key, value)
|
return self.set(key, value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue