Skip to content

Commit

Permalink
fix: linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MitanOmar committed Oct 6, 2023
1 parent a1c3bd2 commit d4d9987
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion caluma/caluma_core/jexl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
17 changes: 10 additions & 7 deletions caluma/caluma_core/tests/test_jexl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions caluma/caluma_form/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d4d9987

Please sign in to comment.