changed errortype for consistency with py default behavior

This commit is contained in:
vky 2022-01-29 23:32:39 +01:00
parent ca200b1c23
commit 72dee6dac7
1 changed files with 5 additions and 5 deletions

View File

@ -38,20 +38,20 @@ class environment():
def __getattr__(self, attribute):
if attribute[0] == "_":
super().__getattr__(attribute)
super().__getattribute__(attribute)
elif attribute in self._mParams:
return self._mParams[attribute]
elif attribute in self._sParams:
return self._sParams[attribute]
else:
raise KeyError(attribute)
raise AttributeError(attribute)
def __setattr__ (self, attribute, value):
def __setattr__(self, attribute, value):
if attribute[0] == "_":
super().__setattr__(attribute, value)
elif attribute in self._mParams:
self._mParams[attribute] = value
elif attribute in self._sParams:
self._sParams[attribute] = value
else:
raise KeyError(attribute) #could also add attribute as a new entry
else:
raise AttributeError(attribute) # Could also add attribute as a new entry