nebius/SWE-bench-extra huggingface dataset:
Repository: osantana/dicteval

Issue:
Implement and document builtin function: =all
Equivalent to the Python's builtin.

Comments:

Patch:
diff --git a/README.rst b/README.rst
index 2b11f85..a815a98 100644
--- a/README.rst
+++ b/README.rst
@@ -48,6 +48,17 @@ Functions
 You can use the following builtin functions in your expressions:
 
 
+Function ``=any``
+'''''''''''''''''
+
+Returns ``True`` if any element of sequence is true.
+
+    >>> dicteval({"=any", [1, 2, 3]})
+    True
+    >>> dicteval({"=any", [0, 0]})
+    False
+
+
 Function ``=eq``
 ''''''''''''''''
 
@@ -109,6 +120,16 @@ Returns a number with the product of arguments:
    >>> dicteval({"=mul": [3, 5]})
    15
 
+Function ``=all``
+'''''''''''''''''
+
+Return True if all elements of the iterable are true (or if the iterable is empty)
+
+   >>> dicteval({"=mul": (True, False)})
+   False
+   >>> dicteval({"=mul": (True, True)})
+   True
+
 To Do
 -----
 
diff --git a/dicteval/__init__.py b/dicteval/__init__.py
index 5978b4e..57602cc 100644
--- a/dicteval/__init__.py
+++ b/dicteval/__init__.py
@@ -16,6 +16,9 @@ class LanguageSpecification:
 
 
 class BuiltinLanguage(LanguageSpecification):
+    def function_any(self, value, evaluator, context):
+        return any([evaluator(v, context) for v in value])
+
     def function_eq(self, value, evaluator, context):
         value = [evaluator(v, context) for v in value]
         return not value or value.count(value[0]) == len(value)
@@ -35,6 +38,9 @@ class BuiltinLanguage(LanguageSpecification):
     def function_mul(self, value, evaluator, context):
         return functools.reduce(operator.mul, (evaluator(v, context) for v in value))
 
+    def function_all(self, value, evaluator, context):
+        return all(evaluator(v, context) for v in value)
+
 
 class Evaluator:
     def __init__(self, language_spec):


Test patch:
diff --git a/tests/test_eval.py b/tests/test_eval.py
index 98ca542..b1bdadd 100644
--- a/tests/test_eval.py
+++ b/tests/test_eval.py
@@ -17,6 +17,9 @@ from dicteval.exceptions import FunctionNotFound
     ({"=sum": (3, 5)}, 8),
     ({"=sum": {"=": [3, 5]}}, 8),
     ({"=mul": (5, 3, 2, -1)}, -30),
+    ({"=all": (True, True, True)}, True),
+    ({"=all": (True, False, True)}, False),
+    ({"=all": (False, False, False)}, False),
 ])
 def test_basic_eval(expression, result):
     assert dicteval(expression) == result
@@ -36,6 +39,8 @@ def test_json_loads():
 
 
 @pytest.mark.parametrize("fn,args,result", [
+    ("any", (1, 2, 3), True),
+    ("any", (0, 0), False),
     ("eq", (1, 1, 1, 1, 1), True),
     ("eq", (1, 1, 5, 1, 1), False),
     ("neq", (1, 1, 1, 1, 1), False),
@@ -45,6 +50,9 @@ def test_json_loads():
     ("not", False, True),
     ("sum", (1, 2), 3),
     ("mul", (2, 4), 8),
+    ("all", tuple(), True),
+    ("all", (True, True), True),
+    ("all", (True, False), False),
 ])
 def test_buitin_language(fn, args, result, context):
     language = BuiltinLanguage()
Repository: ownaginatious/mixpanel-jql

Issue:
mixpanel_jql.exceptions.InvalidJavaScriptText
Hi, first of all thanks for this project!

I'm trying to run the first example and I'm getting:
`mixpanel_jql.exceptions.InvalidJavaScriptText: Must be a text type (str, unicode) or wrapped as raw(str||unicode)`

I'm runnning Python 3.6.5 on Ubuntu 18.04

Comments:

Patch:
diff --git a/mixpanel_jql/query.py b/mixpanel_jql/query.py
index 919894f..768da83 100644
--- a/mixpanel_jql/query.py
+++ b/mixpanel_jql/query.py
@@ -394,19 +394,19 @@ class JQL(object):
         return jql
 
     def group_by(self, keys, accumulator):
-        if not isinstance(keys, (tuple, set, list)):
-            keys = [keys]
-        jql = self._clone()
-        jql.operations += ("groupBy([%s], %s)"
-                           % (", ".join(_f(k) for k in keys), _f(accumulator)),)
-        return jql
+        return self._group_by(False, keys, accumulator)
 
     def group_by_user(self, keys, accumulator):
+        return self._group_by(True, keys, accumulator)
+
+    def _group_by(self, user, keys, accumulator):
         if not isinstance(keys, (tuple, set, list)):
             keys = [keys]
+        if not isinstance(accumulator, Reducer):
+            accumulator = _f(accumulator)
         jql = self._clone()
-        jql.operations += ("groupByUser([%s], %s)"
-                           % (", ".join(_f(k) for k in keys), _f(accumulator)),)
+        op = "groupByUser" if user else "groupBy"
+        jql.operations += ("%s([%s], %s)" % (op, ", ".join(_f(k) for k in keys), accumulator),)
         return jql
 
     def query_plan(self):


Test patch:
diff --git a/tests/test_transformations.py b/tests/test_transformations.py
index f66c218..e7f3dfc 100644
--- a/tests/test_transformations.py
+++ b/tests/test_transformations.py
@@ -63,6 +63,12 @@ class TestGroupTransformations(unittest.TestCase):
             'function main() { return Events({}).'
             '%s([e.a, e.b, e.c], e.properties.some_accessor); }' % expected_function)
 
+        self.assertEqual(
+            str(grouper([
+                raw('e.a'), raw('e.b'), raw('e.c')], Reducer.count())),
+            'function main() { return Events({}).'
+            '%s([e.a, e.b, e.c], mixpanel.reducer.count()); }' % expected_function)
+
         # Non iterable key.
         self.assertEqual(
             str(grouper(raw('e.a'), raw('e.properties.some_accessor'))),