'Refactored by Sourcery' (#188)

This commit is contained in:
LopeKinz
2023-06-19 13:26:55 +02:00
committed by GitHub
parent 52a021f8de
commit ac958df8d7
4 changed files with 9 additions and 10 deletions

View File

@@ -14,11 +14,10 @@ class DB:
def __getitem__(self, key):
full_path = self.path / key
if full_path.is_file():
with full_path.open("r", encoding="utf-8") as f:
return f.read()
else:
if not full_path.is_file():
raise KeyError(key)
with full_path.open("r", encoding="utf-8") as f:
return f.read()
def __setitem__(self, key, val):
full_path = self.path / key