nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: elliotchance/c2go
Pull request #853 (2020-04-13 14:58:14)

ast: support forward declarations of enums
enums can be forward-declared.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/elliotchance/c2go/853)
<!-- Reviewable:end -->


paulsmith: Actually I think it is more accurate to say "incomplete enum types" in C -- forward-declaration of enums appears to be a C++11 thing. https://gcc.gnu.org/onlinedocs/gcc/Incomplete-Enums.html#Incomplete-Enums

Patch:
diff --git a/ast/enum_decl.go b/ast/enum_decl.go
index 2e30877..10ff22d 100644
--- a/ast/enum_decl.go
+++ b/ast/enum_decl.go
@@ -7,6 +7,7 @@ import (
 // EnumDecl is node represents a enum declaration.
 type EnumDecl struct {
 	Addr       Address
+	Prev       Address
 	Pos        Position
 	Position2  string
 	Name       string
@@ -15,12 +16,13 @@ type EnumDecl struct {
 
 func parseEnumDecl(line string) *EnumDecl {
 	groups := groupsFromRegex(
-		`<(?P<position>.*)>(?P<position2> .+:\d+)?(?P<name>.*)`,
+		`(?:prev (?P<prev>0x[0-9a-f]+) )?<(?P<position>.*)>(?P<position2> .+:\d+)?(?P<name>.*)`,
 		line,
 	)
 
 	return &EnumDecl{
 		Addr:       ParseAddress(groups["address"]),
+		Prev:       ParseAddress(groups["prev"]),
 		Pos:        NewPositionFromString(groups["position"]),
 		Position2:  groups["position2"],
 		Name:       strings.TrimSpace(groups["name"]),


Test patch:
diff --git a/ast/enum_decl_test.go b/ast/enum_decl_test.go
index 94296c0..2e89e9b 100644
--- a/ast/enum_decl_test.go
+++ b/ast/enum_decl_test.go
@@ -20,6 +20,14 @@ func TestEnumDecl(t *testing.T) {
 			Name:       "week",
 			ChildNodes: []Node{},
 		},
+		`0x5570ff477388 prev 0x5570ff445c40 <line:1030:1, line:1034:1> line:1030:6 cb_assign_type`: &EnumDecl{
+			Addr:       0x5570ff477388,
+			Prev:       0x5570ff445c40,
+			Pos:        NewPositionFromString("line:1030:1, line:1034:1"),
+			Position2:  " line:1030:6",
+			Name:       "cb_assign_type",
+			ChildNodes: []Node{},
+		},
 	}
 
 	runNodeTests(t, nodes)
Repository: atlassian/gostatsd
Pull request #373 (2021-07-26 22:03:59)

bump alpine from version 3.10 to 3.13
Hi,

I ran the tests/benchmarking and it all seemed fine. (build is also working now yey, and passed) Let me know if there's anything else I need to do.

Bumping the version to fix vulnerabilities including (https://snyk.io/test/docker/alpine%3A3.10.0#SNYK-ALPINE310-OPENSSL-587954).

-cfei


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce25aeb..371237b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+29.0.1
+------
+- Update to Alpine 3.13
+
 29.0.0
 ------
 - Support for ARM64 docker image
diff --git a/build/Dockerfile b/build/Dockerfile
index a746617..e4493aa 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.10
+FROM alpine:3.13
 
 RUN apk --no-cache add \
     ca-certificates


Test patch:
diff --git a/cmd/tester/Dockerfile b/cmd/tester/Dockerfile
index c0a2cf6..c0c5fbe 100644
--- a/cmd/tester/Dockerfile
+++ b/cmd/tester/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.10
+FROM alpine:3.13
 RUN apk --no-cache add \
 	ca-certificates
 ADD statsd-tester-linux /bin/statsd-tester
Repository: atlassian/gostatsd
Pull request #391 (2021-09-08 06:11:21)

change to distroless image 
as a result of https://github.com/atlassian/gostatsd/issues/390


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f2cdbed..ed7f21d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+30.0.0
+------
+- Change to distroless/static image to reduce dependencies
+
 29.0.2
 ------
 - Update to Alpine 3.14.1
diff --git a/build/Dockerfile b/build/Dockerfile
index 0f0edce..5b3cfa6 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,7 +1,4 @@
-FROM alpine:3.14.1
-
-RUN apk --no-cache add \
-    ca-certificates
+FROM gcr.io/distroless/static
 
 ADD bin/linux/gostatsd /bin/gostatsd
 


Test patch:
diff --git a/cmd/tester/Dockerfile b/cmd/tester/Dockerfile
index 9ecd412..9a47dd2 100644
--- a/cmd/tester/Dockerfile
+++ b/cmd/tester/Dockerfile
@@ -1,5 +1,3 @@
-FROM alpine:3.14.1
-RUN apk --no-cache add \
-	ca-certificates
+FROM gcr.io/distroless/static
 ADD statsd-tester-linux /bin/statsd-tester
 ENTRYPOINT ["statsd-tester"]
Repository: atlassian/gostatsd
Pull request #392 (2021-09-09 01:47:30)

change back to alpine base image
we are sorry we ever left, take us back alpine


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed7f21d..8d2bffc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+31.0.0
+------
+- Change back to alpine, bump to 3.14.2
+
 30.0.0
 ------
 - Change to distroless/static image to reduce dependencies
diff --git a/build/Dockerfile b/build/Dockerfile
index 5b3cfa6..b7e5e77 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,4 +1,7 @@
-FROM gcr.io/distroless/static
+FROM alpine:3.14.2
+
+RUN apk --no-cache add \
+    ca-certificates
 
 ADD bin/linux/gostatsd /bin/gostatsd
 


Test patch:
diff --git a/cmd/tester/Dockerfile b/cmd/tester/Dockerfile
index 9a47dd2..a7334b5 100644
--- a/cmd/tester/Dockerfile
+++ b/cmd/tester/Dockerfile
@@ -1,3 +1,5 @@
-FROM gcr.io/distroless/static
+FROM alpine:3.14.2
+RUN apk --no-cache add \
+    ca-certificates
 ADD statsd-tester-linux /bin/statsd-tester
 ENTRYPOINT ["statsd-tester"]
Repository: atlassian/gostatsd
Pull request #546 (2022-08-09 01:34:05)

bump alpine to 3.15.5 for cmd/tester and update change log
bump alpine to [3.15.5](https://alpinelinux.org/posts/Alpine-3.13.11-3.14.7-3.15.5-released.html) in cmd/tester which fixed [CVE-2022-2097](https://security.alpinelinux.org/vuln/CVE-2022-2097)

Updated change log


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ee1fce..77312d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+35.0.1
+------
+- Update to Alpine 3.15.5
+
 35.0.0
 ------
 - Adds a statsdSource tag to the New Relic backend, see [BACKENDS.md](BACKENDS.md) for details.


Test patch:
diff --git a/cmd/tester/Dockerfile b/cmd/tester/Dockerfile
index 03ba82d..8f84b3e 100644
--- a/cmd/tester/Dockerfile
+++ b/cmd/tester/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.15.4
+FROM alpine:3.15.5
 RUN apk --no-cache add \
     ca-certificates
 ADD statsd-tester-linux /bin/statsd-tester
Repository: atlassian/gostatsd
Pull request #623 (2023-05-19 00:47:34)

Bump alpine to 3.18.0


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80fa667..2ce5ba7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+35.2.1
+------
+- Bump aline from 3.17.2 to 3.18.0 in /cmd/tester and /build/
+
 35.2.0
 ------
 - Adds more meaningful healthchecks
diff --git a/build/Dockerfile b/build/Dockerfile
index d31b0de..b8b7fe0 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.17.2
+FROM alpine:3.18.0
 
 RUN apk --no-cache add \
     ca-certificates


Test patch:
diff --git a/cmd/tester/Dockerfile b/cmd/tester/Dockerfile
index e7a3a13..09caf09 100644
--- a/cmd/tester/Dockerfile
+++ b/cmd/tester/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.17.2
+FROM alpine:3.18.0
 RUN apk --no-cache add \
     ca-certificates
 ADD statsd-tester-linux /bin/statsd-tester
Repository: elliotchance/pie
Pull request #184 (2023-01-04 06:24:49)

add Chunk to v2
Chunk splits the input and returns multi slices whose length equals chunkLength, except for the last slice which may contain fewer elements.

ps: Chunk returns  [][]T, so it can not be contained by the chain which type is []T.


Patch:
diff --git a/v2/chunk.go b/v2/chunk.go
new file mode 100644
index 0000000..84d4f5b
--- /dev/null
+++ b/v2/chunk.go
@@ -0,0 +1,39 @@
+package pie
+
+// Chunk splits the input and returns multi slices whose length equals chunkLength,
+// except for the last slice which may contain fewer elements.
+//
+// Examples:
+//
+//   Chunk([1, 2, 3], 4) => [ [1, 2, 3] ]
+//   Chunk([1, 2, 3], 3) => [ [1, 2, 3] ]
+//   Chunk([1, 2, 3], 2) => [ [1, 2], [3] ]
+//   Chunk([1, 2, 3], 1) => [ [1], [2], [3] ]
+//   Chunk([], 1)        => [ [] ]
+//   Chunk([1, 2, 3], 0) => panic: chunkLength should be greater than 0
+func Chunk[T any](ss []T, chunkLength int) [][]T {
+	if chunkLength <= 0 {
+		panic("chunkLength should be greater than 0")
+	}
+
+	result := make([][]T, 0)
+	l := len(ss)
+	if l == 0 {
+		return result
+	}
+
+	var step = l / chunkLength
+	if step == 0 {
+		result = append(result, ss)
+		return result
+	}
+	var remain = l % chunkLength
+	for i := 0; i < step; i++ {
+		result = append(result, ss[i*chunkLength:(i+1)*chunkLength])
+	}
+	if remain != 0 {
+		result = append(result, ss[step*chunkLength:l])
+	}
+
+	return result
+}


Test patch:
diff --git a/v2/chunk_test.go b/v2/chunk_test.go
new file mode 100644
index 0000000..552cc4c
--- /dev/null
+++ b/v2/chunk_test.go
@@ -0,0 +1,28 @@
+package pie
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+var chunkTests = []struct {
+	ss          []int
+	chunkLength int
+	expected    [][]int
+}{
+	{nil, 1, [][]int{}},
+	{[]int{}, 1, [][]int{}},
+	{[]int{1, 2, 3}, 4, [][]int{{1, 2, 3}}},
+	{[]int{1, 2, 3}, 3, [][]int{{1, 2, 3}}},
+	{[]int{1, 2, 3}, 2, [][]int{{1, 2}, {3}}},
+	{[]int{1, 2, 3}, 1, [][]int{{1}, {2}, {3}}},
+}
+
+func TestChunk(t *testing.T) {
+	for _, test := range chunkTests {
+		t.Run("", func(t *testing.T) {
+			assert.Equal(t, test.expected, Chunk(test.ss, test.chunkLength))
+		})
+	}
+}
Repository: elliotchance/pie
Pull request #187 (2023-02-10 12:46:44)

added method `Flat`


Patch:
diff --git a/v2/flat.go b/v2/flat.go
new file mode 100644
index 0000000..7454f98
--- /dev/null
+++ b/v2/flat.go
@@ -0,0 +1,16 @@
+package pie
+
+// Flat flattens the two-dimensional slice into one-dimensional slice.
+// Slices of zero-length are ignored.
+//
+// Examples:
+//
+//	Flat([[100], [101, 102], [102, 103]])   => [100, 101, 102, 102, 103]
+//	Flat([nil, [101, 102], []])             => [101, 102]
+func Flat[T any](ss [][]T) (ss2 []T) {
+	for _, s := range ss {
+		ss2 = append(ss2, s...)
+	}
+
+	return ss2
+}


Test patch:
diff --git a/v2/flat_test.go b/v2/flat_test.go
new file mode 100644
index 0000000..a1ce642
--- /dev/null
+++ b/v2/flat_test.go
@@ -0,0 +1,42 @@
+package pie_test
+
+import (
+	"testing"
+
+	"github.com/elliotchance/pie/v2"
+	"github.com/stretchr/testify/assert"
+)
+
+var flatTests = []struct {
+	ss   [][]float64
+	flat []float64
+}{
+	{
+		nil,
+		nil,
+	},
+	{
+		[][]float64{{100}},
+		[]float64{100},
+	},
+	{
+		[][]float64{{100}, {101, 102}, {102, 103}},
+		[]float64{100, 101, 102, 102, 103},
+	},
+	{
+		[][]float64{nil, {101, 102}, {}},
+		[]float64{101, 102},
+	},
+	{
+		[][]float64{nil, nil},
+		nil,
+	},
+}
+
+func TestFlat(t *testing.T) {
+	for _, test := range flatTests {
+		t.Run("", func(t *testing.T) {
+			assert.Equal(t, test.flat, pie.Flat(test.ss))
+		})
+	}
+}
Repository: elliotchance/pie
Pull request #189 (2023-02-27 11:53:33)

`GroupBy` function
This PR resolves issue #188.


Patch:
diff --git a/v2/groupby.go b/v2/groupby.go
new file mode 100644
index 0000000..8230483
--- /dev/null
+++ b/v2/groupby.go
@@ -0,0 +1,30 @@
+package pie
+
+// GroupBy groups slice elements by key returned by getKey function for each
+// slice element.
+//
+// It returns a map in which slices of elements of original slice are matched
+// to keys defined by getKey function. It returns non-nil map, if empty or nil
+// slice is passed.
+//
+// For example, if you want to group integers by their remainder from division
+// by 5, you can use this function as follows:
+//
+//	_ = pie.GroupBy(
+//	    []int{23, 76, 37, 11, 23, 47},
+//	    func(num int) int {
+//	        return num % 5
+//	    },
+//	)
+//
+// In above case map {1:[76, 11], 2:[37, 47], 3:[23, 23]} is returned.
+func GroupBy[T comparable, U any](values []U, getKey func(U) T) map[T][]U {
+	groups := make(map[T][]U)
+
+	for _, val := range values {
+		key := getKey(val)
+		groups[key] = append(groups[key], val)
+	}
+
+	return groups
+}


Test patch:
diff --git a/v2/groupby_test.go b/v2/groupby_test.go
new file mode 100644
index 0000000..668205f
--- /dev/null
+++ b/v2/groupby_test.go
@@ -0,0 +1,57 @@
+package pie_test
+
+import (
+	"testing"
+
+	"github.com/elliotchance/pie/v2"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestGroupBy(t *testing.T) {
+	type Room int
+
+	const (
+		Kitchen Room = iota + 1
+		Bedroom
+		Lounge
+	)
+
+	type Item struct {
+		room Room
+		name string
+	}
+
+	var (
+		bed     = Item{room: Bedroom, name: "bed"}
+		table   = Item{room: Kitchen, name: "table"}
+		toaster = Item{room: Kitchen, name: "toaster"}
+		pillow  = Item{room: Bedroom, name: "pillow"}
+		sofa    = Item{room: Lounge, name: "sofa"}
+	)
+
+	groups := pie.GroupBy(
+		[]Item{
+			bed,
+			table,
+			toaster,
+			pillow,
+			sofa,
+		},
+		func(item Item) Room {
+			return item.room
+		},
+	)
+
+	assert.Equal(
+		t,
+		map[Room][]Item{
+			Kitchen: {table, toaster},
+			Bedroom: {bed, pillow},
+			Lounge:  {sofa},
+		},
+		groups,
+	)
+
+	groups = pie.GroupBy(nil, func(item Item) Room { return item.room })
+	assert.Equal(t, map[Room][]Item{}, groups)
+}