From 547cf0cedd1de94fc789af172a1280196c504242 Mon Sep 17 00:00:00 2001 From: evidencebp Date: Mon, 14 Oct 2024 19:12:16 +0300 Subject: [PATCH] filter.py simplifiable-if-statement Code uses the pattern if test: return True else: return False Pylint alerts on that and suggest a simplification: The if statement can be replaced with 'return bool(test)' (simplifiable-if-statement) Hence I removed the if and instead returned the test directly. That simplifies the code and makes it easier to understand. --- filter.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/filter.py b/filter.py index 2eb735db..cfbbea4f 100644 --- a/filter.py +++ b/filter.py @@ -15,11 +15,7 @@ def _country_filter(src, scope, out): def filter(entry, item): matching = entry["country"] - if item == matching or item == matching.lower() or item == matching.upper(): - return True - - else: - return False + return item == matching or item == matching.lower() or item == matching.upper() return [entry for entry in src if filter(entry, scope)]