commitarena 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commitarena/__init__.py +40 -0
- commitarena/__main__.py +3 -0
- commitarena/agent.py +205 -0
- commitarena/cli.py +313 -0
- commitarena/demo/LICENSE-sqlparse +25 -0
- commitarena/demo/results.jsonl +33 -0
- commitarena/demo/run.json +36 -0
- commitarena/demo/tasks.json +5603 -0
- commitarena/errors.py +40 -0
- commitarena/llm.py +206 -0
- commitarena/mine.py +248 -0
- commitarena/report.py +132 -0
- commitarena/report_template.html +394 -0
- commitarena/runner.py +298 -0
- commitarena/sandbox.py +180 -0
- commitarena/tasks.py +229 -0
- commitarena/testrun.py +77 -0
- commitarena-0.1.1.dist-info/METADATA +242 -0
- commitarena-0.1.1.dist-info/RECORD +22 -0
- commitarena-0.1.1.dist-info/WHEEL +4 -0
- commitarena-0.1.1.dist-info/entry_points.txt +2 -0
- commitarena-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{"task_id": "andialbrecht-sqlparse-f66d12c2", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 490, "cost_usd": 0.076109, "tokens_in": 80725, "tokens_out": 9334, "steps": 14, "tool_calls": 16, "wall_time_s": 154.7, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -18,8 +18,15 @@\n \n def get_real_name(self):\n \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n- # a.b\n+ # a.b.c.d -> the real name is the part after the *last* dot,\n+ # i.e. \"d\" (see issue 332).\n dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n+ while dot_idx is not None:\n+ next_idx, _ = self.token_next_by(m=(T.Punctuation, '.'),\n+ idx=dot_idx)\n+ if next_idx is None:\n+ break\n+ dot_idx = next_idx\n return self._get_first_name(dot_idx, real_name=True)\n \n def get_alias(self):\n", "ignored_test_edits": [], "task_date": "2026-07-25T11:44:58+02:00", "context_file": null, "started_at": "2026-11-03T18:00:12+00:00"}
|
|
2
|
+
{"task_id": "andialbrecht-sqlparse-ac3b9e0b", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 488, "cost_usd": 0.028891, "tokens_in": 34625, "tokens_out": 2216, "steps": 11, "tool_calls": 12, "wall_time_s": 59.1, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py\n--- a/sqlparse/keywords.py\n+++ b/sqlparse/keywords.py\n@@ -77,6 +77,7 @@\n (r'NULLS\\s+(FIRST|LAST)\\b', tokens.Keyword.Order),\n (r'UNION\\s+ALL\\b', tokens.Keyword),\n (r'CREATE(\\s+OR\\s+REPLACE)?\\b', tokens.Keyword.DDL),\n+ (r'MATERIALIZED\\s+VIEW\\b', tokens.Keyword),\n (r'DOUBLE\\s+PRECISION\\b', tokens.Name.Builtin),\n (r'GROUP\\s+BY\\b', tokens.Keyword),\n (r'ORDER\\s+BY\\b', tokens.Keyword),\n", "ignored_test_edits": [], "task_date": "2026-07-25T11:27:52+02:00", "context_file": null, "started_at": "2026-11-03T18:02:47+00:00"}
|
|
3
|
+
{"task_id": "andialbrecht-sqlparse-111b35cf", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 488, "cost_usd": 0.02332, "tokens_in": 31022, "tokens_out": 764, "steps": 9, "tool_calls": 10, "wall_time_s": 41.7, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py\n--- a/sqlparse/engine/grouping.py\n+++ b/sqlparse/engine/grouping.py\n@@ -381,7 +381,7 @@\n has_create = True\n if tmp_token.value.upper() == 'TABLE':\n has_table = True\n- if tmp_token.value == 'AS':\n+ if tmp_token.value.upper() == 'AS':\n has_as = True\n if has_create and has_table and not has_as:\n return\n", "ignored_test_edits": [], "task_date": "2026-07-22T22:58:07+03:00", "context_file": null, "started_at": "2026-11-03T18:03:47+00:00"}
|
|
4
|
+
{"task_id": "andialbrecht-sqlparse-5ca50a2e", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 2, "fail_to_pass_total": 2, "pass_to_pass_failed": 0, "pass_to_pass_total": 478, "cost_usd": 0.102717, "tokens_in": 114222, "tokens_out": 10839, "steps": 17, "tool_calls": 25, "wall_time_s": 183.0, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/engine/statement_splitter.py b/sqlparse/engine/statement_splitter.py\n--- a/sqlparse/engine/statement_splitter.py\n+++ b/sqlparse/engine/statement_splitter.py\n@@ -21,6 +21,7 @@\n self._is_create = False\n self._begin_depth = 0\n self._seen_begin = False\n+ self._begin_pending = False\n \n self.consume_ws = False\n self.tokens = []\n@@ -56,6 +57,10 @@\n if unified == 'BEGIN':\n self._begin_depth += 1\n self._seen_begin = True\n+ # Remember that we've just seen a BEGIN so that we can check\n+ # whether it starts a transaction (BEGIN TRANSACTION/WORK)\n+ # instead of a BEGIN...END block.\n+ self._begin_pending = True\n if self._is_create:\n # FIXME(andi): This makes no sense. ## this comment neither\n return 1\n@@ -97,6 +102,18 @@\n # Reset filter and prepare to process next statement\n self._reset()\n \n+ # Check if the token after a BEGIN tells us that this BEGIN\n+ # starts a transaction (issue826) rather than a BEGIN...END\n+ # block. In that case the BEGIN must not increase the depth.\n+ if self._begin_pending and not (\n+ ttype in T.Whitespace\n+ or ttype in T.Comment):\n+ self._begin_pending = False\n+ if ttype is T.Keyword and value.upper() in ('TRANSACTION',\n+ 'WORK'):\n+ self._begin_depth = max(0, self._begin_depth - 1)\n+ self._seen_begin = False\n+\n # Change current split level (increase, decrease or remain equal)\n self.level += self._change_splitlevel(ttype, value)\n \n", "ignored_test_edits": [], "task_date": "2025-11-29T08:26:28+01:00", "context_file": null, "started_at": "2026-11-03T18:04:30+00:00"}
|
|
5
|
+
{"task_id": "andialbrecht-sqlparse-b126ba5b", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 6, "fail_to_pass_total": 6, "pass_to_pass_failed": 0, "pass_to_pass_total": 455, "cost_usd": 0.036884, "tokens_in": 42156, "tokens_out": 3512, "steps": 10, "tool_calls": 10, "wall_time_s": 72.9, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py\n--- a/sqlparse/keywords.py\n+++ b/sqlparse/keywords.py\n@@ -71,7 +71,8 @@\n r'|(CROSS\\s+|NATURAL\\s+)?)?JOIN\\b', tokens.Keyword),\n (r'END(\\s+IF|\\s+LOOP|\\s+WHILE)?\\b', tokens.Keyword),\n (r'NOT\\s+NULL\\b', tokens.Keyword),\n- (r'NULLS\\s+(FIRST|LAST)\\b', tokens.Keyword),\n+ (r'(ASC|DESC)\\s+NULLS\\s+(FIRST|LAST)\\b', tokens.Keyword.Order),\n+ (r'NULLS\\s+(FIRST|LAST)\\b', tokens.Keyword.Order),\n (r'UNION\\s+ALL\\b', tokens.Keyword),\n (r'CREATE(\\s+OR\\s+REPLACE)?\\b', tokens.Keyword.DDL),\n (r'DOUBLE\\s+PRECISION\\b', tokens.Name.Builtin),\n", "ignored_test_edits": [], "task_date": "2024-07-15T11:54:34+02:00", "context_file": null, "started_at": "2026-11-03T18:07:34+00:00"}
|
|
6
|
+
{"task_id": "andialbrecht-sqlparse-0c4902f3", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 454, "cost_usd": 0.043961, "tokens_in": 44466, "tokens_out": 6112, "steps": 11, "tool_calls": 11, "wall_time_s": 80.2, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py\n--- a/sqlparse/filters/others.py\n+++ b/sqlparse/filters/others.py\n@@ -91,7 +91,30 @@\n tlist.tokens.pop(1)\n while tlist.tokens[-2].is_whitespace:\n tlist.tokens.pop(-2)\n+ # Remove trailing whitespace of a group right before the closing\n+ # parenthesis, e.g. \"( where foo = bar )\" (see issue782).\n+ if len(tlist.tokens) > 2 and tlist.tokens[-2].is_group:\n+ self._strip_trailing_ws(tlist.tokens[-2])\n self._stripws_default(tlist)\n+\n+ @classmethod\n+ def _strip_trailing_ws(cls, tlist):\n+ \"\"\"Remove trailing whitespace tokens, recursing into subgroups.\"\"\"\n+ while tlist.tokens and tlist.tokens[-1].is_whitespace:\n+ tlist.tokens.pop()\n+ if not tlist.tokens:\n+ return\n+ last = tlist.tokens[-1]\n+ if isinstance(last, sql.Parenthesis):\n+ # whitespace right before the closing parenthesis\n+ idx = len(last.tokens) - 2\n+ while idx >= 0 and last.tokens[idx].is_whitespace:\n+ last.tokens.pop(idx)\n+ idx -= 1\n+ if idx >= 0 and last.tokens[idx].is_group:\n+ cls._strip_trailing_ws(last.tokens[idx])\n+ elif last.is_group:\n+ cls._strip_trailing_ws(last)\n \n def process(self, stmt, depth=0):\n [self.process(sgroup, depth + 1) for sgroup in stmt.get_sublists()]\n", "ignored_test_edits": [], "task_date": "2024-07-15T11:32:49+02:00", "context_file": null, "started_at": "2026-11-03T18:08:47+00:00"}
|
|
7
|
+
{"task_id": "andialbrecht-sqlparse-e03b74e6", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 449, "cost_usd": 0.030257, "tokens_in": 34548, "tokens_out": 2892, "steps": 10, "tool_calls": 13, "wall_time_s": 66.3, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -623,7 +623,9 @@\n \n def get_parameters(self):\n \"\"\"Return a list of parameters.\"\"\"\n- parenthesis = self.tokens[-1]\n+ parenthesis = self.get_parenthesis()\n+ if parenthesis is None:\n+ return []\n result = []\n for token in parenthesis.tokens:\n if isinstance(token, IdentifierList):\n@@ -633,6 +635,29 @@\n result.append(token)\n return result\n \n+ def get_parenthesis(self):\n+ \"\"\"Return the parenthesis of this function, None if there is none.\"\"\"\n+ for token in reversed(self.tokens):\n+ if isinstance(token, Parenthesis):\n+ return token\n+ return None\n+\n+ def get_window(self):\n+ \"\"\"Return the window of a window function, None if there is none.\n+\n+ The window is either an identifier (a named window) or a\n+ parenthesis containing the window specification, e.g.\n+ ``foo(5) OVER (PARTITION BY c1)``.\n+ \"\"\"\n+ _, over = self.token_next_by(i=Over)\n+ if over is None:\n+ return None\n+ idx, token = over.token_next_by(m=Over.M_OPEN)\n+ if token is None:\n+ return None\n+ _, window = over.token_next(idx)\n+ return window\n+\n \n class Begin(TokenList):\n \"\"\"A BEGIN/END block.\"\"\"\n", "ignored_test_edits": [], "task_date": "2024-04-13T13:41:02+02:00", "context_file": null, "started_at": "2026-11-03T18:10:08+00:00"}
|
|
8
|
+
{"task_id": "andialbrecht-sqlparse-46971e5a", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 1, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 449, "cost_usd": 0.015515, "tokens_in": 20016, "tokens_out": 716, "steps": 8, "tool_calls": 9, "wall_time_s": 18.5, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py\n--- a/sqlparse/keywords.py\n+++ b/sqlparse/keywords.py\n@@ -75,6 +75,7 @@\n (r'UNION\\s+ALL\\b', tokens.Keyword),\n (r'CREATE(\\s+OR\\s+REPLACE)?\\b', tokens.Keyword.DDL),\n (r'DOUBLE\\s+PRECISION\\b', tokens.Name.Builtin),\n+ (r'PRIMARY\\s+KEY\\b', tokens.Keyword),\n (r'GROUP\\s+BY\\b', tokens.Keyword),\n (r'ORDER\\s+BY\\b', tokens.Keyword),\n (r'HANDLER\\s+FOR\\b', tokens.Keyword),\n", "ignored_test_edits": [], "task_date": "2024-03-16T17:03:23+01:00", "context_file": null, "started_at": "2026-11-03T18:11:15+00:00"}
|
|
9
|
+
{"task_id": "andialbrecht-sqlparse-20caed83", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 2, "fail_to_pass_total": 2, "pass_to_pass_failed": 0, "pass_to_pass_total": 512, "cost_usd": 0.008567, "tokens_in": 10286, "tokens_out": 651, "steps": 4, "tool_calls": 3, "wall_time_s": 28.3, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/cli.py b/sqlparse/cli.py\n--- a/sqlparse/cli.py\n+++ b/sqlparse/cli.py\n@@ -192,6 +192,19 @@\n except OSError as e:\n return _error(f'Failed to read {filename}: {e}')\n \n+ # Format the SQL first, so a formatting error doesn't clobber the\n+ # output file (or the input file when using --in-place).\n+ formatter_opts = vars(args)\n+ try:\n+ formatter_opts = sqlparse.formatter.validate_options(formatter_opts)\n+ except SQLParseError as e:\n+ return _error(f'Invalid options: {e}')\n+\n+ try:\n+ s = sqlparse.format(data, **formatter_opts)\n+ except SQLParseError as e:\n+ return _error(f'Failed to format {filename}: {e}')\n+\n # Determine output destination\n close_stream = False\n if args.inplace:\n@@ -209,14 +222,6 @@\n else:\n stream = sys.stdout\n \n- # Format the SQL\n- formatter_opts = vars(args)\n- try:\n- formatter_opts = sqlparse.formatter.validate_options(formatter_opts)\n- except SQLParseError as e:\n- return _error(f'Invalid options: {e}')\n-\n- s = sqlparse.format(data, **formatter_opts)\n stream.write(s)\n stream.flush()\n if close_stream:\n", "ignored_test_edits": [], "task_date": "2026-11-01T13:23:08+01:00", "context_file": null, "started_at": "2026-11-03T18:11:34+00:00"}
|
|
10
|
+
{"task_id": "andialbrecht-sqlparse-3512a9d8", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 5, "fail_to_pass_total": 5, "pass_to_pass_failed": 0, "pass_to_pass_total": 507, "cost_usd": 0.149407, "tokens_in": 178900, "tokens_out": 11513, "steps": 19, "tool_calls": 27, "wall_time_s": 568.4, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/filters/aligned_indent.py b/sqlparse/filters/aligned_indent.py\n--- a/sqlparse/filters/aligned_indent.py\n+++ b/sqlparse/filters/aligned_indent.py\n@@ -74,13 +74,13 @@\n \n condition_width = [len(' '.join(map(str, cond))) if cond else 0\n for cond, _ in cases]\n- max_cond_width = max(condition_width)\n+ max_cond_width = max(condition_width) if condition_width else 0\n \n for i, (cond, value) in enumerate(cases):\n # cond is None when 'else or end'\n stmt = cond[0] if cond else value[0]\n \n- if i > 0:\n+ if i > 0 and stmt is not None:\n tlist.insert_before(stmt, self.nl(offset_ - len(str(stmt))))\n if cond:\n ws = sql.Token(T.Whitespace, self.char * (\ndiff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py\n--- a/sqlparse/filters/others.py\n+++ b/sqlparse/filters/others.py\n@@ -112,13 +112,16 @@\n return self._stripws_default(tlist)\n \n def _stripws_parenthesis(self, tlist):\n- while tlist.tokens[1].is_whitespace:\n+ # Malformed input may leave the parenthesis with fewer than two\n+ # tokens (e.g. a single group), so guard every index access.\n+ while len(tlist.tokens) > 1 and tlist.tokens[1].is_whitespace:\n tlist.tokens.pop(1)\n- while tlist.tokens[-2].is_whitespace:\n+ while len(tlist.tokens) > 1 and tlist.tokens[-2].is_whitespace:\n tlist.tokens.pop(-2)\n- if tlist.tokens[-2].is_group:\n+ if len(tlist.tokens) > 1 and tlist.tokens[-2].is_group:\n # save to remove the last whitespace\n- while tlist.tokens[-2].tokens[-1].is_whitespace:\n+ while (tlist.tokens[-2].tokens\n+ and tlist.tokens[-2].tokens[-1].is_whitespace):\n tlist.tokens[-2].tokens.pop(-1)\n self._stripws_default(tlist)\n \n", "ignored_test_edits": [], "task_date": "2026-11-01T12:54:06+01:00", "context_file": null, "started_at": "2026-11-03T18:12:02+00:00"}
|
|
11
|
+
{"task_id": "andialbrecht-sqlparse-bb3c50a5", "model": "mistral/mistral-large-4", "passed": true, "fail_to_pass_passed": 9, "fail_to_pass_total": 9, "pass_to_pass_failed": 0, "pass_to_pass_total": 509, "cost_usd": 0.024427, "tokens_in": 32552, "tokens_out": 781, "steps": 9, "tool_calls": 9, "wall_time_s": 19.9, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/filters/output.py b/sqlparse/filters/output.py\n--- a/sqlparse/filters/output.py\n+++ b/sqlparse/filters/output.py\n@@ -118,6 +118,10 @@\n # (GHSA-3496-9g83-7v6x).\n else:\n token.value = token.value.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"')\n+ # Escape \"$\" as well: it starts variable or expression\n+ # interpolation inside PHP double-quoted strings\n+ # (CVE-2026-112307).\n+ token.value = token.value.replace('$', '\\\\$')\n \n # Put the token\n yield sql.Token(T.Text, token.value)\n", "ignored_test_edits": [], "task_date": "2026-10-20T10:56:23-03:00", "context_file": null, "started_at": "2026-11-03T18:21:31+00:00"}
|
|
12
|
+
{"task_id": "andialbrecht-sqlparse-f66d12c2", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 490, "cost_usd": 0.023179, "tokens_in": 148678, "tokens_out": 5850, "steps": 30, "tool_calls": 30, "wall_time_s": 85.6, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/fix_get_real_name.py b/fix_get_real_name.py\n--- /dev/null\n+++ b/fix_get_real_name.py\n@@ -0,0 +1,37 @@\n+import re\n+\n+with open('/work/sqlparse/sql.py', 'r') as file:\n+ content = file.read()\n+\n+# Define the pattern to match the get_real_name method\n+pattern = r'def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # a.b\n+ dot_idx, _ = self.token_next_by\\(m=\\(T.Punctuation, \\\"\\.\"\\\"\\)\\)\n+ return self\\._get_first_name\\(dot_idx, real_name=True\\)'\n+\n+# Define the replacement\n+replacement = '''def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # For real_name, return the last component after the last dot\n+ tokens = self.tokens\n+ last_dot_idx = -1\n+ for i, token in enumerate(tokens):\n+ if token.ttype == T.Punctuation and token.value == \".\":\n+ last_dot_idx = i\n+ if last_dot_idx != -1:\n+ for token in tokens[last_dot_idx + 1:]:\n+ if token.ttype in [T.Name, T.Wildcard, T.String.Symbol]:\n+ return remove_quotes(token.value)\n+ # Fallback to original logic for non-dotted names\n+ dot_idx, _ = self.token_next_by(m=(T.Punctuation, \".\"))\n+ return self._get_first_name(dot_idx, real_name=True)\n+'''\n+\n+# Use regex to replace the method\n+content = re.sub(pattern, replacement, content, flags=re.DOTALL)\n+\n+with open('/work/sqlparse/sql.py', 'w') as file:\n+ file.write(content)\n+\n+print('File updated successfully.')\ndiff --git a/fix_get_real_name_method.py b/fix_get_real_name_method.py\n--- /dev/null\n+++ b/fix_get_real_name_method.py\n@@ -0,0 +1,36 @@\n+import re\n+\n+with open('/work/sqlparse/sql.py', 'r') as file:\n+ content = file.read()\n+\n+# Define the pattern to match the get_real_name method in NameAliasMixin\n+pattern = r'def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # a.b\n+ dot_idx, _ = self.token_next_by\\(m=\\(T.Punctuation, \\\"\\.\"\\\"\\)\\)\n+ return self\\._get_first_name\\(dot_idx, real_name=True\\)'\n+\n+replacement = '''def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # For real_name, return the last component after the last dot\n+ tokens = self.tokens\n+ last_dot_idx = -1\n+ for i, token in enumerate(tokens):\n+ if token.tt::type == T.Punctuation and token.value == \".\":\n+ last_dot_idx = i\n+ if last_dot_idx != -1:\n+ for token in tokens[last_dot_idx + 1:]:\n+ if token.ttype in [T.Name, T.Wildcard, T.String.Symbol]:\n+ return remove_quotes(token.value)\n+ # a.b\n+ dot_idx, _ = self.token_next_by(m=(T.Punctuation, \".\"))\n+ return self._get_first_name(dot_idx, real_name=True)\n+'''\n+\n+# Use regex to replace the method\n+content = re.sub(pattern, replacement, content, flags=re.DOTALL)\n+\n+with open('/work/sqlparse/sql.py', 'w') as file:\n+ file.write(content)\n+\n+print(\"File updated successfully.\")\ndiff --git a/fix_real_name.py b/fix_real_name.py\n--- /dev/null\n+++ b/fix_real_name.py\n@@ -0,0 +1,37 @@\n+import re\n+\n+with open('/work/sqlparse/sql.py', 'r') as file:\n+ content = file.read()\n+\n+# Define the pattern to match the get_real_name method in NameAliasMixin\n+pattern = r'def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # a.b\n+ dot_idx, _ = self.token_next_by\\(m=\\(T.Punctuation, \\\"\\.\"\\\"\\)\\)\n+ return self\\._get_first_name\\(dot_idx, real_name=True\\)' \n+\n+# Define the replacement\n+replacement = '''def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # For real_name, return the last component after the last dot\n+ tokens = self.tokens\n+ last_dot_idx = -1\n+ for i, token in enumerate(tokens):\n+ if token.ttype == T.Punctuation and token.value == \".\":\n+ last_dot_idx = i\n+ if last_dot_idx != -1:\n+ for token in tokens[last_dot_idx + 1:]:\n+ if token.ttype in [T.Name, T.Wildcard, T.String.Symbol]:\n+ return remove_quotes(token.value)\n+ # Fallback to original logic for non-dotted names\n+ dot_idx, _ = self.token_next_by(m=(T.Punctuation, \".\"))\n+ return self._get_first_name(dot_idx, real_name=True)\n+'''\n+\n+# Use regex to replace the method\n+content = re.sub(pattern, replacement, content, flags=re.DOTALL)\n+\n+with open('/work/sqlparse/sql.py', 'w') as file:\n+ file.write(content)\n+\n+print('File updated successfully.')\n", "ignored_test_edits": [], "task_date": "2026-07-25T11:44:58+02:00", "context_file": null, "started_at": "2026-11-03T18:00:12+00:00"}
|
|
13
|
+
{"task_id": "andialbrecht-sqlparse-ac3b9e0b", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 488, "pass_to_pass_total": 488, "cost_usd": 0.026777, "tokens_in": 176578, "tokens_out": 1936, "steps": 30, "tool_calls": 30, "wall_time_s": 49.9, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py\n--- a/sqlparse/keywords.py\n+++ b/sqlparse/keywords.py\n@@ -881,7 +881,8 @@\n 'FOR': tokens.Keyword,\n 'IN': tokens.Keyword,\n 'LOOP': tokens.Keyword,\n-}\n+,\n+ \"MATERIALIZED\": tokens.Keyword\n \n # Hive Syntax\n KEYWORDS_HQL = {\n", "ignored_test_edits": [], "task_date": "2026-07-25T11:27:52+02:00", "context_file": null, "started_at": "2026-11-03T18:01:39+00:00"}
|
|
14
|
+
{"task_id": "andialbrecht-sqlparse-111b35cf", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 488, "cost_usd": 0.017068, "tokens_in": 112423, "tokens_out": 1366, "steps": 30, "tool_calls": 32, "wall_time_s": 44.9, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2026-07-22T22:58:07+03:00", "context_file": null, "started_at": "2026-11-03T18:02:29+00:00"}
|
|
15
|
+
{"task_id": "andialbrecht-sqlparse-5ca50a2e", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 2, "pass_to_pass_failed": 12, "pass_to_pass_total": 478, "cost_usd": 0.042115, "tokens_in": 266457, "tokens_out": 14307, "steps": 30, "tool_calls": 31, "wall_time_s": 237.9, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/engine/statement_splitter.py b/sqlparse/engine/statement_splitter.py\n--- a/sqlparse/engine/statement_splitter.py\n+++ b/sqlparse/engine/statement_splitter.py\n@@ -1,12 +1,10 @@\n-#\n # Copyright (C) 2009-2020 the sqlparse authors and contributors\n # <see AUTHORS file>\n-#\n+\n # This module is part of python-sqlparse and is released under\n # the BSD License: https://opensource.org/licenses/BSD-3-Clause\n \n from sqlparse import sql, tokens as T\n-\n \n class StatementSplitter:\n \"\"\"Filter that split stream at individual statements\"\"\"\n@@ -38,12 +36,9 @@\n return 0\n \n # Everything after here is ttype = T.Keyword\n- # Also to note, once entered an If statement you are done and basically\n- # returning\n unified = value.upper()\n \n # three keywords begin with CREATE, but only one of them is DDL\n- # DDL Create though can contain more words such as \"or replace\"\n if ttype is T.Keyword.DDL and unified.startswith('CREATE'):\n self._is_create = True\n return 0\n@@ -57,7 +52,6 @@\n self._begin_depth += 1\n self._seen_begin = True\n if self._is_create:\n- # FIXME(andi): This makes no sense. ## this comment neither\n return 1\n return 0\n \n@@ -84,50 +78,53 @@\n def process(self, stream):\n \"\"\"Process the stream\"\"\"\n EOS_TTYPE = T.Whitespace, T.Comment.Single\n-\n- # Run over all stream tokens\n+ \n+ # Track tokens\n+ tokens = []\n+ \n for ttype, value in stream:\n- # Yield token if we finished a statement and there's no whitespaces\n- # It will count newline token as a non whitespace. In this context\n- # whitespace ignores newlines.\n- # why don't multi line comments also count?\n- if self.consume_ws and ttype not in EOS_TTYPE:\n- yield sql.Statement(self.tokens)\n-\n- # Reset filter and prepare to process next statement\n- self._reset()\n-\n- # Change current split level (increase, decrease or remain equal)\n- self.level += self._change_splitlevel(ttype, value)\n-\n- # Append the token to the current statement\n- self.tokens.append(sql.Token(ttype, value))\n-\n+ # Append token to current statement\n+ tokens.append(sql.Token(ttype, value))\n+ \n+ # Check if we have a BEGIN TRANSACTION statement\n+ if (len(tokens) >= 2 and \n+ tokens[-2].ttype is T.Keyword and tokens[-2].value.upper() == 'BEGIN' and \n+ tokens[-1].ttype is T.Punctuation and tokens[-1].value == ';'):\n+ \n+ # Check if the next token is TRANSACTION\n+ # Use a list to simulate lookahead\n+ lookahead = []\n+ for next_ttype, next_value in stream:\n+ lookahead.append((next_ttype, next_value))\n+ if next_ttype is T.Keyword and next_value.upper() == 'TRANSACTION':\n+ # Split here\n+ yield sql.Statement(tokens)\n+ self._reset()\n+ # Skip the TRANSACTION token\n+ next(stream)\n+ continue\n+ break\n+ \n # Check if we get the end of a statement\n- # Issue762: Allow GO (or \"GO 2\") as statement splitter.\n- # When implementing a language toggle, it's not only to add\n- # keywords it's also to change some rules, like this splitting\n- # rule.\n- # Issue809: Ignore semicolons inside BEGIN...END blocks, but handle\n- # standalone BEGIN; as a transaction statement\n if ttype is T.Punctuation and value == ';':\n- # If we just saw BEGIN; then this is a transaction BEGIN,\n- # not a BEGIN...END block, so decrement depth\n- if self._seen_begin:\n- self._begin_depth = max(0, self._begin_depth - 1)\n- self._seen_begin = False\n # Split on semicolon if not inside a BEGIN...END block\n if self.level <= 0 and self._begin_depth == 0:\n self.consume_ws = True\n- elif ttype is T.Keyword and value.split()[0] == 'GO':\n- self.consume_ws = True\n- elif (ttype not in (T.Whitespace, T.Comment.Single,\n- T.Comment.Multiline)\n- and not (ttype is T.Keyword and value.upper() == 'BEGIN')):\n- # Reset _seen_begin if we see a non-whitespace, non-comment\n- # token but not for BEGIN itself (which just set the flag)\n+ \n+ # Yield token if we finished a statement and there's no whitespaces\n+ if self.consume_ws and ttype not in EOS_TTYPE:\n+ yield sql.Statement(tokens)\n+ self._reset()\n+ tokens = []\n+\n+ # Change current split level\n+ self.level += self._change_splitlevel(ttype, value)\n+\n+ # Reset _seen_begin if we see a non-whitespace, non-comment token\n+ if (ttype not in (T.Whitespace, T.Comment.Single, T.Comment.Multiline) and \n+ not (ttype is T.Keyword and value.upper() == 'BEGIN')):\n self._seen_begin = False\n \n # Yield pending statement (if any)\n- if self.tokens and not all(t.is_whitespace for t in self.tokens):\n- yield sql.Statement(self.tokens)\n+ if tokens and not all(t.is_whitespace for t in tokens):\n+ yield sql.Statement(tokens)\n", "ignored_test_edits": [], "task_date": "2025-11-29T08:26:28+01:00", "context_file": null, "started_at": "2026-11-03T18:03:16+00:00"}
|
|
16
|
+
{"task_id": "andialbrecht-sqlparse-b126ba5b", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 6, "pass_to_pass_failed": 0, "pass_to_pass_total": 455, "cost_usd": 0.019197, "tokens_in": 126620, "tokens_out": 1361, "steps": 30, "tool_calls": 30, "wall_time_s": 37.6, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py\n--- a/sqlparse/engine/grouping.py\n+++ b/sqlparse/engine/grouping.py\n@@ -383,7 +383,7 @@\n @recurse(sql.Identifier)\n def group_order(tlist):\n \"\"\"Group together Identifier and Asc/Desc token\"\"\"\n- tidx, token = tlist.token_next_by(t=T.Keyword.Order)\n+ tidx, token = tlist.token_next_by(t=T.Keyword.Order, m=(T.Keyword, r\"NULLSs+(FIRST|LAST)\"))\n while token:\n pidx, prev_ = tlist.token_prev(tidx)\n if imt(prev_, i=sql.Identifier, t=T.Number):\n", "ignored_test_edits": [], "task_date": "2024-07-15T11:54:34+02:00", "context_file": null, "started_at": "2026-11-03T18:07:15+00:00"}
|
|
17
|
+
{"task_id": "andialbrecht-sqlparse-0c4902f3", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 454, "pass_to_pass_total": 454, "cost_usd": 0.015785, "tokens_in": 102546, "tokens_out": 2687, "steps": 30, "tool_calls": 30, "wall_time_s": 80.6, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py\n--- a/sqlparse/filters/others.py\n+++ b/sqlparse/filters/others.py\n@@ -82,27 +82,16 @@\n \n # next_ = tlist.token_next(token, skip_ws=False)\n # if (next_ and not next_.is_whitespace and\n- # token.ttype is T.Punctuation and token.value == ','):\n- # tlist.insert_after(token, sql.Token(T.Whitespace, ' '))\n- return self._stripws_default(tlist)\n-\n def _stripws_parenthesis(self, tlist):\n- while tlist.tokens[1].is_whitespace:\n+ # Remove leading and trailing whitespace around the group\n+ while len(tlist.tokens) > 1 and tlist.tokens[1].is_whitespace:\n tlist.tokens.pop(1)\n- while tlist.tokens[-2].is_whitespace:\n+ while len(tlist.tokens) > 1 and tlist.tokens[-2].is_whitespace:\n tlist.tokens.pop(-2)\n- self._stripws_default(tlist)\n-\n- def process(self, stmt, depth=0):\n- [self.process(sgroup, depth + 1) for sgroup in stmt.get_sublists()]\n- self._stripws(stmt)\n- if depth == 0 and stmt.tokens and stmt.tokens[-1].is_whitespace:\n- stmt.tokens.pop(-1)\n- return stmt\n-\n-\n-class SpacesAroundOperatorsFilter:\n- @staticmethod\n+ # Strip all whitespace inside the group\n+ for token in tlist.tokens:\n+ if token.is_whitespace:\n+ token.value = \n def _process(tlist):\n \n ttypes = (T.Operator, T.Comparison)\n", "ignored_test_edits": [], "task_date": "2024-07-15T11:32:49+02:00", "context_file": null, "started_at": "2026-11-03T18:07:53+00:00"}
|
|
18
|
+
{"task_id": "andialbrecht-sqlparse-e03b74e6", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 449, "cost_usd": 0.011834, "tokens_in": 77993, "tokens_out": 902, "steps": 30, "tool_calls": 30, "wall_time_s": 36.8, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2024-04-13T13:41:02+02:00", "context_file": null, "started_at": "2026-11-03T18:09:15+00:00"}
|
|
19
|
+
{"task_id": "andialbrecht-sqlparse-46971e5a", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 449, "cost_usd": 0.021437, "tokens_in": 141372, "tokens_out": 1544, "steps": 30, "tool_calls": 30, "wall_time_s": 38.0, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2024-03-16T17:03:23+01:00", "context_file": null, "started_at": "2026-11-03T18:09:52+00:00"}
|
|
20
|
+
{"task_id": "andialbrecht-sqlparse-20caed83", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 2, "pass_to_pass_failed": 21, "pass_to_pass_total": 512, "cost_usd": 0.026064, "tokens_in": 171011, "tokens_out": 2750, "steps": 30, "tool_calls": 30, "wall_time_s": 66.5, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/cli.py b/sqlparse/cli.py\n--- a/sqlparse/cli.py\n+++ b/sqlparse/cli.py\n@@ -169,78 +169,3 @@\n return 1\n \n \n-def _process_file(filename, args):\n- \"\"\"Process a single file with the given formatting options.\n-\n- Returns 0 on success, 1 on error.\n- \"\"\"\n- # Check for incompatible option combinations first\n- if filename == '-' and args.inplace:\n- return _error('Cannot use --in-place with stdin')\n-\n- # Read input\n- if filename == '-': # read from stdin\n- wrapper = TextIOWrapper(sys.stdin.buffer, encoding=args.encoding)\n- try:\n- data = wrapper.read()\n- finally:\n- wrapper.detach()\n- else:\n- try:\n- with open(filename, encoding=args.encoding) as f:\n- data = ''.join(f.readlines())\n- except OSError as e:\n- return _error(f'Failed to read {filename}: {e}')\n-\n- # Determine output destination\n- close_stream = False\n- if args.inplace:\n- try:\n- stream = open(filename, 'w', encoding=args.encoding)\n- close_stream = True\n- except OSError as e:\n- return _error(f'Failed to open {filename}: {e}')\n- elif args.outfile:\n- try:\n- stream = open(args.outfile, 'w', encoding=args.encoding)\n- close_stream = True\n- except OSError as e:\n- return _error(f'Failed to open {args.outfile}: {e}')\n- else:\n- stream = sys.stdout\n-\n- # Format the SQL\n- formatter_opts = vars(args)\n- try:\n- formatter_opts = sqlparse.formatter.validate_options(formatter_opts)\n- except SQLParseError as e:\n- return _error(f'Invalid options: {e}')\n-\n- s = sqlparse.format(data, **formatter_opts)\n- stream.write(s)\n- stream.flush()\n- if close_stream:\n- stream.close()\n- return 0\n-\n-\n-def main(args=None):\n- parser = create_parser()\n- args = parser.parse_args(args)\n-\n- # Validate argument combinations\n- if len(args.filename) > 1:\n- if args.outfile:\n- return _error('Cannot use -o/--outfile with multiple files')\n- if not args.inplace:\n- return _error('Multiple files require --in-place flag')\n-\n- # Process all files\n- exit_code = 0\n- for filename in args.filename:\n- result = _process_file(filename, args)\n- if result != 0:\n- exit_code = result\n- # Continue processing remaining files even if one fails\n-\n- return exit_code\n", "ignored_test_edits": [], "task_date": "2026-11-01T13:23:08+01:00", "context_file": null, "started_at": "2026-11-03T18:10:31+00:00"}
|
|
21
|
+
{"task_id": "andialbrecht-sqlparse-3512a9d8", "model": "mistral/ministral-8b-latest", "passed": true, "fail_to_pass_passed": 5, "fail_to_pass_total": 5, "pass_to_pass_failed": 0, "pass_to_pass_total": 507, "cost_usd": 0.007212, "tokens_in": 47018, "tokens_out": 1062, "steps": 11, "tool_calls": 10, "wall_time_s": 19.4, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py\n--- a/sqlparse/filters/others.py\n+++ b/sqlparse/filters/others.py\n@@ -112,12 +112,16 @@\n return self._stripws_default(tlist)\n \n def _stripws_parenthesis(self, tlist):\n- while tlist.tokens[1].is_whitespace:\n+ if len(tlist.tokens) < 2:\n+ return\n+ while len(tlist.tokens) > 1 and tlist.tokens[1].is_whitespace:\n tlist.tokens.pop(1)\n- while tlist.tokens[-2].is_whitespace:\n+ while len(tlist.tokens) > 1 and tlist.tokens[-2].is_whitespace:\n tlist.tokens.pop(-2)\n- if tlist.tokens[-2].is_group:\n- # save to remove the last whitespace\n+ self._stripws_default(tlist)\n+ if len(tlist.tokens) > 1 and tlist.tokens[-2].is_group:\n+ while len(tlist.tokens[-2].tokens) > 0 and tlist.tokens[-2].tokens[-1].is_whitespace:\n+ tlist.tokens[-2].tokens.pop(-1)\n while tlist.tokens[-2].tokens[-1].is_whitespace:\n tlist.tokens[-2].tokens.pop(-1)\n self._stripws_default(tlist)\ndiff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -309,9 +309,13 @@\n \n def token_index(self, token, start=0):\n \"\"\"Return list index of token.\"\"\"\n+ if token is None:\n+ return 0\n start = start if isinstance(start, int) else self.token_index(start)\n- return start + self.tokens[start:].index(token)\n-\n+ try:\n+ return start + self.tokens[start:].index(token)\n+ except ValueError:\n+ return 0\n def group_tokens(self, grp_cls, start, end, include_end=True,\n extend=False):\n \"\"\"Replace tokens by an instance of *grp_cls*.\"\"\"\n", "ignored_test_edits": [], "task_date": "2026-11-01T12:54:06+01:00", "context_file": null, "started_at": "2026-11-03T18:11:37+00:00"}
|
|
22
|
+
{"task_id": "andialbrecht-sqlparse-bb3c50a5", "model": "mistral/ministral-8b-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 9, "pass_to_pass_failed": 5, "pass_to_pass_total": 509, "cost_usd": 0.033833, "tokens_in": 222250, "tokens_out": 3306, "steps": 30, "tool_calls": 29, "wall_time_s": 51.5, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/filters/output.py b/sqlparse/filters/output.py\n--- a/sqlparse/filters/output.py\n+++ b/sqlparse/filters/output.py\n@@ -62,10 +62,7 @@\n yield sql.Token(T.Whitespace, after_lb)\n continue\n \n- # Escape backslashes before quotes so a backslash preceding a\n- # quote cannot break out of the generated string literal\n- # (GHSA-3496-9g83-7v6x).\n- else:\n+ # Escape backslashes, quotes, and dollar signs for PHP double-quoted strings.\n token.value = token.value.replace('\\\\', '\\\\\\\\').replace(\"'\", \"\\\\'\")\n \n # Put the token\n@@ -113,15 +110,11 @@\n yield sql.Token(T.Whitespace, after_lb)\n continue\n \n- # Escape backslashes before quotes so a backslash preceding a\n- # quote cannot break out of the generated string literal\n- # (GHSA-3496-9g83-7v6x).\n- else:\n- token.value = token.value.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"')\n \n- # Put the token\n- yield sql.Token(T.Text, token.value)\n \n+ # Escape backslashes, quotes, and dollar signs for PHP double-quoted strings.\\n token.value = token.value.replace(\"\\\", \"\\\\\\\").replace(\"\"\", \"\\\"\").replace(\"$\", \"\\$\")\n # Close quote\n+ # Escape backslashes, quotes, and dollar signs for PHP double-quoted strings.\n+ token.value = token.value.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"').replace('$', '\\\\$')\n yield sql.Token(T.Text, '\"')\n yield sql.Token(T.Punctuation, ';')\n", "ignored_test_edits": [], "task_date": "2026-10-20T10:56:23-03:00", "context_file": null, "started_at": "2026-11-03T18:11:57+00:00"}
|
|
23
|
+
{"task_id": "andialbrecht-sqlparse-f66d12c2", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 490, "cost_usd": 0.072435, "tokens_in": 234169, "tokens_out": 2427, "steps": 30, "tool_calls": 30, "wall_time_s": 66.0, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2026-07-25T11:44:58+02:00", "context_file": null, "started_at": "2026-11-03T18:00:12+00:00"}
|
|
24
|
+
{"task_id": "andialbrecht-sqlparse-ac3b9e0b", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 488, "cost_usd": 0.053739, "tokens_in": 172198, "tokens_out": 2311, "steps": 30, "tool_calls": 30, "wall_time_s": 44.1, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py\n--- a/sqlparse/keywords.py\n+++ b/sqlparse/keywords.py\n@@ -100,6 +100,7 @@\n ]\n \n KEYWORDS = {\n+ \"CREATE MATERIALIZED VIEW\": tokens.Keyword,\n 'ABORT': tokens.Keyword,\n 'ABS': tokens.Keyword,\n 'ABSOLUTE': tokens.Keyword,\ndiff --git a/sqlparse/lexer.py b/sqlparse/lexer.py\n--- a/sqlparse/lexer.py\n+++ b/sqlparse/lexer.py\n@@ -67,6 +67,7 @@\n self.add_keywords(keywords.KEYWORDS_MSACCESS)\n self.add_keywords(keywords.KEYWORDS_SNOWFLAKE)\n self.add_keywords(keywords.KEYWORDS_BIGQUERY)\n+ self.add_keywords({\"CREATE MATERIALIZED VIEW\": tokens.Keyword})\n self.add_keywords(keywords.KEYWORDS)\n \n def clear(self):\n", "ignored_test_edits": [], "task_date": "2026-07-25T11:27:52+02:00", "context_file": null, "started_at": "2026-11-03T18:01:19+00:00"}
|
|
25
|
+
{"task_id": "andialbrecht-sqlparse-111b35cf", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 488, "pass_to_pass_total": 488, "cost_usd": 0.133351, "tokens_in": 374545, "tokens_out": 23319, "steps": 30, "tool_calls": 30, "wall_time_s": 213.5, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -35,6 +35,14 @@\n if len(self.tokens) > 2 and ws is not None:\n return self._get_first_name(reverse=True)\n \n+ # Handle function alias\n+ if isinstance(self, Function):\n+ # Check for the last token which might be the alias\n+ last_token = self.tokens[-1]\n+ if not isinstance(last_token, (Parenthesis, IdentifierList)):\n+ return self._get_first_name(reverse=True)\n+\n+ return None\n \n class Token:\n \"\"\"Base class for all other classes in this module.\n@@ -99,453 +107,9 @@\n \n *ttype* is a token type as defined in `sqlparse.tokens`. If it does\n not match, ``False`` is returned.\n- *values* is a list of possible values for this token. For match to be\n- considered valid, the token value needs to be in this list. For tokens\n- of type ``Keyword`` the comparison is case-insensitive. For\n- convenience, a single value can be given passed as a string.\n- If *regex* is ``True``, the given values are treated as regular\n- expressions. Partial matches are allowed. Defaults to ``False``.\n- \"\"\"\n- type_matched = self.ttype is ttype\n- if not type_matched or values is None:\n- return type_matched\n-\n- if isinstance(values, str):\n- values = (values,)\n-\n- if regex:\n- # TODO: Add test for regex with is_keyword = false\n- flag = re.IGNORECASE if self.is_keyword else 0\n- values = (re.compile(v, flag) for v in values)\n-\n- return any(pattern.search(self.normalized) for pattern in values)\n-\n- if self.is_keyword:\n- values = (v.upper() for v in values)\n-\n- return self.normalized in values\n-\n- def within(self, group_cls):\n- \"\"\"Returns ``True`` if this token is within *group_cls*.\n-\n- Use this method for example to check if an identifier is within\n- a function: ``t.within(sql.Function)``.\n- \"\"\"\n- parent = self.parent\n- while parent:\n- if isinstance(parent, group_cls):\n- return True\n- parent = parent.parent\n- return False\n-\n- def is_child_of(self, other):\n- \"\"\"Returns ``True`` if this token is a direct child of *other*.\"\"\"\n- return self.parent == other\n-\n- def has_ancestor(self, other):\n- \"\"\"Returns ``True`` if *other* is in this tokens ancestry.\"\"\"\n- parent = self.parent\n- while parent:\n- if parent == other:\n- return True\n- parent = parent.parent\n- return False\n-\n-\n-class TokenList(Token):\n- \"\"\"A group of tokens.\n-\n- It has an additional instance attribute ``tokens`` which holds a\n- list of child-tokens.\n- \"\"\"\n-\n- __slots__ = 'tokens'\n-\n- def __init__(self, tokens=None):\n- self.tokens = tokens or []\n- [setattr(token, 'parent', self) for token in self.tokens]\n- super().__init__(None, ''.join(token.value for token in self.tokens))\n- self.is_group = True\n-\n- def __str__(self):\n- return ''.join(token.value for token in self.flatten())\n-\n- # weird bug\n- # def __len__(self):\n- # return len(self.tokens)\n-\n- def __iter__(self):\n- return iter(self.tokens)\n-\n- def __getitem__(self, item):\n- return self.tokens[item]\n-\n- def _get_repr_name(self):\n- return type(self).__name__\n-\n- def _pprint_tree(self, max_depth=None, depth=0, f=None, _pre=''):\n- \"\"\"Pretty-print the object tree.\"\"\"\n- token_count = len(self.tokens)\n- for idx, token in enumerate(self.tokens):\n- cls = token._get_repr_name()\n- value = token._get_repr_value()\n-\n- last = idx == (token_count - 1)\n- pre = '`- ' if last else '|- '\n-\n- q = '\"' if value.startswith(\"'\") and value.endswith(\"'\") else \"'\"\n- print(f\"{_pre}{pre}{idx} {cls} {q}{value}{q}\", file=f)\n-\n- if token.is_group and (max_depth is None or depth < max_depth):\n- parent_pre = ' ' if last else '| '\n- token._pprint_tree(max_depth, depth + 1, f, _pre + parent_pre)\n-\n- def get_token_at_offset(self, offset):\n- \"\"\"Returns the token that is on position offset.\"\"\"\n- idx = 0\n- for token in self.flatten():\n- end = idx + len(token.value)\n- if idx <= offset < end:\n- return token\n- idx = end\n-\n- def flatten(self):\n- \"\"\"Generator yielding ungrouped tokens.\n-\n- This method is recursively called for all child tokens.\n- \"\"\"\n- for token in self.tokens:\n- if token.is_group:\n- yield from token.flatten()\n- else:\n- yield token\n-\n- def get_sublists(self):\n- for token in self.tokens:\n- if token.is_group:\n- yield token\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens\n-\n- def _token_matching(self, funcs, start=0, end=None, reverse=False):\n- \"\"\"next token that match functions\"\"\"\n- if start is None:\n- return None\n-\n- if not isinstance(funcs, (list, tuple)):\n- funcs = (funcs,)\n-\n- if reverse:\n- assert end is None\n- indexes = range(start - 2, -1, -1)\n- else:\n- if end is None:\n- end = len(self.tokens)\n- indexes = range(start, end)\n- for idx in indexes:\n- token = self.tokens[idx]\n- for func in funcs:\n- if func(token):\n- return idx, token\n- return None, None\n-\n- def token_first(self, skip_ws=True, skip_cm=False):\n- \"\"\"Returns the first child token.\n-\n- If *skip_ws* is ``True`` (the default), whitespace\n- tokens are ignored.\n-\n- if *skip_cm* is ``True`` (default: ``False``), comments are\n- ignored too.\n- \"\"\"\n- # this on is inconsistent, using Comment instead of T.Comment...\n- def matcher(tk):\n- return not ((skip_ws and tk.is_whitespace)\n- or (skip_cm and imt(tk, t=T.Comment, i=Comment)))\n- return self._token_matching(matcher)[1]\n-\n- def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None):\n- idx += 1\n- return self._token_matching(lambda tk: imt(tk, i, m, t), idx, end)\n-\n- def token_not_matching(self, funcs, idx):\n- funcs = (funcs,) if not isinstance(funcs, (list, tuple)) else funcs\n- funcs = [lambda tk, func=func: not func(tk) for func in funcs]\n- return self._token_matching(funcs, idx)\n-\n- def token_matching(self, funcs, idx):\n- return self._token_matching(funcs, idx)[1]\n-\n- def token_prev(self, idx, skip_ws=True, skip_cm=False):\n- \"\"\"Returns the previous token relative to *idx*.\n-\n- If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.\n- If *skip_cm* is ``True`` comments are ignored.\n- ``None`` is returned if there's no previous token.\n- \"\"\"\n- return self.token_next(idx, skip_ws, skip_cm, _reverse=True)\n-\n- # TODO: May need to re-add default value to idx\n- def token_next(self, idx, skip_ws=True, skip_cm=False, _reverse=False):\n- \"\"\"Returns the next token relative to *idx*.\n-\n- If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.\n- If *skip_cm* is ``True`` comments are ignored.\n- ``None`` is returned if there's no next token.\n- \"\"\"\n- if idx is None:\n- return None, None\n- idx += 1 # alot of code usage current pre-compensates for this\n-\n- def matcher(tk):\n- return not ((skip_ws and tk.is_whitespace)\n- or (skip_cm and imt(tk, t=T.Comment, i=Comment)))\n- return self._token_matching(matcher, idx, reverse=_reverse)\n-\n- def token_index(self, token, start=0):\n- \"\"\"Return list index of token.\"\"\"\n- start = start if isinstance(start, int) else self.token_index(start)\n- return start + self.tokens[start:].index(token)\n-\n- def group_tokens(self, grp_cls, start, end, include_end=True,\n- extend=False):\n- \"\"\"Replace tokens by an instance of *grp_cls*.\"\"\"\n- start_idx = start\n- start = self.tokens[start_idx]\n-\n- end_idx = end + include_end\n-\n- # will be needed later for new group_clauses\n- # while skip_ws and tokens and tokens[-1].is_whitespace:\n- # tokens = tokens[:-1]\n-\n- if extend and isinstance(start, grp_cls):\n- subtokens = self.tokens[start_idx + 1:end_idx]\n-\n- grp = start\n- grp.tokens.extend(subtokens)\n- del self.tokens[start_idx + 1:end_idx]\n- grp.value += ''.join(token.value for token in subtokens)\n- else:\n- subtokens = self.tokens[start_idx:end_idx]\n- grp = grp_cls(subtokens)\n- self.tokens[start_idx:end_idx] = [grp]\n- grp.parent = self\n-\n- for token in subtokens:\n- token.parent = grp\n-\n- return grp\n-\n- def insert_before(self, where, token):\n- \"\"\"Inserts *token* before *where*.\"\"\"\n- if not isinstance(where, int):\n- where = self.token_index(where)\n- token.parent = self\n- self.tokens.insert(where, token)\n-\n- def insert_after(self, where, token, skip_ws=True):\n- \"\"\"Inserts *token* after *where*.\"\"\"\n- if not isinstance(where, int):\n- where = self.token_index(where)\n- nidx, next_ = self.token_next(where, skip_ws=skip_ws)\n- token.parent = self\n- if next_ is None:\n- self.tokens.append(token)\n- else:\n- self.tokens.insert(nidx, token)\n-\n- def has_alias(self):\n- \"\"\"Returns ``True`` if an alias is present.\"\"\"\n- return self.get_alias() is not None\n-\n- def get_alias(self):\n- \"\"\"Returns the alias for this identifier or ``None``.\"\"\"\n- return None\n-\n- def get_name(self):\n- \"\"\"Returns the name of this identifier.\n-\n- This is either it's alias or it's real name. The returned valued can\n- be considered as the name under which the object corresponding to\n- this identifier is known within the current statement.\n- \"\"\"\n- return self.get_alias() or self.get_real_name()\n-\n- def get_real_name(self):\n- \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n- return None\n-\n- def get_parent_name(self):\n- \"\"\"Return name of the parent object if any.\n-\n- A parent object is identified by the first occurring dot.\n- \"\"\"\n- dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n- _, prev_ = self.token_prev(dot_idx)\n- return remove_quotes(prev_.value) if prev_ is not None else None\n-\n- def _get_first_name(self, idx=None, reverse=False, keywords=False,\n- real_name=False):\n- \"\"\"Returns the name of the first token with a name\"\"\"\n-\n- tokens = self.tokens[idx:] if idx else self.tokens\n- tokens = reversed(tokens) if reverse else tokens\n- types = [T.Name, T.Wildcard, T.String.Symbol]\n-\n- if keywords:\n- types.append(T.Keyword)\n-\n- for token in tokens:\n- if token.ttype in types:\n- return remove_quotes(token.value)\n- elif isinstance(token, (Identifier, Function)):\n- return token.get_real_name() if real_name else token.get_name()\n-\n-\n-class Statement(TokenList):\n- \"\"\"Represents a SQL statement.\"\"\"\n-\n- def get_type(self):\n- \"\"\"Returns the type of a statement.\n-\n- The returned value is a string holding an upper-cased reprint of\n- the first DML or DDL keyword. If the first token in this group\n- isn't a DML or DDL keyword \"UNKNOWN\" is returned.\n-\n- Whitespaces and comments at the beginning of the statement\n- are ignored.\n- \"\"\"\n- token = self.token_first(skip_cm=True)\n- if token is None:\n- # An \"empty\" statement that either has not tokens at all\n- # or only whitespace tokens.\n- return 'UNKNOWN'\n-\n- elif token.ttype in (T.Keyword.DML, T.Keyword.DDL):\n- return token.normalized\n-\n- elif token.ttype == T.Keyword.CTE:\n- # The WITH keyword should be followed by either an Identifier or\n- # an IdentifierList containing the CTE definitions; the actual\n- # DML keyword (e.g. SELECT, INSERT) will follow next.\n- tidx = self.token_index(token)\n- while tidx is not None:\n- tidx, token = self.token_next(tidx, skip_ws=True)\n- if isinstance(token, (Identifier, IdentifierList)):\n- tidx, token = self.token_next(tidx, skip_ws=True)\n-\n- if token is not None \\\n- and token.ttype == T.Keyword.DML:\n- return token.normalized\n-\n- # Hmm, probably invalid syntax, so return unknown.\n- return 'UNKNOWN'\n-\n-\n-class Identifier(NameAliasMixin, TokenList):\n- \"\"\"Represents an identifier.\n-\n- Identifiers may have aliases or typecasts.\n- \"\"\"\n-\n- def is_wildcard(self):\n- \"\"\"Return ``True`` if this identifier contains a wildcard.\"\"\"\n- _, token = self.token_next_by(t=T.Wildcard)\n- return token is not None\n-\n- def get_typecast(self):\n- \"\"\"Returns the typecast or ``None`` of this object as a string.\"\"\"\n- midx, marker = self.token_next_by(m=(T.Punctuation, '::'))\n- nidx, next_ = self.token_next(midx, skip_ws=False)\n- return next_.value if next_ else None\n-\n- def get_ordering(self):\n- \"\"\"Returns the ordering or ``None`` as uppercase string.\"\"\"\n- _, ordering = self.token_next_by(t=T.Keyword.Order)\n- return ordering.normalized if ordering else None\n-\n- def get_array_indices(self):\n- \"\"\"Returns an iterator of index token lists\"\"\"\n-\n- for token in self.tokens:\n- if isinstance(token, SquareBrackets):\n- # Use [1:-1] index to discard the square brackets\n- yield token.tokens[1:-1]\n-\n-\n-class IdentifierList(TokenList):\n- \"\"\"A list of :class:`~sqlparse.sql.Identifier`\\'s.\"\"\"\n-\n- def get_identifiers(self):\n- \"\"\"Returns the identifiers.\n-\n- Whitespaces and punctuations are not included in this generator.\n- \"\"\"\n- for token in self.tokens:\n- if not (token.is_whitespace or token.match(T.Punctuation, ',')):\n- yield token\n-\n-\n-class TypedLiteral(TokenList):\n- \"\"\"A typed literal, such as \"date '2001-09-28'\" or \"interval '2 hours'\".\"\"\"\n- M_OPEN = [(T.Name.Builtin, None), (T.Keyword, \"TIMESTAMP\")]\n- M_CLOSE = T.String.Single, None\n- M_EXTEND = T.Keyword, (\"DAY\", \"HOUR\", \"MINUTE\", \"MONTH\", \"SECOND\", \"YEAR\")\n-\n-\n-class Parenthesis(TokenList):\n- \"\"\"Tokens between parenthesis.\"\"\"\n- M_OPEN = T.Punctuation, '('\n- M_CLOSE = T.Punctuation, ')'\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens[1:-1]\n-\n-\n-class SquareBrackets(TokenList):\n- \"\"\"Tokens between square brackets\"\"\"\n- M_OPEN = T.Punctuation, '['\n- M_CLOSE = T.Punctuation, ']'\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens[1:-1]\n-\n-\n-class Assignment(TokenList):\n- \"\"\"An assignment like 'var := val;'\"\"\"\n-\n-\n-class If(TokenList):\n- \"\"\"An 'if' clause with possible 'else if' or 'else' parts.\"\"\"\n- M_OPEN = T.Keyword, 'IF'\n- M_CLOSE = T.Keyword, 'END IF'\n-\n-\n-class For(TokenList):\n- \"\"\"A 'FOR' loop.\"\"\"\n- M_OPEN = T.Keyword, ('FOR', 'FOREACH')\n- M_CLOSE = T.Keyword, 'END LOOP'\n-\n-\n-class Comparison(TokenList):\n- \"\"\"A comparison used for example in WHERE clauses.\"\"\"\n-\n- @property\n- def left(self):\n- return self.tokens[0]\n-\n- @property\n- def right(self):\n- return self.tokens[-1]\n-\n-\n-class Comment(TokenList):\n- \"\"\"A comment.\"\"\"\n+ *values* i\n+... [14915 characters truncated. Use grep -n or sed -n 'START,ENDp' FILE to see specific lines] ...\n+comment.\"\"\"\n \n def is_multiline(self):\n return self.tokens and self.tokens[0].ttype == T.Comment.Multiline\n@@ -659,3 +223,4 @@\n \n class Command(TokenList):\n \"\"\"Grouping of CLI commands.\"\"\"\n+\ndiff --git a/sqlparse/sql.py.bak b/sqlparse/sql.py.bak\n--- /dev/null\n+++ b/sqlparse/sql.py.bak\n@@ -0,0 +1,226 @@\n+#\n+# Copyright (C) 2009-2020 the sqlparse authors and contributors\n+# <see AUTHORS file>\n+#\n+# This module is part of python-sqlparse and is released under\n+# the BSD License: https://opensource.org/licenses/BSD-3-Clause\n+\n+\"\"\"This module contains classes representing syntactical elements of SQL.\"\"\"\n+\n+import re\n+\n+from sqlparse import tokens as T\n+from sqlparse.utils import imt, remove_quotes\n+\n+\n+class NameAliasMixin:\n+ \"\"\"Implements get_real_name and get_alias.\"\"\"\n+\n+ def get_real_name(self):\n+ \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n+ # a.b\n+ dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n+ return self._get_first_name(dot_idx, real_name=True)\n+\n+ def get_alias(self):\n+ \"\"\"Returns the alias for this identifier or ``None``.\"\"\"\n+\n+ # \"name AS alias\"\n+ kw_idx, kw = self.token_next_by(m=(T.Keyword, 'AS'))\n+ if kw is not None:\n+ return self._get_first_name(kw_idx + 1, keywords=True)\n+\n+ # \"name alias\" or \"complicated column expression alias\"\n+ _, ws = self.token_next_by(t=T.Whitespace)\n+ if len(self.tokens) > 2 and ws is not None:\n+ return self._get_first_name(reverse=True)\n+\n+ # Handle function alias\n+ if isinstance(self, Function):\n+ # Check for the last token which might be the alias\n+ last_token = self.tokens[-1]\n+ if not isinstance(last_token, (Parenthesis, IdentifierList)):\n+ return self._get_first_name(reverse=True)\n+\n+ return None\n+\n+class Token:\n+ \"\"\"Base class for all other classes in this module.\n+\n+ It represents a single token and has two instance attributes:\n+ ``value`` is the unchanged value of the token and ``ttype`` is\n+ the type of the token.\n+ \"\"\"\n+\n+ __slots__ = (\n+ 'is_group',\n+ 'is_keyword',\n+ 'is_newline',\n+ 'is_whitespace',\n+ 'normalized',\n+ 'parent',\n+ 'ttype',\n+ 'value',\n+ )\n+\n+ def __init__(self, ttype, value):\n+ value = str(value)\n+ self.value = value\n+ self.ttype = ttype\n+ self.parent = None\n+ self.is_group = False\n+ self.is_keyword = ttype in T.Keyword\n+ self.is_whitespace = self.ttype in T.Whitespace\n+ self.is_newline = self.ttype in T.Newline\n+ self.normalized = value.upper() if self.is_keyword else value\n+\n+ def __str__(self):\n+ return self.value\n+\n+ # Pending tokenlist __len__ bug fix\n+ # def __len__(self):\n+ # return len(self.value)\n+\n+ def __repr__(self):\n+ cls = self._get_repr_name()\n+ value = self._get_repr_value()\n+\n+ q = '\"' if value.startswith(\"'\") and value.endswith(\"'\") else \"'\"\n+ return \"<{cls} {q}{value}{q} at 0x{id:2X}>\".format(\n+ id=id(self), **locals())\n+\n+ def _get_repr_name(self):\n+ return str(self.ttype).split('.')[-1]\n+\n+ def _get_repr_value(self):\n+ raw = str(self)\n+ if len(raw) > 7:\n+ raw = raw[:6] + '...'\n+ return re.sub(r'\\s+', ' ', raw)\n+\n+ def flatten(self):\n+ \"\"\"Resolve subgroups.\"\"\"\n+ yield self\n+\n+ def match(self, ttype, values, regex=False):\n+ \"\"\"Checks whether the token matches the given arguments.\n+\n+ *ttype* is a token type as defined in `sqlparse.tokens`. If it does\n+ not match, ``False`` is returned.\n+ *values* i\n+... [14915 characters truncated. Use grep -n or sed -n 'START,ENDp' FILE to see specific lines] ...\n+comment.\"\"\"\n+\n+ def is_multiline(self):\n+ return self.tokens and self.tokens[0].ttype == T.Comment.Multiline\n+\n+\n+class Where(TokenList):\n+ \"\"\"A WHERE clause.\"\"\"\n+ M_OPEN = T.Keyword, 'WHERE'\n+ M_CLOSE = T.Keyword, (\n+ 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT',\n+ 'INTERSECT', 'HAVING', 'RETURNING', 'INTO')\n+\n+\n+class Over(TokenList):\n+ \"\"\"An OVER clause.\"\"\"\n+ M_OPEN = T.Keyword, 'OVER'\n+\n+\n+class Having(TokenList):\n+ \"\"\"A HAVING clause.\"\"\"\n+ M_OPEN = T.Keyword, 'HAVING'\n+ M_CLOSE = T.Keyword, ('ORDER BY', 'LIMIT')\n+\n+\n+class Case(TokenList):\n+ \"\"\"A CASE statement with one or more WHEN and possibly an ELSE part.\"\"\"\n+ M_OPEN = T.Keyword, 'CASE'\n+ M_CLOSE = T.Keyword, 'END'\n+\n+ def get_cases(self, skip_ws=False):\n+ \"\"\"Returns a list of 2-tuples (condition, value).\n+\n+ If an ELSE exists condition is None.\n+ \"\"\"\n+ CONDITION = 1\n+ VALUE = 2\n+\n+ ret = []\n+ mode = CONDITION\n+\n+ for token in self.tokens:\n+ # Set mode from the current statement\n+ if token.match(T.Keyword, 'CASE') or (skip_ws and token.ttype in T.Whitespace):\n+ continue\n+\n+ elif token.match(T.Keyword, 'WHEN'):\n+ ret.append(([], []))\n+ mode = CONDITION\n+\n+ elif token.match(T.Keyword, 'THEN'):\n+ mode = VALUE\n+\n+ elif token.match(T.Keyword, 'ELSE'):\n+ ret.append((None, []))\n+ mode = VALUE\n+\n+ elif token.match(T.Keyword, 'END'):\n+ mode = None\n+\n+ # First condition without preceding WHEN\n+ if mode and not ret:\n+ ret.append(([], []))\n+\n+ # Append token depending of the current mode\n+ if mode == CONDITION:\n+ ret[-1][0].append(token)\n+\n+ elif mode == VALUE:\n+ ret[-1][1].append(token)\n+\n+ # Return cases list\n+ return ret\n+\n+\n+class Function(NameAliasMixin, TokenList):\n+ \"\"\"A function or procedure call.\"\"\"\n+\n+ def get_parameters(self):\n+ \"\"\"Return a list of parameters.\"\"\"\n+ parenthesis = self.token_next_by(i=Parenthesis)[1]\n+ result = []\n+ for token in parenthesis.tokens:\n+ if isinstance(token, IdentifierList):\n+ return token.get_identifiers()\n+ elif imt(token, i=(Function, Identifier, TypedLiteral),\n+ t=T.Literal):\n+ result.append(token)\n+ return result\n+\n+ def get_window(self):\n+ \"\"\"Return the window if it exists.\"\"\"\n+ over_clause = self.token_next_by(i=Over)\n+ if not over_clause:\n+ return None\n+ return over_clause[1].tokens[-1]\n+\n+\n+class Begin(TokenList):\n+ \"\"\"A BEGIN/END block.\"\"\"\n+ M_OPEN = T.Keyword, 'BEGIN'\n+ M_CLOSE = T.Keyword, 'END'\n+\n+\n+class Operation(TokenList):\n+ \"\"\"Grouping of operations\"\"\"\n+\n+\n+class Values(TokenList):\n+ \"\"\"Grouping of values\"\"\"\n+\n+\n+class Command(TokenList):\n+ \"\"\"Grouping of CLI commands.\"\"\"\n+\n", "ignored_test_edits": [], "task_date": "2026-07-22T22:58:07+03:00", "context_file": null, "started_at": "2026-11-03T18:02:05+00:00"}
|
|
26
|
+
{"task_id": "andialbrecht-sqlparse-5ca50a2e", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 2, "pass_to_pass_failed": 0, "pass_to_pass_total": 478, "cost_usd": 0.0589, "tokens_in": 184710, "tokens_out": 3875, "steps": 30, "tool_calls": 30, "wall_time_s": 67.4, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -641,6 +641,7 @@\n return over_clause[1].tokens[-1]\n \n \n+ M_OPEN = T.Keyword, (\"BEGIN\", \"BEGIN TRANSACTION\")\n class Begin(TokenList):\n \"\"\"A BEGIN/END block.\"\"\"\n M_OPEN = T.Keyword, 'BEGIN'\n", "ignored_test_edits": [], "task_date": "2025-11-29T08:26:28+01:00", "context_file": null, "started_at": "2026-11-03T18:05:41+00:00"}
|
|
27
|
+
{"task_id": "andialbrecht-sqlparse-b126ba5b", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 6, "pass_to_pass_failed": 0, "pass_to_pass_total": 455, "cost_usd": 0.02247, "tokens_in": 72653, "tokens_out": 749, "steps": 30, "tool_calls": 30, "wall_time_s": 34.9, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2024-07-15T11:54:34+02:00", "context_file": null, "started_at": "2026-11-03T18:06:51+00:00"}
|
|
28
|
+
{"task_id": "andialbrecht-sqlparse-0c4902f3", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 454, "cost_usd": 0.118608, "tokens_in": 350615, "tokens_out": 14915, "steps": 26, "tool_calls": 25, "wall_time_s": 146.4, "stop_reason": "finished", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2024-07-15T11:32:49+02:00", "context_file": null, "started_at": "2026-11-03T18:07:26+00:00"}
|
|
29
|
+
{"task_id": "andialbrecht-sqlparse-e03b74e6", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 449, "pass_to_pass_total": 449, "cost_usd": 0.038164, "tokens_in": 116187, "tokens_out": 3675, "steps": 30, "tool_calls": 30, "wall_time_s": 52.2, "stop_reason": "max_steps", "error": "", "patch": "diff --git a/sqlparse/sql.py b/sqlparse/sql.py\n--- a/sqlparse/sql.py\n+++ b/sqlparse/sql.py\n@@ -1,652 +1 @@\n-#\n-# Copyright (C) 2009-2020 the sqlparse authors and contributors\n-# <see AUTHORS file>\n-#\n-# This module is part of python-sqlparse and is released under\n-# the BSD License: https://opensource.org/licenses/BSD-3-Clause\n-\n-\"\"\"This module contains classes representing syntactical elements of SQL.\"\"\"\n-\n-import re\n-\n-from sqlparse import tokens as T\n-from sqlparse.utils import imt, remove_quotes\n-\n-\n-class NameAliasMixin:\n- \"\"\"Implements get_real_name and get_alias.\"\"\"\n-\n- def get_real_name(self):\n- \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n- # a.b\n- dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n- return self._get_first_name(dot_idx, real_name=True)\n-\n- def get_alias(self):\n- \"\"\"Returns the alias for this identifier or ``None``.\"\"\"\n-\n- # \"name AS alias\"\n- kw_idx, kw = self.token_next_by(m=(T.Keyword, 'AS'))\n- if kw is not None:\n- return self._get_first_name(kw_idx + 1, keywords=True)\n-\n- # \"name alias\" or \"complicated column expression alias\"\n- _, ws = self.token_next_by(t=T.Whitespace)\n- if len(self.tokens) > 2 and ws is not None:\n- return self._get_first_name(reverse=True)\n-\n-\n-class Token:\n- \"\"\"Base class for all other classes in this module.\n-\n- It represents a single token and has two instance attributes:\n- ``value`` is the unchanged value of the token and ``ttype`` is\n- the type of the token.\n- \"\"\"\n-\n- __slots__ = ('value', 'ttype', 'parent', 'normalized', 'is_keyword',\n- 'is_group', 'is_whitespace')\n-\n- def __init__(self, ttype, value):\n- value = str(value)\n- self.value = value\n- self.ttype = ttype\n- self.parent = None\n- self.is_group = False\n- self.is_keyword = ttype in T.Keyword\n- self.is_whitespace = self.ttype in T.Whitespace\n- self.normalized = value.upper() if self.is_keyword else value\n-\n- def __str__(self):\n- return self.value\n-\n- # Pending tokenlist __len__ bug fix\n- # def __len__(self):\n- # return len(self.value)\n-\n- def __repr__(self):\n- cls = self._get_repr_name()\n- value = self._get_repr_value()\n-\n- q = '\"' if value.startswith(\"'\") and value.endswith(\"'\") else \"'\"\n- return \"<{cls} {q}{value}{q} at 0x{id:2X}>\".format(\n- id=id(self), **locals())\n-\n- def _get_repr_name(self):\n- return str(self.ttype).split('.')[-1]\n-\n- def _get_repr_value(self):\n- raw = str(self)\n- if len(raw) > 7:\n- raw = raw[:6] + '...'\n- return re.sub(r'\\s+', ' ', raw)\n-\n- def flatten(self):\n- \"\"\"Resolve subgroups.\"\"\"\n- yield self\n-\n- def match(self, ttype, values, regex=False):\n- \"\"\"Checks whether the token matches the given arguments.\n-\n- *ttype* is a token type. If this token doesn't match the given token\n- type.\n- *values* is a list of possible values for this token. The values\n- are OR'ed together so if only one of the values matches ``True``\n- is returned. Except for keyword tokens the comparison is\n- case-sensitive. For convenience it's OK to pass in a single string.\n- If *regex* is ``True`` (default is ``False``) the given values are\n- treated as regular expressions.\n- \"\"\"\n- type_matched = self.ttype is ttype\n- if not type_matched or values is None:\n- return type_matched\n-\n- if isinstance(values, str):\n- values = (values,)\n-\n- if regex:\n- # TODO: Add test for regex with is_keyboard = false\n- flag = re.IGNORECASE if self.is_keyword else 0\n- values = (re.compile(v, flag) for v in values)\n-\n- for pattern in values:\n- if pattern.search(self.normalized):\n- return True\n- return False\n-\n- if self.is_keyword:\n- values = (v.upper() for v in values)\n-\n- return self.normalized in values\n-\n- def within(self, group_cls):\n- \"\"\"Returns ``True`` if this token is within *group_cls*.\n-\n- Use this method for example to check if an identifier is within\n- a function: ``t.within(sql.Function)``.\n- \"\"\"\n- parent = self.parent\n- while parent:\n- if isinstance(parent, group_cls):\n- return True\n- parent = parent.parent\n- return False\n-\n- def is_child_of(self, other):\n- \"\"\"Returns ``True`` if this token is a direct child of *other*.\"\"\"\n- return self.parent == other\n-\n- def has_ancestor(self, other):\n- \"\"\"Returns ``True`` if *other* is in this tokens ancestry.\"\"\"\n- parent = self.parent\n- while parent:\n- if parent == other:\n- return True\n- parent = parent.parent\n- return False\n-\n-\n-class TokenList(Token):\n- \"\"\"A group of tokens.\n-\n- It has an additional instance attribute ``tokens`` which holds a\n- list of child-tokens.\n- \"\"\"\n-\n- __slots__ = 'tokens'\n-\n- def __init__(self, tokens=None):\n- self.tokens = tokens or []\n- [setattr(token, 'parent', self) for token in self.tokens]\n- super().__init__(None, str(self))\n- self.is_group = True\n-\n- def __str__(self):\n- return ''.join(token.value for token in self.flatten())\n-\n- # weird bug\n- # def __len__(self):\n- # return len(self.tokens)\n-\n- def __iter__(self):\n- return iter(self.tokens)\n-\n- def __getitem__(self, item):\n- return self.tokens[item]\n-\n- def _get_repr_name(self):\n- return type(self).__name__\n-\n- def _pprint_tree(self, max_depth=None, depth=0, f=None, _pre=''):\n- \"\"\"Pretty-print the object tree.\"\"\"\n- token_count = len(self.tokens)\n- for idx, token in enumerate(self.tokens):\n- cls = token._get_repr_name()\n- value = token._get_repr_value()\n-\n- last = idx == (token_count - 1)\n- pre = '`- ' if last else '|- '\n-\n- q = '\"' if value.startswith(\"'\") and value.endswith(\"'\") else \"'\"\n- print(\"{_pre}{pre}{idx} {cls} {q}{value}{q}\"\n- .format(**locals()), file=f)\n-\n- if token.is_group and (max_depth is None or depth < max_depth):\n- parent_pre = ' ' if last else '| '\n- token._pprint_tree(max_depth, depth + 1, f, _pre + parent_pre)\n-\n- def get_token_at_offset(self, offset):\n- \"\"\"Returns the token that is on position offset.\"\"\"\n- idx = 0\n- for token in self.flatten():\n- end = idx + len(token.value)\n- if idx <= offset < end:\n- return token\n- idx = end\n-\n- def flatten(self):\n- \"\"\"Generator yielding ungrouped tokens.\n-\n- This method is recursively called for all child tokens.\n- \"\"\"\n- for token in self.tokens:\n- if token.is_group:\n- yield from token.flatten()\n- else:\n- yield token\n-\n- def get_sublists(self):\n- for token in self.tokens:\n- if token.is_group:\n- yield token\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens\n-\n- def _token_matching(self, funcs, start=0, end=None, reverse=False):\n- \"\"\"next token that match functions\"\"\"\n- if start is None:\n- return None\n-\n- if not isinstance(funcs, (list, tuple)):\n- funcs = (funcs,)\n-\n- if reverse:\n- assert end is None\n- indexes = range(start - 2, -1, -1)\n- else:\n- if end is None:\n- end = len(self.tokens)\n- indexes = range(start, end)\n- for idx in indexes:\n- token = self.tokens[idx]\n- for func in funcs:\n- if func(token):\n- return idx, token\n- return None, None\n-\n- def token_first(self, skip_ws=True, skip_cm=False):\n- \"\"\"Returns the first child token.\n-\n- If *skip_ws* is ``True`` (the default), whitespace\n- tokens are ignored.\n-\n- if *skip_cm* is ``True`` (default: ``False``), comments are\n- ignored too.\n- \"\"\"\n- # this on is inconsistent, using Comment instead of T.Comment...\n- def matcher(tk):\n- return not ((skip_ws and tk.is_whitespace)\n- or (skip_cm and imt(tk, t=T.Comment, i=Comment)))\n- return self._token_matching(matcher)[1]\n-\n- def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None):\n- idx += 1\n- return self._token_matching(lambda tk: imt(tk, i, m, t), idx, end)\n-\n- def token_not_matching(self, funcs, idx):\n- funcs = (funcs,) if not isinstance(funcs, (list, tuple)) else funcs\n- funcs = [lambda tk: not func(tk) for func in funcs]\n- return self._token_matching(funcs, idx)\n-\n- def token_matching(self, funcs, idx):\n- return self._token_matching(funcs, idx)[1]\n-\n- def token_prev(self, idx, skip_ws=True, skip_cm=False):\n- \"\"\"Returns the previous token relative to *idx*.\n-\n- If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.\n- If *skip_cm* is ``True`` comments are ignored.\n- ``None`` is returned if there's no previous token.\n- \"\"\"\n- return self.token_next(idx, skip_ws, skip_cm, _reverse=True)\n-\n- # TODO: May need to re-add default value to idx\n- def token_next(self, idx, skip_ws=True, skip_cm=False, _reverse=False):\n- \"\"\"Returns the next token relative to *idx*.\n-\n- If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.\n- If *skip_cm* is ``True`` comments are ignored.\n- ``None`` is returned if there's no next token.\n- \"\"\"\n- if idx is None:\n- return None, None\n- idx += 1 # alot of code usage current pre-compensates for this\n-\n- def matcher(tk):\n- return not ((skip_ws and tk.is_whitespace)\n- or (skip_cm and imt(tk, t=T.Comment, i=Comment)))\n- return self._token_matching(matcher, idx, reverse=_reverse)\n-\n- def token_index(self, token, start=0):\n- \"\"\"Return list index of token.\"\"\"\n- start = start if isinstance(start, int) else self.token_index(start)\n- return start + self.tokens[start:].index(token)\n-\n- def group_tokens(self, grp_cls, start, end, include_end=True,\n- extend=False):\n- \"\"\"Replace tokens by an instance of *grp_cls*.\"\"\"\n- start_idx = start\n- start = self.tokens[start_idx]\n-\n- end_idx = end + include_end\n-\n- # will be needed later for new group_clauses\n- # while skip_ws and tokens and tokens[-1].is_whitespace:\n- # tokens = tokens[:-1]\n-\n- if extend and isinstance(start, grp_cls):\n- subtokens = self.tokens[start_idx + 1:end_idx]\n-\n- grp = start\n- grp.tokens.extend(subtokens)\n- del self.tokens[start_idx + 1:end_idx]\n- grp.value = str(start)\n- else:\n- subtokens = self.tokens[start_idx:end_idx]\n- grp = grp_cls(subtokens)\n- self.tokens[start_idx:end_idx] = [grp]\n- grp.parent = self\n-\n- for token in subtokens:\n- token.parent = grp\n-\n- return grp\n-\n- def insert_before(self, where, token):\n- \"\"\"Inserts *token* before *where*.\"\"\"\n- if not isinstance(where, int):\n- where = self.token_index(where)\n- token.parent = self\n- self.tokens.insert(where, token)\n-\n- def insert_after(self, where, token, skip_ws=True):\n- \"\"\"Inserts *token* after *where*.\"\"\"\n- if not isinstance(where, int):\n- where = self.token_index(where)\n- nidx, next_ = self.token_next(where, skip_ws=skip_ws)\n- token.parent = self\n- if next_ is None:\n- self.tokens.append(token)\n- else:\n- self.tokens.insert(nidx, token)\n-\n- def has_alias(self):\n- \"\"\"Returns ``True`` if an alias is present.\"\"\"\n- return self.get_alias() is not None\n-\n- def get_alias(self):\n- \"\"\"Returns the alias for this identifier or ``None``.\"\"\"\n- return None\n-\n- def get_name(self):\n- \"\"\"Returns the name of this identifier.\n-\n- This is either it's alias or it's real name. The returned valued can\n- be considered as the name under which the object corresponding to\n- this identifier is known within the current statement.\n- \"\"\"\n- return self.get_alias() or self.get_real_name()\n-\n- def get_real_name(self):\n- \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n- return None\n-\n- def get_parent_name(self):\n- \"\"\"Return name of the parent object if any.\n-\n- A parent object is identified by the first occurring dot.\n- \"\"\"\n- dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n- _, prev_ = self.token_prev(dot_idx)\n- return remove_quotes(prev_.value) if prev_ is not None else None\n-\n- def _get_first_name(self, idx=None, reverse=False, keywords=False,\n- real_name=False):\n- \"\"\"Returns the name of the first token with a name\"\"\"\n-\n- tokens = self.tokens[idx:] if idx else self.tokens\n- tokens = reversed(tokens) if reverse else tokens\n- types = [T.Name, T.Wildcard, T.String.Symbol]\n-\n- if keywords:\n- types.append(T.Keyword)\n-\n- for token in tokens:\n- if token.ttype in types:\n- return remove_quotes(token.value)\n- elif isinstance(token, (Identifier, Function)):\n- return token.get_real_name() if real_name else token.get_name()\n-\n-\n-class Statement(TokenList):\n- \"\"\"Represents a SQL statement.\"\"\"\n-\n- def get_type(self):\n- \"\"\"Returns the type of a statement.\n-\n- The returned value is a string holding an upper-cased reprint of\n- the first DML or DDL keyword. If the first token in this group\n- isn't a DML or DDL keyword \"UNKNOWN\" is returned.\n-\n- Whitespaces and comments at the beginning of the statement\n- are ignored.\n- \"\"\"\n- token = self.token_first(skip_cm=True)\n- if token is None:\n- # An \"empty\" statement that either has not tokens at all\n- # or only whitespace tokens.\n- return 'UNKNOWN'\n-\n- elif token.ttype in (T.Keyword.DML, T.Keyword.DDL):\n- return token.normalized\n-\n- elif token.ttype == T.Keyword.CTE:\n- # The WITH keyword should be followed by either an Identifier or\n- # an IdentifierList containing the CTE definitions; the actual\n- # DML keyword (e.g. SELECT, INSERT) will follow next.\n- tidx = self.token_index(token)\n- while tidx is not None:\n- tidx, token = self.token_next(tidx, skip_ws=True)\n- if isinstance(token, (Identifier, IdentifierList)):\n- tidx, token = self.token_next(tidx, skip_ws=True)\n-\n- if token is not None \\\n- and token.ttype == T.Keyword.DML:\n- return token.normalized\n-\n- # Hmm, probably invalid syntax, so return unknown.\n- return 'UNKNOWN'\n-\n-\n-class Identifier(NameAliasMixin, TokenList):\n- \"\"\"Represents an identifier.\n-\n- Identifiers may have aliases or typecasts.\n- \"\"\"\n-\n- def is_wildcard(self):\n- \"\"\"Return ``True`` if this identifier contains a wildcard.\"\"\"\n- _, token = self.token_next_by(t=T.Wildcard)\n- return token is not None\n-\n- def get_typecast(self):\n- \"\"\"Returns the typecast or ``None`` of this object as a string.\"\"\"\n- midx, marker = self.token_next_by(m=(T.Punctuation, '::'))\n- nidx, next_ = self.token_next(midx, skip_ws=False)\n- return next_.value if next_ else None\n-\n- def get_ordering(self):\n- \"\"\"Returns the ordering or ``None`` as uppercase string.\"\"\"\n- _, ordering = self.token_next_by(t=T.Keyword.Order)\n- return ordering.normalized if ordering else None\n-\n- def get_array_indices(self):\n- \"\"\"Returns an iterator of index token lists\"\"\"\n-\n- for token in self.tokens:\n- if isinstance(token, SquareBrackets):\n- # Use [1:-1] index to discard the square brackets\n- yield token.tokens[1:-1]\n-\n-\n-class IdentifierList(TokenList):\n- \"\"\"A list of :class:`~sqlparse.sql.Identifier`\\'s.\"\"\"\n-\n- def get_identifiers(self):\n- \"\"\"Returns the identifiers.\n-\n- Whitespaces and punctuations are not included in this generator.\n- \"\"\"\n- for token in self.tokens:\n- if not (token.is_whitespace or token.match(T.Punctuation, ',')):\n- yield token\n-\n-\n-class TypedLiteral(TokenList):\n- \"\"\"A typed literal, such as \"date '2001-09-28'\" or \"interval '2 hours'\".\"\"\"\n- M_OPEN = [(T.Name.Builtin, None), (T.Keyword, \"TIMESTAMP\")]\n- M_CLOSE = T.String.Single, None\n- M_EXTEND = T.Keyword, (\"DAY\", \"HOUR\", \"MINUTE\", \"MONTH\", \"SECOND\", \"YEAR\")\n-\n-\n-class Parenthesis(TokenList):\n- \"\"\"Tokens between parenthesis.\"\"\"\n- M_OPEN = T.Punctuation, '('\n- M_CLOSE = T.Punctuation, ')'\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens[1:-1]\n-\n-\n-class SquareBrackets(TokenList):\n- \"\"\"Tokens between square brackets\"\"\"\n- M_OPEN = T.Punctuation, '['\n- M_CLOSE = T.Punctuation, ']'\n-\n- @property\n- def _groupable_tokens(self):\n- return self.tokens[1:-1]\n-\n-\n-class Assignment(TokenList):\n- \"\"\"An assignment like 'var := val;'\"\"\"\n-\n-\n-class If(TokenList):\n- \"\"\"An 'if' clause with possible 'else if' or 'else' parts.\"\"\"\n- M_OPEN = T.Keyword, 'IF'\n- M_CLOSE = T.Keyword, 'END IF'\n-\n-\n-class For(TokenList):\n- \"\"\"A 'FOR' loop.\"\"\"\n- M_OPEN = T.Keyword, ('FOR', 'FOREACH')\n- M_CLOSE = T.Keyword, 'END LOOP'\n-\n-\n-class Comparison(TokenList):\n- \"\"\"A comparison used for example in WHERE clauses.\"\"\"\n-\n- @property\n- def left(self):\n- return self.tokens[0]\n-\n- @property\n- def right(self):\n- return self.tokens[-1]\n-\n-\n-class Comment(TokenList):\n- \"\"\"A comment.\"\"\"\n-\n- def is_multiline(self):\n- return self.tokens and self.tokens[0].ttype == T.Comment.Multiline\n-\n-\n-class Where(TokenList):\n- \"\"\"A WHERE clause.\"\"\"\n- M_OPEN = T.Keyword, 'WHERE'\n- M_CLOSE = T.Keyword, (\n- 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT',\n- 'HAVING', 'RETURNING', 'INTO')\n-\n-\n-class Over(TokenList):\n- \"\"\"An OVER clause.\"\"\"\n- M_OPEN = T.Keyword, 'OVER'\n-\n-\n-class Having(TokenList):\n- \"\"\"A HAVING clause.\"\"\"\n- M_OPEN = T.Keyword, 'HAVING'\n- M_CLOSE = T.Keyword, ('ORDER BY', 'LIMIT')\n-\n-\n-class Case(TokenList):\n- \"\"\"A CASE statement with one or more WHEN and possibly an ELSE part.\"\"\"\n- M_OPEN = T.Keyword, 'CASE'\n- M_CLOSE = T.Keyword, 'END'\n-\n- def get_cases(self, skip_ws=False):\n- \"\"\"Returns a list of 2-tuples (condition, value).\n-\n- If an ELSE exists condition is None.\n- \"\"\"\n- CONDITION = 1\n- VALUE = 2\n-\n- ret = []\n- mode = CONDITION\n-\n- for token in self.tokens:\n- # Set mode from the current statement\n- if token.match(T.Keyword, 'CASE'):\n- continue\n-\n- elif skip_ws and token.ttype in T.Whitespace:\n- continue\n-\n- elif token.match(T.Keyword, 'WHEN'):\n- ret.append(([], []))\n- mode = CONDITION\n-\n- elif token.match(T.Keyword, 'THEN'):\n- mode = VALUE\n-\n- elif token.match(T.Keyword, 'ELSE'):\n- ret.append((None, []))\n- mode = VALUE\n-\n- elif token.match(T.Keyword, 'END'):\n- mode = None\n-\n- # First condition without preceding WHEN\n- if mode and not ret:\n- ret.append(([], []))\n-\n- # Append token depending of the current mode\n- if mode == CONDITION:\n- ret[-1][0].append(token)\n-\n- elif mode == VALUE:\n- ret[-1][1].append(token)\n-\n- # Return cases list\n- return ret\n-\n-\n-class Function(NameAliasMixin, TokenList):\n- \"\"\"A function or procedure call.\"\"\"\n-\n- def get_parameters(self):\n- \"\"\"Return a list of parameters.\"\"\"\n- parenthesis = self.tokens[-1]\n- result = []\n- for token in parenthesis.tokens:\n- if isinstance(token, IdentifierList):\n- return token.get_identifiers()\n- elif imt(token, i=(Function, Identifier, TypedLiteral),\n- t=T.Literal):\n- result.append(token)\n- return result\n-\n-\n-class Begin(TokenList):\n- \"\"\"A BEGIN/END block.\"\"\"\n- M_OPEN = T.Keyword, 'BEGIN'\n- M_CLOSE = T.Keyword, 'END'\n-\n-\n-class Operation(TokenList):\n- \"\"\"Grouping of operations\"\"\"\n-\n-\n-class Values(TokenList):\n- \"\"\"Grouping of values\"\"\"\n-\n-\n-class Command(TokenList):\n- \"\"\"Grouping of CLI commands.\"\"\"\n+$(cat sqlparse/sql.py | sed '/class Function(NameAliasMixin, TokenList):/a\\ def get_window(self):\\ \"\"\"Return the window specification if it exists.\"\"\"\\ if len(self.tokens) > 2 and isinstance(self.tokens[-1], Parenthesis):\\ return self.tokens[-1]\\ return None')\n", "ignored_test_edits": [], "task_date": "2024-04-13T13:41:02+02:00", "context_file": null, "started_at": "2026-11-03T18:09:53+00:00"}
|
|
30
|
+
{"task_id": "andialbrecht-sqlparse-46971e5a", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 1, "pass_to_pass_failed": 0, "pass_to_pass_total": 449, "cost_usd": 0.059757, "tokens_in": 192462, "tokens_out": 2243, "steps": 30, "tool_calls": 30, "wall_time_s": 42.6, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2024-03-16T17:03:23+01:00", "context_file": null, "started_at": "2026-11-03T18:10:46+00:00"}
|
|
31
|
+
{"task_id": "andialbrecht-sqlparse-20caed83", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 2, "pass_to_pass_failed": 512, "pass_to_pass_total": 512, "cost_usd": 0.009627, "tokens_in": 27792, "tokens_out": 1433, "steps": 10, "tool_calls": 9, "wall_time_s": 19.9, "stop_reason": "finished", "error": "", "patch": "diff --git a/sqlparse/cli.py b/sqlparse/cli.py\n--- a/sqlparse/cli.py\n+++ b/sqlparse/cli.py\n@@ -189,13 +189,23 @@\n try:\n with open(filename, encoding=args.encoding) as f:\n data = ''.join(f.readlines())\n+ try:\n+ try:\n except OSError as e:\n return _error(f'Failed to read {filename}: {e}')\n \n # Determine output destination\n close_stream = False\n if args.inplace:\n- try:\n+ except SQLParseError as e:\n+ finally:\n+ if filename != \"-\":\n+ with open(filename, \"w\", encoding=args.encoding) as f:\n+ f.write(data)\n+ return _error(f\"Failed to format {filename}: {e}\")\n+ try:\n+ except SQLParseError as e:\n+ return _error(f\"Failed to format {filename}: {e}\")\n stream = open(filename, 'w', encoding=args.encoding)\n close_stream = True\n except OSError as e:\ndiff --git a/sqlparse/cli.py.tmp b/sqlparse/cli.py.tmp\n--- /dev/null\n+++ b/sqlparse/cli.py.tmp\n@@ -0,0 +1,10 @@\n+$(sed -n '1,191p' sqlparse/cli.py)\n+ try:\n+ formatted = formatter.format(data, **options)\n+ except SQLParseError as e:\n+ return _error(f\"Failed to format {filename}: {e}\")\n+ finally:\n+ if filename != \"-\":\n+ with open(filename, \"w\", encoding=args.encoding) as f:\n+ f.write(data)\n+$(sed -n '203,$p' sqlparse/cli.py)\n", "ignored_test_edits": [], "task_date": "2026-11-01T13:23:08+01:00", "context_file": null, "started_at": "2026-11-03T18:11:29+00:00"}
|
|
32
|
+
{"task_id": "andialbrecht-sqlparse-3512a9d8", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 5, "pass_to_pass_failed": 0, "pass_to_pass_total": 507, "cost_usd": 0.052439, "tokens_in": 147883, "tokens_out": 8971, "steps": 30, "tool_calls": 30, "wall_time_s": 97.5, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2026-11-01T12:54:06+01:00", "context_file": null, "started_at": "2026-11-03T18:11:49+00:00"}
|
|
33
|
+
{"task_id": "andialbrecht-sqlparse-bb3c50a5", "model": "mistral/codestral-latest", "passed": false, "fail_to_pass_passed": 0, "fail_to_pass_total": 9, "pass_to_pass_failed": 0, "pass_to_pass_total": 509, "cost_usd": 0.031198, "tokens_in": 100109, "tokens_out": 1295, "steps": 30, "tool_calls": 30, "wall_time_s": 39.3, "stop_reason": "max_steps", "error": "", "patch": "", "ignored_test_edits": [], "task_date": "2026-10-20T10:56:23-03:00", "context_file": null, "started_at": "2026-11-03T18:13:27+00:00"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tool": "commitarena",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"updated_at": "2026-11-03T18:00:11+00:00",
|
|
5
|
+
"hardware": "Darwin arm64 (Apple M4, 16 GB RAM)",
|
|
6
|
+
"models": [
|
|
7
|
+
"mistral/codestral-latest",
|
|
8
|
+
"mistral/ministral-8b-latest",
|
|
9
|
+
"mistral/mistral-large-4"
|
|
10
|
+
],
|
|
11
|
+
"cutoffs": {},
|
|
12
|
+
"agent": {
|
|
13
|
+
"max_steps": 30,
|
|
14
|
+
"max_wall_time": 1800,
|
|
15
|
+
"max_output_chars": 6000,
|
|
16
|
+
"max_tokens": 4096,
|
|
17
|
+
"temperature": 0.0,
|
|
18
|
+
"max_context_chars": 40000,
|
|
19
|
+
"think": null
|
|
20
|
+
},
|
|
21
|
+
"sandbox": {
|
|
22
|
+
"cpus": 2.0,
|
|
23
|
+
"memory": "2g",
|
|
24
|
+
"pids_limit": 512,
|
|
25
|
+
"command_timeout": 120,
|
|
26
|
+
"network": "none"
|
|
27
|
+
},
|
|
28
|
+
"context_file": null,
|
|
29
|
+
"strip_context_files": false,
|
|
30
|
+
"created_at": "2026-11-03T18:00:11+00:00",
|
|
31
|
+
"recorded": true,
|
|
32
|
+
"repo": "https://github.com/andialbrecht/sqlparse",
|
|
33
|
+
"repo_license": "BSD-3-Clause",
|
|
34
|
+
"note_en": "Same harness, limits and sandbox for every model: 30 model calls and 1800 s per attempt, 4096 tokens per reply, temperature 0. Codestral repeated an earlier command verbatim in 170 of its 304 tool calls, despite 163 repeat notices from the harness, and ran out of steps in 9 of 11 attempts; it never edited a test file. Full trajectories: github.com/diegoperezg7/commitarena/tree/main/docs/demo-run/trajectories",
|
|
35
|
+
"note_es": "Mismo arn\u00e9s, l\u00edmites y sandbox para todos: 30 llamadas y 1800 s por intento, 4096 tokens por respuesta, temperatura 0. Codestral repiti\u00f3 literalmente un comando anterior en 170 de sus 304 llamadas, pese a 163 avisos de repetici\u00f3n del arn\u00e9s, y agot\u00f3 los pasos en 9 de 11 intentos; no toc\u00f3 ning\u00fan test. Trayectorias completas: github.com/diegoperezg7/commitarena/tree/main/docs/demo-run/trajectories"
|
|
36
|
+
}
|