From 49c60da52528f0ee7d0deca0d4d7479ebce2053a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:40:42 +0000 Subject: [PATCH] refactor: remove unnecessary comprehension The built-in function being used does not require comprehension and can work directly with a generator expression. --- python/demo_code.py | 2 +- python/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/demo_code.py b/python/demo_code.py index 5e502b20..34ee11ff 100644 --- a/python/demo_code.py +++ b/python/demo_code.py @@ -40,7 +40,7 @@ def limits(self): def get_number(self, min_max=[1, 10]): """Get a random number between min and max.""" - assert all([isinstance(i, int) for i in min_max]) + assert all(isinstance(i, int) for i in min_max) return random.randint(*min_max) diff --git a/python/utils.py b/python/utils.py index af8508ee..712573e3 100644 --- a/python/utils.py +++ b/python/utils.py @@ -20,7 +20,7 @@ def is_prime(x): return False return True - return all([is_prime(num) for num in nums]) + return all(is_prime(num) for num in nums) def store_paths(matrix: list[list[int]], i: int, j: int, path=[]) -> None: