From 5ca7e792083f25b487890f9f38ae57bd3f9c29c4 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 3 Feb 2022 03:30:52 +0300 Subject: Remove unnecessary computation In Python3 when slicing, seq[:min(some_val, len(seq))] == seq[:some_val] because Python3 will just return a copy of the entire sequence if `some_val` happens to be larger/greater than the length of the sequence. This commit removes the unnecessary call to `min()` --- gn3/computations/partial_correlations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/computations') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 9bad12a..157024b 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -753,7 +753,7 @@ def partial_correlations_entry(# pylint: disable=[R0913, R0914, R0911] selected_results = sorted( all_correlations, - key=__make_sorter__(method))[:min(criteria, len(all_correlations))] + key=__make_sorter__(method))[:criteria] traits_list_corr_info = { f"{target_dataset['dataset_name']}::{item[0]}": { "noverlap": item[1], -- cgit v1.2.3