PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: jlongster/prettier (js)

Issue:
Missing parenthesis around arrow functions in method calls
```js
(a => {}).length
```

outputs

```js
a => {}.length;
```

which is incorrect

https://jlongster.github.io/prettier/#%7B%22content%22%3A%22(a%20%3D%3E%20%7B%7D).length%5Cn%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3Afalse%2C%22bracketSpacing%22%3Atrue%7D%7D

Pull request:
Fix issue with ArrowFunctionExpression parens
Fixes #235 

Patch:
diff --git a/src/fast-path.js b/src/fast-path.js
index 634bdda63..5fd30d163 100644
--- a/src/fast-path.js
+++ b/src/fast-path.js
@@ -362,6 +362,10 @@ FPp.needsParens = function(assumeExpressionContext) {
         return true;
       }
 
+      if (parent.type === "MemberExpression") {
+        return true;
+      }
+
       return isBinary(parent);
 
     case "ClassExpression":


Test patch:
diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap
index f1b48892b..24c85d6b9 100644
--- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap
@@ -25,6 +25,13 @@ var ident = <T>(x: T): T => x;
 "
 `;
 
+exports[`test arrow_function_expression.js 1`] = `
+"(a => {}).length
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(a => {}).length;
+"
+`;
+
 exports[`test arrows.js 1`] = `
 "function selectBestEffortImageForWidth(
     maxWidth: number,
diff --git a/tests/arrows/arrow_function_expression.js b/tests/arrows/arrow_function_expression.js
new file mode 100644
index 000000000..ecea2142f
--- /dev/null
+++ b/tests/arrows/arrow_function_expression.js
@@ -0,0 +1,1 @@
+(a => {}).length
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 198
Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

Given a set of distinct positive integers, find the largest subset such that every pair of elements in the subset `(i, j)` satisfies either `i % j = 0` or `j % i = 0`.

For example, given the set `[3, 5, 10, 20, 21]`, you should return `[5, 10, 20]`. Given `[1, 3, 6, 24]`, return `[1, 3, 6, 24]`.

Pull request:
Day198
Resolves #408.

