From d4d998771afb62b7a7872d5089d4c6dbb75b250a Mon Sep 17 00:00:00 2001 From: Mitan Omar Date: Fri, 6 Oct 2023 03:17:31 +0200 Subject: [PATCH] fix: linter issues --- caluma/caluma_core/jexl.py | 2 +- caluma/caluma_core/tests/test_jexl.py | 17 ++++++++++------- caluma/caluma_form/models.py | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/caluma/caluma_core/jexl.py b/caluma/caluma_core/jexl.py index d0af1d82b..b2baf7504 100644 --- a/caluma/caluma_core/jexl.py +++ b/caluma/caluma_core/jexl.py @@ -118,7 +118,7 @@ def _handle_error_with_filter(func, subject, *args): ) def _round_compat(self, num, ndigits=0): - power = 10**ndigits + power = 10 ** ndigits return float(math.floor((num * power) + 0.5) / power) def parse(self, expression): diff --git a/caluma/caluma_core/tests/test_jexl.py b/caluma/caluma_core/tests/test_jexl.py index d924b759e..1af30e1d3 100644 --- a/caluma/caluma_core/tests/test_jexl.py +++ b/caluma/caluma_core/tests/test_jexl.py @@ -20,14 +20,17 @@ def test_extract_transforms(expression, expected_transforms): jexl.add_transform("transform1", lambda x: x) jexl.add_transform("transform2", lambda x: x) - assert set( - jexl.analyze( - expression, - functools.partial( - ExtractTransformSubjectAnalyzer, transforms=["transform1"] - ), + assert ( + set( + jexl.analyze( + expression, + functools.partial( + ExtractTransformSubjectAnalyzer, transforms=["transform1"] + ), + ) ) - ) == set(expected_transforms) + == set(expected_transforms) + ) @pytest.mark.parametrize( diff --git a/caluma/caluma_form/models.py b/caluma/caluma_form/models.py index a83557220..2643c06c8 100644 --- a/caluma/caluma_form/models.py +++ b/caluma/caluma_form/models.py @@ -224,7 +224,7 @@ def min_value(self, value): @property def max_date(self): - if (max_date := self.configuration.get("max_date")) and max_date != 'null': + if (max_date := self.configuration.get("max_date")) and max_date != "null": return dateutil.parser.parse(json.loads(max_date)).date() @max_date.setter @@ -233,7 +233,7 @@ def max_date(self, value): @property def min_date(self): - if (min_date := self.configuration.get("min_date")) and min_date != 'null': + if (min_date := self.configuration.get("min_date")) and min_date != "null": return dateutil.parser.parse(json.loads(min_date)).date() @min_date.setter