Skip to content

Commit 923d002

Browse files
authored
Merge pull request #46 from Connecting-Food/release/1.5.0
1.5.0
2 parents 3b56a3d + a7ba9c4 commit 923d002

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

jqqb/operators.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ def eval_begins_with(left, right):
1616
@staticmethod
1717
def eval_between(inputs, bounds):
1818
if isinstance(inputs, list):
19-
return any(map(lambda x: bounds[0] < x < bounds[1], inputs))
19+
return any(
20+
map(
21+
lambda x: isinstance(x, type(bounds[0]))
22+
and bounds[0] < x < bounds[1],
23+
inputs,
24+
)
25+
)
2026
return False
2127

2228
@staticmethod
@@ -42,13 +48,17 @@ def eval_equal(left, right):
4248
@staticmethod
4349
def eval_greater(left, right):
4450
if isinstance(left, list):
45-
return any(map(lambda x: x > right, left))
51+
return any(
52+
map(lambda x: isinstance(x, type(right)) and x > right, left)
53+
)
4654
return False
4755

4856
@staticmethod
4957
def eval_greater_or_equal(left, right):
5058
if isinstance(left, list):
51-
return any(map(lambda x: x >= right, left))
59+
return any(
60+
map(lambda x: isinstance(x, type(right)) and x >= right, left)
61+
)
5262
return False
5363

5464
@staticmethod
@@ -84,13 +94,17 @@ def eval_is_null(inputs, _):
8494
@staticmethod
8595
def eval_less(left, right):
8696
if isinstance(left, list):
87-
return any(map(lambda x: x < right, left))
97+
return any(
98+
map(lambda x: isinstance(x, type(right)) and x < right, left)
99+
)
88100
return False
89101

90102
@staticmethod
91103
def eval_less_or_equal(left, right):
92104
if isinstance(left, list):
93-
return any(map(lambda x: x <= right, left))
105+
return any(
106+
map(lambda x: isinstance(x, type(right)) and x <= right, left)
107+
)
94108
return False
95109

96110
@staticmethod
@@ -102,7 +116,13 @@ def eval_not_begins_with(left, right):
102116
@staticmethod
103117
def eval_not_between(inputs, bounds):
104118
if isinstance(inputs, list):
105-
return not any(map(lambda x: bounds[0] < x < bounds[1], inputs))
119+
return not any(
120+
map(
121+
lambda x: isinstance(x, type(bounds[0]))
122+
and bounds[0] < x < bounds[1],
123+
inputs,
124+
)
125+
)
106126
return False
107127

108128
@staticmethod

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def unittest_test_suite():
1313

1414
setuptools.setup(
1515
name="jqqb",
16-
version="1.4.2",
16+
version="1.5.0",
1717
author="Connecting Food",
1818
author_email="developers@connecting-food.com",
1919
description="Python parsing, evaluation and inspection tools "

0 commit comments

Comments
 (0)