Patch:
diff --git a/README.md b/README.md
index d334027..ce37247 100644
--- a/README.md
+++ b/README.md
@@ -207,5 +207,6 @@ problems from
 * [Day 195](https://github.com/vaskoz/dailycodingproblem-go/issues/401)
 * [Day 196](https://github.com/vaskoz/dailycodingproblem-go/issues/404)
 * [Day 197](https://github.com/vaskoz/dailycodingproblem-go/issues/405)
+* [Day 198](https://github.com/vaskoz/dailycodingproblem-go/issues/408)
 * [Day 199](https://github.com/vaskoz/dailycodingproblem-go/issues/409)
 * [Day 200](https://github.com/vaskoz/dailycodingproblem-go/issues/411)
diff --git a/day198/problem.go b/day198/problem.go
new file mode 100644
index 0000000..d050ac7
--- /dev/null
+++ b/day198/problem.go
@@ -0,0 +1,44 @@
+package day198
+
+import (
+	"sort"
+)
+
+// LargestSubsetPairs finds the largest subset
+// such that every pair of elements in the subset (i, j)
+// satisfies either i % j = 0 or j % i = 0.
+// Runs in O(N^2) time
+func LargestSubsetPairs(nums []int) []int {
+	sort.Slice(nums, func(i, j int) bool {
+		return nums[i] < nums[j]
+	})
+	dp := make([]int, len(nums))
+	dp[len(dp)-1] = 1
+	var largestI, largestVal int
+	for i := len(dp) - 2; i >= 0; i-- {
+		m := 0
+		for j := i + 1; j < len(dp); j++ {
+			if nums[j]%nums[i] == 0 {
+				m = max(m, dp[j])
+			}
+		}
+		if dp[i] = 1 + m; dp[i] > largestVal {
+			largestI = i
+			largestVal = dp[i]
+		}
+	}
+	result := make([]int, 0, largestVal)
+	for i := largestI; i < len(nums); i++ {
+		if nums[i]%nums[largestI] == 0 {
+			result = append(result, nums[i])
+		}
+	}
+	return result
+}
+
+func max(a, b int) int {
+	if a > b {
+		return a
+	}
+	return b
+}


Test patch:
diff --git a/day198/problem_test.go b/day198/problem_test.go
new file mode 100644
index 0000000..cdb3cd9
--- /dev/null
+++ b/day198/problem_test.go
@@ -0,0 +1,32 @@
+package day198
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	nums, subset []int
+}{
+	{[]int{3, 5, 10, 20, 21}, []int{5, 10, 20}},
+	{[]int{1, 3, 6, 24}, []int{1, 3, 6, 24}},
+}
+
+func TestLargestSubsetPairs(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		input := append([]int{}, tc.nums...)
+		if result := LargestSubsetPairs(input); !reflect.DeepEqual(result, tc.subset) {
+			t.Errorf("Expected %v, got %v", tc.subset, result)
+		}
+	}
+}
+
+func BenchmarkLargestSubsetPairs(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			input := append([]int{}, tc.nums...)
+			LargestSubsetPairs(input)
+		}
+	}
+}
Repository: WordPress/WordPress-Coding-Standards (php)

Issue:
Add antispambot to list of functions that don't need escaping
The function `antispambot` takes an email address, and obfuscates it by encoding it using HTML entities. [Documentation](https://codex.wordpress.org/Function_Reference/antispambot)

For example, this code:

```php
echo antispambot( 'john.doe@mysite.com' );
```

This will output the email like this in the HTML:

```
&#106;&#111;h&#110;&#46;&#100;&#111;&#101;&#64;mysit&#101;.&#99;&#111;&#109;
```

PHPCS complains about that code, saying it should require escaping, when it doesn't.

Pull request:
Sniff::$formattingFunctions: add `antispambot()` to the list
Fixes #1246

Includes unit tests.

Patch:
diff --git a/WordPress/Sniff.php b/WordPress/Sniff.php
index 276c7456..58ebd3c7 100644
--- a/WordPress/Sniff.php
+++ b/WordPress/Sniff.php
@@ -358,14 +358,15 @@ abstract class Sniff implements PHPCS_Sniff {
 	 * @var array
 	 */
 	protected $formattingFunctions = array(
-		'array_fill' => true,
-		'ent2ncr'    => true,
-		'implode'    => true,
-		'join'       => true,
-		'nl2br'      => true,
-		'sprintf'    => true,
-		'vsprintf'   => true,
-		'wp_sprintf' => true,
+		'antispambot' => true,
+		'array_fill'  => true,
+		'ent2ncr'     => true,
+		'implode'     => true,
+		'join'        => true,
+		'nl2br'       => true,
+		'sprintf'     => true,
+		'vsprintf'    => true,
+		'wp_sprintf'  => true,
 	);
 
 	/**


Test patch:
diff --git a/WordPress/Tests/Security/EscapeOutputUnitTest.inc b/WordPress/Tests/Security/EscapeOutputUnitTest.inc
index e5a34228..9698ce56 100644
--- a/WordPress/Tests/Security/EscapeOutputUnitTest.inc
+++ b/WordPress/Tests/Security/EscapeOutputUnitTest.inc
@@ -300,3 +300,8 @@ trigger_error(); // Ignore.
 _deprecated_file(); // Ignore.
 
 \_deprecated_file( \basename( __FILE__ ), '1.3.0' ); // Ok.
+
+// Issue #1246.
+echo antispambot( 'john.doe@mysite.com' ); // OK.
+echo antispambot( esc_html( $email ) ); // OK.
+echo antispambot( $email ); // Bad.
diff --git a/WordPress/Tests/Security/EscapeOutputUnitTest.php b/WordPress/Tests/Security/EscapeOutputUnitTest.php
index 5ae98881..571cd24b 100644
--- a/WordPress/Tests/Security/EscapeOutputUnitTest.php
+++ b/WordPress/Tests/Security/EscapeOutputUnitTest.php
@@ -89,6 +89,7 @@ class EscapeOutputUnitTest extends AbstractSniffUnitTest {
 			289 => 1,
 			294 => 1,
 			297 => 1,
+			307 => 1,
 		);
 	}
Repository: fsspec/universal_pathlib (python)

Issue:
AttributeError: _cparts
When upgrading to the new version of `universal-pathlib` I'm finding it common in my use case for tools to compare `UPath` instances to `pathlib.Path` instances and raise an `AttributeError`:

```python
import pathlib

from upath import UPath

github_path = UPath("github://fsspec:universal_pathlib@main/README.md")
local_path = pathlib.Path("README.md")

match = github_path == local_path
```

```python
  File "/Users/juftin/Library/Application Support/JetBrains/IntelliJIdea2023.2/scratches/scratch_68.py", line 8, in <module>
    match = github_path == local_path
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/juftin/.pyenv/versions/3.11.3/lib/python3.11/pathlib.py", line 581, in __eq__
    return self._cparts == other._cparts and self._flavour is other._flavour
                           ^^^^^^^^^^^^^
  File "/Users/juftin/git/textual-universal-directorytree/.venv/test/lib/python3.11/site-packages/upath/core.py", line 421, in __getattr__
    raise AttributeError(item)
AttributeError: _cparts. Did you mean: '_parts'?
```

I'm not exactly sure what pathlib is doing with `_cparts`, but I'm finding that implementing `_cparts` and returning `self._parts` resolves this issue. 

Pull request:
Fix __eq__ _cparts missing
Close #202 

Patch:
diff --git a/upath/core.py b/upath/core.py
index bea2eba..ec0a575 100644
--- a/upath/core.py
+++ b/upath/core.py
@@ -516,6 +516,11 @@ class UPath(PathlibPathShim, Path):
     def _parts(self, value):
         self.__parts = value
 
+    @property
+    def _cparts(self):
+        # required for pathlib.Path.__eq__ compatibility on Python <3.12
+        return self.parts
+
     # === pathlib.PurePath ============================================
 
     def __reduce__(self):


Test patch:
diff --git a/upath/tests/test_core.py b/upath/tests/test_core.py
index d9a42d6..71a53ae 100644
--- a/upath/tests/test_core.py
+++ b/upath/tests/test_core.py
@@ -248,6 +248,13 @@ def test_copy_path_append():
     assert str(path / "folder2" / "folder3") == str(copy_path)
 
 
+def test_compare_to_pathlib_path_ne():
+    assert UPath("gcs://bucket/folder") != pathlib.Path("gcs://bucket/folder")
+    assert pathlib.Path("gcs://bucket/folder") != UPath("gcs://bucket/folder")
+    assert UPath("/bucket/folder") == pathlib.Path("/bucket/folder")
+    assert pathlib.Path("/bucket/folder") == UPath("/bucket/folder")
+
+
 @pytest.mark.parametrize(
     "urlpath",
     [
Repository: yargs/yargs (js)

Issue:
commands: we should make builder, handler, description, command optional
It's not the case that we always wand a builder function for a command, I propose that we make each of these parameters optional.

Pull request:
feat: providing a builder for commands is now optional
fixes #492 

Patch:
diff --git a/lib/command.js b/lib/command.js
index b753d3a..1dc8af9 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -11,14 +11,9 @@ module.exports = function (yargs, usage, validation) {
 
   var handlers = {}
   self.addHandler = function (cmd, description, builder, handler) {
-    // allow modules that define (a) all properties or (b) only command and description
     if (typeof cmd === 'object') {
       const commandString = typeof cmd.command === 'string' ? cmd.command : moduleName(cmd)
-      if (cmd.builder && typeof cmd.handler === 'function') {
-        self.addHandler(commandString, extractDesc(cmd), cmd.builder, cmd.handler)
-      } else {
-        self.addHandler(commandString, extractDesc(cmd))
-      }
+      self.addHandler(commandString, extractDesc(cmd), cmd.builder, cmd.handler)
       return
     }
 
@@ -39,6 +34,8 @@ module.exports = function (yargs, usage, validation) {
     handlers[parsedCommand.cmd] = {
       original: cmd,
       handler: handler,
+      // TODO: default to a noop builder in
+      // yargs@5.x
       builder: builder,
       demanded: parsedCommand.demanded,
       optional: parsedCommand.optional


Test patch:
diff --git a/test/command.js b/test/command.js
index 890fb8f..b28baf4 100644
--- a/test/command.js
+++ b/test/command.js
@@ -318,6 +318,26 @@ describe('Command', function () {
       var commands = y.getUsageInstance().getCommands()
       commands[0].should.deep.equal([module.command, module.describe])
     })
+
+    it('accepts module (missing handler function) as 1st argument', function () {
+      var module = {
+        command: 'foo',
+        describe: 'i\'m not feeling very creative at the moment',
+        builder: {
+          hello: {
+            default: 'world'
+          }
+        }
+      }
+
+      var y = yargs([]).command(module)
+      var handlers = y.getCommandInstance().getCommandHandlers()
+      handlers.foo.original.should.equal(module.command)
+      handlers.foo.builder.should.equal(module.builder)
+      expect(handlers.foo.handler).to.equal(undefined)
+      var commands = y.getUsageInstance().getCommands()
+      commands[0].should.deep.equal([module.command, module.describe])
+    })
   })
 
   describe('commandDir', function () {