From 2afb8dcaeff82bb9307dc5a84fecadef005dea2d Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Thu, 21 Nov 2024 09:30:05 +0100 Subject: [PATCH] reduce code complexity --- src/easyreflectometry/project.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/easyreflectometry/project.py b/src/easyreflectometry/project.py index 5d435293..4d3dc0b2 100644 --- a/src/easyreflectometry/project.py +++ b/src/easyreflectometry/project.py @@ -80,11 +80,19 @@ def parameters(self) -> List[Parameter]: @property def count_free_parameters(self) -> int: - return sum(1 for parameter in self.parameters if parameter.free) + count = 0 + for parameter in self.parameters: + if parameter.free: + count += 1 + return count @property def count_fixed_parameters(self) -> int: - return sum(1 for parameter in self.parameters if not parameter.free) + count = 0 + for parameter in self.parameters: + if not parameter.free: + count += 1 + return count @property def count_parameter_user_constraints(self) -> int: