From 961aa9ff57db4bd3b0b669a949ecef341b8c016a Mon Sep 17 00:00:00 2001 From: RGBCube <78925721+RGBCube@users.noreply.github.com> Date: Fri, 14 Jan 2022 16:28:35 +0300 Subject: [PATCH] code simplification --- db.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/db.py b/db.py index 8a1e531..1cad59d 100644 --- a/db.py +++ b/db.py @@ -24,10 +24,7 @@ class ClutterDB: def get(self, key: str, *, default=None): with open(self.path_to_json, mode="r") as json_file: json_data = json.load(json_file) - if key in json_data: - return json_data[key] - else: - return default + return json_data.get(key, default) def all(self): with open(self.path_to_json, mode="r") as json_file: