From 09887b4193c587afc3e1bb0992ca27cfac601918 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Sat, 19 Feb 2022 10:39:38 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- json_wrapper.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/json_wrapper.py b/json_wrapper.py index 728e8dd..e77ded7 100644 --- a/json_wrapper.py +++ b/json_wrapper.py @@ -67,7 +67,7 @@ class _PathMagic: Returns: dict: The modified dict. """ - if key in alt_dict.keys() and isinstance(alt_dict[key], dict): + if key in alt_dict and isinstance(alt_dict[key], dict): return alt_dict alt_dict[key] = {} @@ -195,7 +195,7 @@ class JsonWrapper: json_data = self.json.data() - if pathmagic == "" or pathmagic == []: + if pathmagic in ["", []]: json_data[key] = value self.json.dump(json_data) @@ -218,7 +218,7 @@ class JsonWrapper: json_data = self.json.data() - if pathmagic == "" or pathmagic == []: + if pathmagic in ["", []]: return json_data.get(key, default) else: @@ -245,7 +245,7 @@ class JsonWrapper: json_data = self.json.data() - if pathmagic == "" or pathmagic == []: + if pathmagic in ["", []]: json_data.pop(key, None) self.json.dump(json_data) @@ -259,7 +259,7 @@ class JsonWrapper: Args: pathmagic (Union[str, List[str]], optional): The path to follow. Defaults to "". """ - if pathmagic == "" or pathmagic == []: + if pathmagic in ["", []]: self.json.dump({}) else: