PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: MartinThoma/flake8-simplify (python)

Issue:
yield from is not allowed in async function
## Desired change
Do not warning if a SIM104 is encountered inside an async function or method.

* **Rule(s)**: SIM104
* **Adjustment**: In which way should it/they be adjusted?
Do not warning if a SIM104 is encountered inside an async function or method.

## Explanation

Why is the adjustment necessary / better?

The suggested fix to replace a for yield loop with a `yield from` statement is [invalid](https://peps.python.org/pep-0525/#asynchronous-yield-from) inside an async function.

## Example

This is an example where the mentioned rule(s) would currently be suboptimal:

```python
async fib(limit=10):
    if limit == 1:
        yield 0
    if limit == 2:
        yield 0
        yield 1
    i, j = 0, 1
    for _ in range(2, limit):
        n = i + j
        yield n
        i, j = j, n
```


Pull request:
SIM104: Remove false-positives in case the loop is not a direct child of an async function
Not all for loops within a function body is a direct child of the function body

Closes #146 

Patch:
diff --git a/README.md b/README.md
index f73d258..4aeac9c 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ Python-specific rules:
 * `SIM126`: Reserved for [SIM906](#sim906) once it's stable
 * `SIM127`: Reserved for [SIM907](#sim907) once it's stable
 
-Simplifying Comparations:
+Simplifying Comparisons:
 
 * `SIM201`: Use 'a != b' instead of 'not a == b' ([example](#SIM201))
 * `SIM202`: Use 'a == b' instead of 'not a != b' ([example](#SIM202))
diff --git a/flake8_simplify/rules/ast_for.py b/flake8_simplify/rules/ast_for.py
index 8d4d984..e19f64c 100644
--- a/flake8_simplify/rules/ast_for.py
+++ b/flake8_simplify/rules/ast_for.py
@@ -48,7 +48,15 @@ def get_sim104(node: ast.For) -> List[Tuple[int, int, str]]:
         or node.orelse != []
     ):
         return errors
-    if isinstance(node.parent, ast.AsyncFunctionDef):  # type: ignore
+
+    parent = getattr(node, "parent", None)
+    while (parent
+           and hasattr(parent, "parent")
+           and parent.parent is not parent
+           and not isinstance(parent, ast.AsyncFunctionDef)):
+        parent = getattr(parent, "parent", None)
+
+    if isinstance(parent, ast.AsyncFunctionDef):  # type: ignore
         return errors
     iterable = to_source(node.iter)
     errors.append(


Test patch:
diff --git a/tests/test_100_rules.py b/tests/test_100_rules.py
index fba08fe..955d71d 100644
--- a/tests/test_100_rules.py
+++ b/tests/test_100_rules.py
@@ -99,6 +99,17 @@ def test_s104_async_generator_false_positive():
         assert "SIM104" not in el
 
 
+def test_s104_async_generator_false_positive_2():
+    ret = _results(
+        """async def items():
+    with open('/etc/passwd') as f:
+        for line in f:
+            yield line"""
+    )
+    for el in ret:
+        assert "SIM104" not in el
+
+
 def test_sim105():
     ret = _results(
         """try:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 103
Good morning! Here's your coding interview problem for today.

This problem was asked by Square.

Given a string and a set of characters, return the shortest substring containing all the characters in the set.

For example, given the string `"figehaeci"` and the set of characters `{a, e, i}`, you should return `"aeci"`.

If there is no substring containing all the characters in the set, return null.

Pull request:
Day103
Resolves #217.

Patch:
diff --git a/README.md b/README.md
index cb56aaf..710675e 100644
--- a/README.md
+++ b/README.md
@@ -112,3 +112,4 @@ problems from
 * [Day 100](https://github.com/vaskoz/dailycodingproblem-go/issues/209)
 * [Day 101](https://github.com/vaskoz/dailycodingproblem-go/issues/212)
 * [Day 102](https://github.com/vaskoz/dailycodingproblem-go/issues/214)
+* [Day 103](https://github.com/vaskoz/dailycodingproblem-go/issues/217)
diff --git a/day103/problem.go b/day103/problem.go
new file mode 100644
index 0000000..b148f65
--- /dev/null
+++ b/day103/problem.go
@@ -0,0 +1,53 @@
+package day103
+
+// ShortestSubstringContains returns the shortest substring that contains
+// all the letters provided in any order.
+// Windowing runs in O(N) time and O(letters) extra space.
+func ShortestSubstringContains(str string, letters []rune) string {
+	occ := make(map[rune]int, len(letters))
+	for _, r := range letters {
+		occ[r]++
+	}
+	result := str
+	var start int
+	for end, r := range str {
+		if _, found := occ[r]; found {
+			occ[r]--
+			if allFound(occ) {
+				for {
+					if count, found := occ[rune(str[start])]; found && count+1 > 0 {
+						break
+					} else if found {
+						occ[rune(str[start])]++
+					}
+					start++
+				}
+				result = candidate(str[start:end+1], result)
+			}
+		}
+	}
+	return answer(result, !allFound(occ))
+}
+
+func answer(result string, notPossible bool) string {
+	if notPossible {
+		return ""
+	}
+	return result
+}
+
+func candidate(incumbent, challenger string) string {
+	if len(incumbent) <= len(challenger) {
+		return incumbent
+	}
+	return challenger
+}
+
+func allFound(m map[rune]int) bool {
+	for _, v := range m {
+		if v > 0 {
+			return false
+		}
+	}
+	return true
+}


Test patch:
diff --git a/day103/problem_test.go b/day103/problem_test.go
new file mode 100644
index 0000000..2c7fa7d
--- /dev/null
+++ b/day103/problem_test.go
@@ -0,0 +1,31 @@
+package day103
+
+import "testing"
+
+var testcases = []struct {
+	str      string
+	letters  []rune
+	expected string
+}{
+	{"figehaeci", []rune("aei"), "aeci"},
+	{"figehaeci", []rune("xei"), ""},
+	{"this is a test string", []rune("tist"), "t stri"},
+	{"a", []rune("ab"), ""},
+}
+
+func TestShortestSubstringContains(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ShortestSubstringContains(tc.str, tc.letters); result != tc.expected {
+			t.Errorf("Expected %v got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkShortestSubstringContains(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ShortestSubstringContains(tc.str, tc.letters)
+		}
+	}
+}
Repository: brenolf/polyjuice (js)

Issue:
Add `SpacesInsideParenthesizedExpression` rules
* http://jscs.info/rule/disallowSpacesInsideParenthesizedExpression
* http://jscs.info/rule/requireSpacesInsideParenthesizedExpression

Pull request:
Resolves #34

Patch:
diff --git a/lib/dictionaries/jscs.js b/lib/dictionaries/jscs.js
index ff0b0b3..39f3500 100644
--- a/lib/dictionaries/jscs.js
+++ b/lib/dictionaries/jscs.js
@@ -805,5 +805,43 @@ module.exports = {
   'requireSpaceBeforeBinaryOperators': {
     name: 'space-infix-ops',
     truthy: 2
+  },
+
+  'disallowSpacesInsideParenthesizedExpression': {
+    name: 'space-in-parens',
+    truthy: function (value) {
+      if (value === true) {
+        return [2, 'never']
+      }
+
+      var exceptions = []
+
+      var except = value.allExcept
+
+      if (value.allExcept.indexOf('{') > -1 || except.indexOf('}' > -1)) {
+        exceptions.push('{}')
+      }
+
+      return [2, 'never', { 'exceptions': exceptions }]
+    }
+  },
+
+  'requireSpacesInsideParenthesizedExpression': {
+    name: 'space-in-parens',
+    truthy: function (value) {
+      if (value === true) {
+        return [2, 'always']
+      }
+
+      var exceptions = []
+
+      var except = value.allExcept
+
+      if (value.allExcept.indexOf('{') > -1 || except.indexOf('}') > -1) {
+        exceptions.push('{}')
+      }
+
+      return [2, 'always', { 'exceptions': exceptions }]
+    }
   }
 }


Test patch:
diff --git a/test/dictionaries/jscs.test.js b/test/dictionaries/jscs.test.js
index 7be3461..196c3eb 100644
--- a/test/dictionaries/jscs.test.js
+++ b/test/dictionaries/jscs.test.js
@@ -620,8 +620,30 @@ describe('jscs', function () {
       'A', 'B'
     ])
 
-    expect(fn('CLRF')).to.eql(['ArrowFunctionExpression'])
+    expect(fn()).to.eql(['ArrowFunctionExpression'])
 
-    expect(fnBound('LF')).to.eql(['A', 'B', 'ArrowFunctionExpression'])
+    expect(fnBound()).to.eql(['A', 'B', 'ArrowFunctionExpression'])
+  })
+
+  it('converts requireSpacesInsideParenthesizedExpression correctly',
+  function () {
+    var fn = getFn('requireSpacesInsideParenthesizedExpression')
+
+    expect(fn(true)).to.eql([2, 'always'])
+
+    expect(fn({
+      'allExcept': ['{', '}']
+    })).to.eql([2, 'always', { 'exceptions': ['{}'] }])
+  })
+
+  it('converts disallowSpacesInsideParenthesizedExpression correctly',
+  function () {
+    var fn = getFn('disallowSpacesInsideParenthesizedExpression')
+
+    expect(fn(true)).to.eql([2, 'never'])
+
+    expect(fn({
+      'allExcept': ['{', '}']
+    })).to.eql([2, 'never', { 'exceptions': ['{}'] }])
   })
 })
Repository: js-data/js-data (js)

Issue:
`utils.deepEqual` return true with two different Arrays
https://github.com/js-data/js-data/blob/master/src/utils.js#L1507

If two arrays are compared, when the second array **starts with the same datas** than the first one, the function always returns **true**.

`utils.deepEqual( ["a", "b"] ,  ["a", "b", "c", "d", "e"]  )`  returns **true**

```javascript 
a.forEach(function (value, i) {
    _equal = _equal && utils.deepEqual(value, b[i])
    if (!_equal) {
      return false
    }
})
```

Pull request:
Fixes #471
Fixed the bug on equality check for Array raised in #471 

I also used a `for` loop instead of `forEach`, like this comparaison is recursive it can happen a lot, so it should used the fastest `for` possible.

Patch:
diff --git a/src/utils.js b/src/utils.js
index 02f9953..b9f414f 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -1504,12 +1504,14 @@ http://www.js-data.io/v3.0/docs/errors#${code}`
         _equal = _equal && utils.deepEqual(value, a[key])
       })
     } else if (utils.isArray(a) && utils.isArray(b)) {
-      a.forEach(function (value, i) {
-        _equal = _equal && utils.deepEqual(value, b[i])
-        if (!_equal) {
+      if (a.length !== b.length) {
+        return false
+      }
+      for (let i = a.length; i--;) {
+        if (!utils.deepEqual(a[i], b[i])) {
           return false
         }
-      })
+      }
     } else {
       return false
     }


Test patch:
diff --git a/test/unit/utils/deepEqual.test.js b/test/unit/utils/deepEqual.test.js
index 35fda15..660eab6 100644
--- a/test/unit/utils/deepEqual.test.js
+++ b/test/unit/utils/deepEqual.test.js
@@ -8,13 +8,19 @@ describe('utils.deepEqual', function () {
 
   it('does deep equal comparison', function () {
     const objA = { name: 'John', age: 90 }
+    const arrA = ['a', 'b', 'c']
+    const arrB = ['a', 'b', 'c', 'd', 'e']
+
     assert.isTrue(utils.deepEqual(2, 2), '2 deep equals 2')
     assert.isTrue(utils.deepEqual('test', 'test'), '"test" deep equals "test"')
     assert.isTrue(utils.deepEqual({}, {}), '{} deep equals {}')
     assert.isTrue(utils.deepEqual(objA, objA), objA + ' deep equals ' + objA)
+    assert.isTrue(utils.deepEqual(arrA, arrA), 'arrA deep equals arrA')
+
     assert.isFalse(utils.deepEqual(1, 2), '1 does not strict equal 2')
     assert.isFalse(utils.deepEqual(1, '1'), '1 does not strict equal "1"')
     assert.isFalse(utils.deepEqual('foo', 'bar'), '"foo" does not equal "bar')
+    assert.isFalse(utils.deepEqual(arrA, arrB), 'arrA does not deep equal arrB')
   })
 
   it('compares identical objects', function () {
Repository: PHP-CS-Fixer/PHP-CS-Fixer (php)

Issue:
SingleImportPerStatementFixer does not temove braces when only single item
### Feature request

```php
use Foo\Bar\{Baz};
```

On the one hand this is a single import but on the other hand the braces `{}` denote this is a group (of one item). I think this fixer could handle this and remove the braces.

### Link to Discussion where feature request was formed

_No response_

### Contribution Checks

- [ ] I have verified if this feature request was already discussed
- [ ] I am familiar with ["Feature or bug?"](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/feature-or-bug.rst)

Pull request:
feat: `SingleImportPerStatementFixer` - remove braces for single import
fixes #8146

Patch:
diff --git a/src/Fixer/Import/SingleImportPerStatementFixer.php b/src/Fixer/Import/SingleImportPerStatementFixer.php
index a344fe441..274affe26 100644
--- a/src/Fixer/Import/SingleImportPerStatementFixer.php
+++ b/src/Fixer/Import/SingleImportPerStatementFixer.php
@@ -214,10 +214,6 @@ private function fixGroupUse(Tokens $tokens, int $index, int $endIndex): void
         [$groupPrefix, $groupOpenIndex, $groupCloseIndex, $comment] = $this->getGroupDeclaration($tokens, $index);
         $statements = $this->getGroupStatements($tokens, $groupPrefix, $groupOpenIndex, $groupCloseIndex, $comment);
 
-        if (\count($statements) < 2) {
-            return;
-        }
-
         $tokens->clearRange($index, $groupCloseIndex);
         if ($tokens[$endIndex]->equals(';')) {
             $tokens->clearAt($endIndex);


Test patch:
diff --git a/tests/Fixer/Import/SingleImportPerStatementFixerTest.php b/tests/Fixer/Import/SingleImportPerStatementFixerTest.php
index 1a072fd25..a89323a20 100644
--- a/tests/Fixer/Import/SingleImportPerStatementFixerTest.php
+++ b/tests/Fixer/Import/SingleImportPerStatementFixerTest.php
@@ -282,6 +282,15 @@ public static function provideFixCases(): iterable
             '<?php
 use D\{E,F,};
 use G\{H,I/*1*/,/*2*/};
+',
+        ];
+
+        yield [
+            '<?php
+use A\B;
+',
+            '<?php
+use A\{B};
 ',
         ];
     }
@@ -349,7 +358,7 @@ public static function provideFixPrePHP80Cases(): iterable
 use const some\c\ConstB as D;
 use const some\c\// use.,{}
 ConstC;
-use A\{B};
+use A\B;
 use D\E;
 use D\F;
                 ',