PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: vitalik/django-ninja (python)
Issue: [BUG] `SmallAutoField` missing from `ninja.orm.fields`
**Describe the bug**
`SmallAutoField` missing from `ninja.orm.fields`
If you try to use `create_schema` on a model that has a `SmallAutoField`, you will get:
```
File "/usr/local/lib/python3.12/site-packages/ninja/orm/fields.py", line 144, in get_schema_field
    python_type = TYPES[internal_type]
                  ~~~~~^^^^^^^^^^^^^
```

**Versions (please complete the following information):**
python 3.12
django 5.0.4
ninja 1.1.0
pydantic 2.6.4


Pull request description: Add ORM support for SmallAutoField
Fixes #1186: Adds support for a missing field and corresponding unit test.

Patch:
diff --git a/ninja/orm/fields.py b/ninja/orm/fields.py
index 444e827..bbdf2c5 100644
--- a/ninja/orm/fields.py
+++ b/ninja/orm/fields.py
@@ -65,6 +65,7 @@ TYPES = {
     "PositiveIntegerField": int,
     "PositiveSmallIntegerField": int,
     "SlugField": str,
+    "SmallAutoField": int,
     "SmallIntegerField": int,
     "TextField": str,
     "TimeField": datetime.time,


Test patch:
diff --git a/tests/test_orm_schemas.py b/tests/test_orm_schemas.py
index 07df9fa..5897fba 100644
--- a/tests/test_orm_schemas.py
+++ b/tests/test_orm_schemas.py
@@ -191,24 +191,27 @@ def test_all_fields():
     }
 
 
-def test_bigautofield():
-    class ModelBigAuto(models.Model):
-        bigautofiled = models.BigAutoField(primary_key=True)
+@pytest.mark.parametrize(
+    "field",
+    [
+        models.BigAutoField,
+        models.SmallAutoField,
+    ]
+)
+def test_altautofield(field: type):
+    class ModelAltAuto(models.Model):
+        altautofield = field(primary_key=True)
 
         class Meta:
             app_label = "tests"
 
-    SchemaCls = create_schema(ModelBigAuto)
+    SchemaCls = create_schema(ModelAltAuto)
     # print(SchemaCls.json_schema())
