PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 332
Good morning! Here's your coding interview problem for today.

This problem was asked by Jane Street.

Given integers `M` and `N`, write a program that counts how many positive integer pairs `(a, b)` satisfy the following conditions:
```
a + b = M
a XOR b = N
```

Pull request:
Day332
Resolves #669.

Patch:
diff --git a/README.md b/README.md
index f87cbd5..eb2a77e 100644
--- a/README.md
+++ b/README.md
@@ -331,6 +331,7 @@ problems from
 * [Day 324](https://github.com/vaskoz/dailycodingproblem-go/issues/658)
 * [Day 325](https://github.com/vaskoz/dailycodingproblem-go/issues/660)
 * [Day 326](https://github.com/vaskoz/dailycodingproblem-go/issues/661)
+* [Day 332](https://github.com/vaskoz/dailycodingproblem-go/issues/669)
 * [Day 333](https://github.com/vaskoz/dailycodingproblem-go/issues/668)
 * [Day 337](https://github.com/vaskoz/dailycodingproblem-go/issues/674)
 * [Day 338](https://github.com/vaskoz/dailycodingproblem-go/issues/675)
diff --git a/day332/problem.go b/day332/problem.go
new file mode 100644
index 0000000..dd2466e
--- /dev/null
+++ b/day332/problem.go
@@ -0,0 +1,24 @@
+package day332
+
+// Pair is a set of the A and B values that satisfy
+// the requirements below.
+type Pair struct {
+	A, B int
+}
+
+// PositiveIntegerPairs returns all candidates
+// that satisfy the following conditions:
+// a + b = M
+// a XOR b = N
+func PositiveIntegerPairs(m, n int) []Pair {
+	var pairs []Pair
+
+	for a := 0; a < (m/2)+1; a++ {
+		b := m - a
+		if a^b == n {
+			pairs = append(pairs, Pair{A: a, B: b})
+		}
+	}
+
+	return pairs
+}


Test patch:
diff --git a/day332/problem_test.go b/day332/problem_test.go
new file mode 100644
index 0000000..fb7be04
--- /dev/null
+++ b/day332/problem_test.go
@@ -0,0 +1,35 @@
+package day332
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	m, n     int
+	expected []Pair
+}{
+	{
+		100, 4,
+		[]Pair{{48, 52}},
+	},
+}
+
+func TestPositiveIntegerPairs(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if pairs := PositiveIntegerPairs(tc.m, tc.n); !reflect.DeepEqual(pairs, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, pairs)
+		}
+	}
+}
+
+func BenchmarkPositiveIntegerPairs(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			PositiveIntegerPairs(tc.m, tc.n)
+		}
+	}
+}
Repository: platers/obsidian-linter (ts)

Issue:
Bug: The formatting result is incorrect when the image has a description and size attributes.
## Describe the Bug

The formatting result is incorrect when the image has a description and size attributes.

## How to Reproduce

``` markdown
![[流浪地球-1.webp|image title|600]]
```
after formatting
```markdown
![[流浪地球 -1.webp|image title|600]]
```
added  a space between CJK character "流浪地球" and  "-1.webp"
but no such this file.

## Expected Behavior

Expected output if applicable:

do not add space between Chinese and numbers
``` markdown
![[流浪地球-1.webp|image title|600]]
```

## Screenshots

https://user-images.githubusercontent.com/4202032/230772115-00052d28-79c6-463c-96c1-8477951262c5.mp4


## Additional Context

The related issue: https://github.com/platers/obsidian-linter/issues/583


Pull request:
Make Sure that Wiki Images with Alt and Size Specified Are Ignored for CJK and English Character Spaces
Fixes #681 

Changes Made:
- Allowed the regex for wiki links to include an option for size as well
- Added a UT for the scenario in question

Patch:
diff --git a/src/utils/regex.ts b/src/utils/regex.ts
index 310a3fd..97c7510 100644
--- a/src/utils/regex.ts
+++ b/src/utils/regex.ts
@@ -10,7 +10,7 @@ export const tildeBlockRegexTemplate = fencedRegexTemplate.replaceAll('X', '~');
 export const indentedBlockRegex = '^((\t|( {4})).*\n)+';
 export const codeBlockRegex = new RegExp(`${backtickBlockRegexTemplate}|${tildeBlockRegexTemplate}|${indentedBlockRegex}`, 'gm');
 // based on https://stackoverflow.com/a/26010910/8353749
-export const wikiLinkRegex = /(!?)\[{2}([^\][\n|]+)(\|([^\][\n|]+))?\]{2}/g;
+export const wikiLinkRegex = /(!?)\[{2}([^\][\n|]+)(\|([^\][\n|]+))?(\|([^\][\n|]+))?\]{2}/g;
 // based on https://davidwells.io/snippets/regex-match-markdown-links
 export const genericLinkRegex = /(!?)\[([^[]*)\](\(.*\))/g;
 export const tagWithLeadingWhitespaceRegex = /(\s|^)(#[^\s#;.,><?!=+]+)/g;


Test patch:
diff --git a/__tests__/space-between-chinese-japanese-or-korean-and-english-or-numbers.test.ts b/__tests__/space-between-chinese-japanese-or-korean-and-english-or-numbers.test.ts
index 47eb202..7cc5a5a 100644
--- a/__tests__/space-between-chinese-japanese-or-korean-and-english-or-numbers.test.ts
+++ b/__tests__/space-between-chinese-japanese-or-korean-and-english-or-numbers.test.ts
@@ -113,5 +113,14 @@ ruleTest({
         <u>自己想说的</u>
       `,
     },
+    { // accounts for https://github.com/platers/obsidian-linter/issues/681
+      testName: 'Make sure that wiki links with their size specified are unaffected',
+      before: dedent`
+        ![[流浪地球-1.webp|image title|600]]
+      `,
+      after: dedent`
+        ![[流浪地球-1.webp|image title|600]]
+      `,
+    },
   ],
 });
Repository: MyreMylar/pygame_gui (python)

Issue:
UITextEntryLine acceps a Tuple in relative_rect but crashes since its expecting a pygame.Rect
UITextEntryLine acceps a Tuple in relative_rect but crashes since its expecting a pygame.Rect by calling its .size attribute.
```py
AttributeError: 'Tuple' object has no attribute 'size'
```
Steps to reproduce the behaviour:
1. Pass a Tuple in the relative_rect attribute of pygame_gui.elements.UITextEntryLine.

The element should handle correctly the data type of relative_rect and not try to get its .size attribute since it is not a pygame.Rect.

 - OS: Linux Mint 21.2 x86_64
 - Pygame GUI version e.g. 0.6.9
 - Pygame version: 2.4.1



Pull request:
Move call to rect.size to after rect is created.
fixes #547

Patch:
diff --git a/pygame_gui/core/ui_element.py b/pygame_gui/core/ui_element.py
index 5f24382..8a27777 100644
--- a/pygame_gui/core/ui_element.py
+++ b/pygame_gui/core/ui_element.py
@@ -62,12 +62,12 @@ class UIElement(GUISprite, IUIElementInterface):
         super().__init__(self.ui_manager.get_sprite_group())
 
         self.minimum_dimensions = (-1, -1)
-        relative_rect.size = self._get_clamped_to_minimum_dimensions(relative_rect.size)
 
         if isinstance(relative_rect, pygame.Rect):
             self.relative_rect = relative_rect.copy()
         else:
             self.relative_rect = pygame.Rect(relative_rect)
+        self.relative_rect.size = self._get_clamped_to_minimum_dimensions(self.relative_rect.size)
         self.rect = self.relative_rect.copy()
 
         self.dynamic_width = True if self.relative_rect.width == -1 else False


Test patch:
diff --git a/tests/test_core/test_ui_element.py b/tests/test_core/test_ui_element.py
index 148bf2f..01f1bcb 100644
--- a/tests/test_core/test_ui_element.py
+++ b/tests/test_core/test_ui_element.py
@@ -22,6 +22,12 @@ class TestUIElement:
                   starting_height=0,
                   layer_thickness=1)
 
+        UIElement(relative_rect=(0, 0, 50, 50),
+                  manager=None,
+                  container=None,
+                  starting_height=0,
+                  layer_thickness=1)
+
         set_default_manager(None)
 
         with pytest.raises(ValueError, match="Need to create at least one UIManager to create UIElements"):
Repository: effekt-lang/effekt (scala)

Issue:
Allow trailing commas in list literals
```scala
val foo = [ 
  1,
  2,
]
```
should be parseable and not cause a crash in the parser :)

The parser code is here:
https://github.com/effekt-lang/effekt/blob/a9827f5e76522a116802d356b3d8b5d129fa3b5b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala#L990-L996

... and it uses `many` which is a nice candidate for the change (maybe with `manyTrailing` to begin with?) ...
https://github.com/effekt-lang/effekt/blob/a9827f5e76522a116802d356b3d8b5d129fa3b5b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala#L1394-L1408

... then feel free to add a few tests for the new behaviour in [`RecursiveDescentTests.scala`](https://github.com/effekt-lang/effekt/blob/master/effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala) :)

Pull request:
Fixes #873

Patch:
diff --git a/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala
index 9db4032b3..54bf81924 100644
--- a/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala
+++ b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala
@@ -993,7 +993,7 @@ class RecursiveDescent(positions: Positions, tokens: Seq[Token], source: Source)
   }
   def listLiteral(): Term =
     nonterminal:
-      many(expr, `[`, `,`, `]`).foldRight(NilTree) { ConsTree }
+      manyTrailing(expr, `[`, `,`, `]`).foldRight(NilTree) { ConsTree }
 
   private def NilTree: Term =
     Call(IdTarget(IdRef(List(), "Nil")), Nil, Nil, Nil)
@@ -1407,6 +1407,29 @@ class RecursiveDescent(positions: Positions, tokens: Seq[Token], source: Source)
       components.toList
     }
 
+  inline def manyTrailing[T](p: () => T, before: TokenKind, sep: TokenKind, after: TokenKind): List[T] =
+    consume(before)
+    if (peek(after)) {
+      consume(after)
+      Nil
+    } else if (peek(sep)) {
+      consume(sep)
+      consume(after)
+      Nil
+    } else {
+      val components: ListBuffer[T] = ListBuffer.empty
+      components += p()
+      while (peek(sep)) {
+        consume(sep)
+
+        if (!peek(after)) {
+          components += p()
+        }
+      }
+      consume(after)
+      components.toList
+    }
+
 
   // Positions
 


Test patch:
diff --git a/effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala b/effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala
index 5bfb2f798..44731886a 100644
--- a/effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala
+++ b/effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala
@@ -125,6 +125,12 @@ class RecursiveDescentTests extends munit.FunSuite {
     parseExpr("fun() { foo(()) }")
 
     parseExpr("10.seconds")
+
+    parseExpr("[1,2,3]")
+    parseExpr("[3,2,1,]")
+    parseExpr("[]")
+    parseExpr("[,]")
+    intercept[Throwable] { parseExpr("[,1]") }
   }
 
   test("Boxing") {
Repository: uber-go/fx (go)

Issue:
[Question] Why `Invoked` events are logged as error by `ZapLogger`?
Hello, I am using the version `1.14.0` and I noticed that `Invoked` events are logged with error level by the `ZapLogger` even when the event does not carry an error.

https://github.com/uber-go/fx/blob/2f6e9690bc6e231a68c39ca88f8b6c90be62af86/fxevent/zap.go#L93-L101 

Is there any specific reason for it or should it be at level Info in case of no error?

Pull request:
Fix issues in Invoked event
Fix #770. 

`Invoked` event is being logged at error level at all times, even when it has succeeded. This is now being changed to be logged at `Info` level when `Invoke` succeeded.

There was also a discrepancy between the zap logger and the console logger in behavior because the console logger never logged `Invoked` event upon successfully invoking the provided function, so this fixes that behavior to be aligned with zap logger as well.



Patch:
diff --git a/fxevent/console.go b/fxevent/console.go
index 1f5434f..5f16815 100644
--- a/fxevent/console.go
+++ b/fxevent/console.go
@@ -76,7 +76,9 @@ func (l *ConsoleLogger) LogEvent(event Event) {
 		l.logf("INVOKE\t\t%s", e.FunctionName)
 	case *Invoked:
 		if e.Err != nil {
-			l.logf("fx.Invoke(%v) called from:\n%+vFailed: %v", e.FunctionName, e.Trace, e.Err)
+			l.logf("ERROR\t\tfx.Invoke(%v) called from:\n%+vFailed: %v", e.FunctionName, e.Trace, e.Err)
+		} else {
+			l.logf("fx.Invoke(%v) called from:\n%v", e.FunctionName, e.Trace)
 		}
 	case *Stopping:
 		l.logf("%v", strings.ToUpper(e.Signal.String()))
diff --git a/fxevent/zap.go b/fxevent/zap.go
index 9b37b56..daeab9e 100644
--- a/fxevent/zap.go
+++ b/fxevent/zap.go
@@ -91,14 +91,16 @@ func (l *ZapLogger) LogEvent(event Event) {
 		// Do nothing. Will log on Invoked.
 
 	case *Invoked:
-		msg := "invoked"
 		if e.Err != nil {
-			msg = "invoke failed"
+			l.Logger.Error("invoke failed",
+				zap.Error(e.Err),
+				zap.String("stack", e.Trace),
+				zap.String("function", e.FunctionName))
+		} else {
+			l.Logger.Info("invoked",
+				zap.String("stack", e.Trace),
+				zap.String("function", e.FunctionName))
 		}
-		l.Logger.Error(msg,
-			zap.Error(e.Err),
-			zap.String("stack", e.Trace),
-			zap.String("function", e.FunctionName))
 	case *Stopping:
 		l.Logger.Info("received signal",
 			zap.String("signal", strings.ToUpper(e.Signal.String())))


Test patch:
diff --git a/fxevent/console_test.go b/fxevent/console_test.go
index a3ec6ef..cf5b5a1 100644
--- a/fxevent/console_test.go
+++ b/fxevent/console_test.go
@@ -126,6 +126,11 @@ func TestConsoleLogger(t *testing.T) {
 				FunctionName: "bytes.NewBuffer()",
 				Trace:        "foo()\n\tbar/baz.go:42\n",
 			},
+			want: joinLines(
+				"[Fx] fx.Invoke(bytes.NewBuffer()) called from:",
+				"foo()",
+				"	bar/baz.go:42\n",
+			),
 		},
 		{
 			name: "Invoked/Error",
@@ -135,7 +140,7 @@ func TestConsoleLogger(t *testing.T) {
 				Trace:        "foo()\n\tbar/baz.go:42\n",
 			},
 			want: joinLines(
-				"[Fx] fx.Invoke(bytes.NewBuffer()) called from:",
+				"[Fx] ERROR		fx.Invoke(bytes.NewBuffer()) called from:",
 				"foo()",
 				"	bar/baz.go:42",
 				"Failed: some error",