-    assert SchemaCls.json_schema() == {
-        "type": "object",
-        "properties": {
-            "bigautofiled": {
-                "anyOf": [{"type": "integer"}, {"type": "null"}],
-                "title": "Bigautofiled",
-            }
-        },
-        "title": "ModelBigAuto",
+    assert SchemaCls.json_schema()["properties"] == {
+        "altautofield": {
+            "anyOf": [{"type": "integer"}, {"type": "null"}],
+            "title": "Altautofield",
+        }
     }
Repository: vaskoz/dailycodingproblem-go (go)
Issue: Day 95
Good morning! Here's your coding interview problem for today.

This problem was asked by Palantir.

Given a number represented by a list of digits, find the next greater permutation of a number, in terms of lexicographic ordering. If there is not greater permutation possible, return the permutation with the lowest value/ordering.

For example, the list [1,2,3] should return [1,3,2]. The list [1,3,2] should return [2,1,3]. The list [3,2,1] should return [1,2,3].

Can you perform the operation without allocating extra memory (disregarding the input memory)?
Pull request description: Day95
Resolves #198. 

Patch:
diff --git a/README.md b/README.md
index 70585dd..e7a4e92 100644
--- a/README.md
+++ b/README.md
@@ -102,3 +102,4 @@ problems from
 * [Day 90](https://github.com/vaskoz/dailycodingproblem-go/issues/189)
 * [Day 91](https://github.com/vaskoz/dailycodingproblem-go/issues/192)
 * [Day 92](https://github.com/vaskoz/dailycodingproblem-go/issues/194)
+* [Day 95](https://github.com/vaskoz/dailycodingproblem-go/issues/198)
diff --git a/day95/problem.go b/day95/problem.go
new file mode 100644
index 0000000..1313ef1
--- /dev/null
+++ b/day95/problem.go
@@ -0,0 +1,27 @@
+package day95
+
+import "sort"
+
+// NextPermutation reorders the digits for the next
+// greater permutation.
+func NextPermutation(digits []int) {
+	var i int
+	for i = len(digits) - 1; i > 0; i-- {
+		if digits[i] > digits[i-1] {
+			break
+		}
+	}
+	if i == 0 {
+		sort.Ints(digits)
+		return
+	}
+	x := digits[i-1]
+	min := i
+	for j := i + 1; j < len(digits); j++ {
+		if digits[j] > x && digits[j] < digits[min] {
+			min = j
+		}
+	}
+	digits[i-1], digits[min] = digits[min], digits[i-1]
+	sort.Ints(digits[i:])
+}


Test patch:
diff --git a/day95/problem_test.go b/day95/problem_test.go
new file mode 100644
index 0000000..1f3f619
--- /dev/null
+++ b/day95/problem_test.go
@@ -0,0 +1,36 @@
+package day95
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	in, out []int
+}{
+	{[]int{1, 2, 3}, []int{1, 3, 2}},
+	{[]int{1, 3, 2}, []int{2, 1, 3}},
+	{[]int{3, 2, 1}, []int{1, 2, 3}},
+}
+
+func TestNextPermutation(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		in := make([]int, len(tc.in))
+		copy(in, tc.in)
+		NextPermutation(in)
+		if !reflect.DeepEqual(in, tc.out) {
+			t.Errorf("Expected %v got %v", tc.out, in)
+		}
+	}
+}
+
+func BenchmarkNextPermutation(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			in := make([]int, len(tc.in))
+			copy(in, tc.in)
+			NextPermutation(in)
+		}
+	}
+}
Repository: sanic-org/sanic-ext (python)
Issue: [Bug] Static and Class methods are added to the example request bodies
**Describe the bug**
Class / static methods are included in the example request body.

**To Reproduce**
Create a dataclass add a class/static method to it and set it to a requestbody with `@openapi.body({"application/json": Class})`

**Expected behavior**
We pass an instance of a class so class and static methods should not be in the documentation. 

**Environment (please complete the following information):**
 - OS: Pop OS 22.04
 - Browser curl
 - Version 22.3.1
Pull request description: Proper check of Pydantic properties on OAS
Closes #80 

Patch:
diff --git a/sanic_ext/extensions/openapi/types.py b/sanic_ext/extensions/openapi/types.py
index 191132d..76a9c70 100644
--- a/sanic_ext/extensions/openapi/types.py
+++ b/sanic_ext/extensions/openapi/types.py
@@ -2,7 +2,7 @@ import json
 import uuid
 from datetime import date, datetime, time
 from enum import Enum
-from inspect import getmembers, isfunction
+from inspect import getmembers, isfunction, ismethod
 from typing import (
     Any,
     Dict,
@@ -312,7 +312,7 @@ def _properties(value: object) -> Dict:
         fields = {
             x: val
             for x, v in getmembers(value, _is_property)
-            if (val := _extract(v))
+            if (val := _extract(v)) and x in value.__dict__
         }
     except AttributeError:
         fields = {}
@@ -333,4 +333,4 @@ def _extract(item):
 
 
 def _is_property(item):
-    return not isfunction(item)
+    return not isfunction(item) and not ismethod(item)
diff --git a/setup.cfg b/setup.cfg
index f75f88a..c1fd63b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = sanic-ext
-version = 22.6.0
+version = 22.6.1
 url = http://github.com/sanic-org/sanic-ext/
 license = MIT
 author = Sanic Community


Test patch:
diff --git a/tests/extensions/openapi/test_schema.py b/tests/extensions/openapi/test_schema.py
index c6033a7..079f86b 100644
--- a/tests/extensions/openapi/test_schema.py
+++ b/tests/extensions/openapi/test_schema.py
@@ -12,16 +12,26 @@ def test_schema_list():
         list1: List[int]
         list2: list[int]
 
-        def no_show(self) -> None:
-            ...
-
         @property
         def show(self) -> bool:
             return True
 
+        def no_show_method(self) -> None:
+            ...
+
+        @classmethod
+        def no_show_classmethod(self) -> None:
+            ...
+
+        @staticmethod
+        def no_show_staticmethod() -> None:
+            ...
+
     schema = Schema.make(Foo)
     serialized = schema.serialize()
-    assert "no_show" not in serialized
+    assert "no_show_method" not in serialized
+    assert "no_show_classmethod" not in serialized
+    assert "no_show_staticmethod" not in serialized
     assert serialized == {
         "type": "object",
         "properties": {
Repository: OceanParcels/parcels (python)
Issue: cannot define variable dt inside kernel
It is currently not possible to define a variable dt inside of a kernel, e.g.:

```
def kernel(particle, fieldset, time): 
    dt = particle.dt
    u,v = fieldset.UV[time, particle.depth, particle.lat, particle.lon]
    particle.lon += u * dt

```

changing the name dt to e.g. dtt does work however:
```
def kernel(particle, fieldset, time): 
    dtt = particle.dt
    u,v = fieldset.UV[time, particle.depth, particle.lat, particle.lon]
    particle.lon += u * dtt

```



Pull request description: Allowing dt to be a variable in kernel defintion
This fixes #615, and was introduced when `dt` was removed as special variable from kernel definition in v2

Patch:
diff --git a/parcels/codegenerator.py b/parcels/codegenerator.py
index 27a5cffa..80ba2eda 100644
--- a/parcels/codegenerator.py
+++ b/parcels/codegenerator.py
@@ -357,7 +357,7 @@ class KernelGenerator(ast.NodeVisitor):
     attriibute on nodes in the Python AST."""
 
     # Intrinsic variables that appear as function arguments
-    kernel_vars = ['particle', 'fieldset', 'time', 'dt', 'output_time', 'tol']
+    kernel_vars = ['particle', 'fieldset', 'time', 'output_time', 'tol']
     array_vars = []
 
     def __init__(self, fieldset, ptype):


Test patch:
diff --git a/tests/test_kernel_language.py b/tests/test_kernel_language.py
index b09e851c..e914926c 100644
--- a/tests/test_kernel_language.py
+++ b/tests/test_kernel_language.py
@@ -128,6 +128,16 @@ def test_nested_if(fieldset, mode):
     assert np.allclose([pset[0].p0, pset[0].p1], [0, 1])
 
 
+@pytest.mark.parametrize('mode', ['scipy', 'jit'])
+def test_dt_as_variable_in_kernel(fieldset, mode):
+    pset = ParticleSet(fieldset, pclass=ptype[mode], lon=0, lat=0)
+
+    def kernel(particle, fieldset, time):
+        dt = 1.  # noqa
+
+    pset.execute(kernel, endtime=10, dt=1.)
+
+
 def test_parcels_tmpvar_in_kernel(fieldset):
     """Tests for error thrown if vartiable with 'tmp' defined in custom kernel"""
     error_thrown = False
Repository: spatie/data-transfer-object (php)
Issue: Cannot use positional argument after named argument during unpacking
I found following edge case:

```php
class IssueDTO extends DataTransferObject
{
    public ?ReactionRollupDTO $reactions;
}
```

```php
class ReactionRollupDTO extends DataTransferObject
{
    public int $total_count;

    #[MapFrom('+1')]
    #[MapTo('+1')]
    public int $plus_one;

    #[MapFrom('-1')]
    #[MapTo('-1')]
    public int $minus_one;

    public int $laugh;
}
```

```php
$reactions = [
    'total_count' => 0,
    '+1' => 0,
    -1 => 0,
    'laugh' => 0,
];

// works as expected
dump(new ReactionRollupDTO($reactions));

$issue = [
    'reactions' => $reactions,
];

// Error: Cannot use positional argument after named argument during unpacking
dump(new IssueDTO($issue));
```

Example is how `json_decode` decodes json by default. Not exactly ideal but it is what it is..

I'm aware this could propably be handled with custom caster but my question is if this is something that should be handled in package?
Pull request description: Fix positional after named
This pull request fixes a bug that causes properties mapped from a positional argument to fail after the argument array is unpacked into the casted child DTO. This fixes #298.

Patch:
diff --git a/src/Casters/DataTransferObjectCaster.php b/src/Casters/DataTransferObjectCaster.php
index 4f1913e..6a0383d 100644
--- a/src/Casters/DataTransferObjectCaster.php
+++ b/src/Casters/DataTransferObjectCaster.php
@@ -20,6 +20,6 @@ class DataTransferObjectCaster implements Caster
             }
         }
 
-        return new $this->classNames[0](...$value);
+        return new $this->classNames[0]($value);
     }
 }


Test patch:
diff --git a/tests/MapFromTest.php b/tests/MapFromTest.php
index 240cd8e..cbec422 100644
--- a/tests/MapFromTest.php
+++ b/tests/MapFromTest.php
@@ -102,4 +102,44 @@ class MapFromTest extends TestCase
         $this->assertFalse($dto->isPublic);
         $this->assertEquals(42, $dto->randomInt);
     }
+
+    /** @test */
+    public function dto_can_have_numeric_keys()
+    {
+        $data = [
+            'title' => 'Hello world',
+            '0' => 10,
+        ];
+
+        $dto = new DTOInner($data);
+
+        $this->assertEquals('Hello world', $dto->title);
+        $this->assertEquals(10, $dto->zero);
+    }
+
+    /** @test */
+    public function dto_can_have_numeric_keys_in_nested_dto()
+    {
+        $data = [
+            'innerDTO' => [
+                'title' => 'Hello world',
+                '0' => 10,
+            ],
+        ];
+
+        $dtoOuter = new class ($data) extends DataTransferObject {
+            public DTOInner $innerDTO;
+        };
+
+        $this->assertEquals('Hello world', $dtoOuter->innerDTO->title);
+        $this->assertEquals(10, $dtoOuter->innerDTO->zero);
+    }
+}
+
+class DTOInner extends DataTransferObject
+{
+    public string $title;
+
+    #[MapFrom('0')]
+    public int $zero;
 }
Repository: go-critic/go-critic (go)
Issue: unlambda: false positive 
```go
func New(options ...string) error {
	return nil
}

var NewWithTimeout = func(options ...string) error {
	return New(append(options, "timeout")...)
}
```

```
unlambda: replace `func(options ...string) error {
        return New(append(options, "timeout")...)
}` with `New` (gocritic)
var NewWithTimeout = func(options ...string) error {
                     ^

```

Pull request description: checkers/unlambda: correct calculation amount args.
Count args of CallExpr.

Example: `a(b(1,2))` will be 2, not 1.

fixes #1362

Patch:
diff --git a/checkers/unlambda_checker.go b/checkers/unlambda_checker.go
index bcfe5a0..0401bf5 100644
--- a/checkers/unlambda_checker.go
+++ b/checkers/unlambda_checker.go
@@ -91,7 +91,7 @@ func (c *unlambdaChecker) VisitExpr(x ast.Expr) {
 		}
 	}
 
-	if len(result.Args) == n {
+	if c.lenArgs(result.Args) == n {
 		c.warn(fn, callable)
 	}
 }
@@ -99,3 +99,20 @@ func (c *unlambdaChecker) VisitExpr(x ast.Expr) {
 func (c *unlambdaChecker) warn(cause ast.Node, suggestion string) {
 	c.ctx.Warn(cause, "replace `%s` with `%s`", cause, suggestion)
 }
+
+func (c *unlambdaChecker) lenArgs(args []ast.Expr) int {
+	lenArgs := len(args)
+
+	for _, arg := range args {
+		callExp, ok := arg.(*ast.CallExpr)
+		if !ok {
+			continue
+		}
+
+		// Don't count function call. only args.
+		lenArgs--
+		lenArgs += c.lenArgs(callExp.Args)
+	}
+
+	return lenArgs
+}


Test patch:
diff --git a/checkers/testdata/unlambda/negative_tests.go b/checkers/testdata/unlambda/negative_tests.go
index 218c63f..6a7357e 100644
--- a/checkers/testdata/unlambda/negative_tests.go
+++ b/checkers/testdata/unlambda/negative_tests.go
@@ -128,3 +128,13 @@ func varFunc() {
 	var varfunc func(x int) int
 	_ = func(x int) int { return varfunc(x) }
 }
+
+func wrap(options ...string) error { return nil }
+
+var _ = func(options ...string) error {
+	return wrap(append(options, "timeout")...)
+}
+
+var _ = func(options ...string) error {
+	return wrap(append(append(append(options, "timeout")))...)
+}
diff --git a/checkers/testdata/unlambda/positive_tests.go b/checkers/testdata/unlambda/positive_tests.go
index 204f63d..6ef2cc6 100644
--- a/checkers/testdata/unlambda/positive_tests.go
+++ b/checkers/testdata/unlambda/positive_tests.go
@@ -48,6 +48,9 @@ func variadicTest() {
 
 	_ = func(x int, ys ...int) int { return variadicInt(1, 2) }
 	_ = func(x int, y int, _ ...int) int { return variadicInt(x, y) }
+
+	/*! replace `func(options ...string) error { return wrap(append(append(append(options)))...) }` with `wrap` */
+	_ = func(options ...string) error { return wrap(append(append(append(options)))...) }
 }
 
 func variadicInterfaces(x int, y interface{}, ys ...interface{}) int { return 0 }