PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: peopledoc/workalendar (python)

Issue:
Malaysia Thaipusam 2019
Hi!

Please, add        2019: date(2019, 1, 21) to MSIA_THAIPUSAM

Now i get error KeyError: 'Missing date for Malaysia Thaipusam for year: 2019'


Pull request:
Malaysia Thaipusam dates for 2019 & 2020
closes #354

- [x] Tests with a significant number of years to be tested for your calendar.
- [x] Changelog amended with a mention describing your changes.


Patch:
diff --git a/Changelog.md b/Changelog.md
index 45cd233..d07e373 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,8 @@
 
 - Drop Python 3.4 support (#352).
 - Added Florida specific calendars: Florida Legal, Florida Circuit Courts, Miami-Dade (#216).
+- Added Malaysia Thaipusam days for the year 2019 & 2020 - thx @burlak for the bug report (#354).
+- Fixed Deepavali dates for the year 2018 ; confirmed fixed dates that were set in the past.
 
 ## v4.4.0 (2019-05-17)
 
diff --git a/workalendar/asia/malaysia.py b/workalendar/asia/malaysia.py
index 6a48697..91746c4 100644
--- a/workalendar/asia/malaysia.py
+++ b/workalendar/asia/malaysia.py
@@ -37,8 +37,8 @@ class Malaysia(ChineseNewYearCalendar, WesternCalendar, IslamicMixin):
         2015: date(2015, 11, 10),
         2016: date(2016, 10, 29),
         2017: date(2017, 10, 18),
-        2018: date(2018, 11, 7),   # This might change
-        2019: date(2019, 10, 27),  # This might change
+        2018: date(2018, 11, 6),
+        2019: date(2019, 10, 27),
         2020: date(2020, 11, 14),  # This might change
     }
 
@@ -51,7 +51,9 @@ class Malaysia(ChineseNewYearCalendar, WesternCalendar, IslamicMixin):
         2015: date(2015, 2, 3),
         2016: date(2016, 1, 25),
         2017: date(2017, 2, 9),
-        2018: date(2018, 1, 31),   # This might change
+        2018: date(2018, 1, 31),
+        2019: date(2019, 1, 21),
+        2020: date(2020, 2, 8),  # This might change
     }
     chinese_new_year_label = "First Day of Lunar New Year"
     include_chinese_second_day = True


Test patch:
diff --git a/workalendar/tests/test_asia.py b/workalendar/tests/test_asia.py
index 35c0458..d62e2d8 100644
--- a/workalendar/tests/test_asia.py
+++ b/workalendar/tests/test_asia.py
@@ -224,6 +224,21 @@ class MalaysiaTest(GenericCalendarTest):
         holidays = self.cal.holidays_set(2018)
         self.assertIn(date(2018, 6, 1), holidays)
 
+    def test_fix_deepavali_2018(self):
+        holidays = self.cal.holidays(2018)
+        holidays = dict(holidays)
+        deepavali = date(2018, 11, 6)
+        self.assertIn(deepavali, holidays)
+        self.assertEqual(holidays[deepavali], "Deepavali")
+
+    def test_msia_thaipusam(self):
+        years = self.cal.MSIA_THAIPUSAM.keys()
+        # we only have them for years 2010-2020
+        self.assertEqual(
+            set(years),
+            set(range(2010, 2021))
+        )
+
 
 class QatarTest(GenericCalendarTest):
     cal_class = Qatar
Repository: genjidb/genji (go)

Issue:
UPDATE ... SET updates the wrong array indexes
when we add a field into a document which contains an array with multiple indexes,  the field is added but the first index is replaced by the next.

`
INSERT INTO users (a) VALUES ([1, 0, 0]), ([2, 0]);
UPDATE users set min = 0;
select * from users;
{  "a": [ 1, 0, 0]}
{"a": [ 2, 0]}
`
The result is this:
`
{  "a": [ 2, 0], "min":  0}
{  "a": [ 2, 0], "min":  0}`

We can see the first index replaced by the next.

instead of 
`
{  "a": [ 1, 0, 0], "min":  0}
{"a": [ 2, 0], "min":  0}
`

I probably do the correction with the issue #92 



Pull request:
Deep copy documents in Replacement node
This PR fixes #107 by doing a deep copy of the document instead of a shallow copy.
Nodes reuse memory between each iteration and the Replacement Node was storing each document in a buffer before writing them into the table, which caused it to write corrupted docs.


Patch:
diff --git a/sql/planner/replacement.go b/sql/planner/replacement.go
index 605e47b0..3409bb1a 100644
--- a/sql/planner/replacement.go
+++ b/sql/planner/replacement.go
@@ -66,7 +66,7 @@ func (n *replacementNode) toResult(st document.Stream) (res query.Result, err er
 			}
 
 			docs[i].Reset()
-			err := docs[i].ScanDocument(d)
+			err := docs[i].Copy(d)
 			if err != nil {
 				return err
 			}


Test patch:
diff --git a/sql/query/update_test.go b/sql/query/update_test.go
index 96b68e18..21734232 100644
--- a/sql/query/update_test.go
+++ b/sql/query/update_test.go
@@ -75,4 +75,24 @@ func TestUpdateStmt(t *testing.T) {
 			require.JSONEq(t, test.expected, buf.String())
 		})
 	}
+
+	t.Run("with arrays", func(t *testing.T) {
+		db, err := genji.Open(":memory:")
+		require.NoError(t, err)
+		defer db.Close()
+
+		res, err := db.Query(`
+			CREATE TABLE foo;
+			INSERT INTO foo (a) VALUES ([1, 0, 0]), ([2, 0]);
+			UPDATE foo set b = 0;
+			SELECT * FROM foo; 
+		`)
+		require.NoError(t, err)
+		defer res.Close()
+
+		var buf bytes.Buffer
+		err = document.IteratorToJSONArray(&buf, res)
+		require.NoError(t, err)
+		require.JSONEq(t, `[{"a": [1, 0, 0], "b": 0}, {"a": [2, 0], "b": 0}]`, buf.String())
+	})
 }
Repository: yargs/yargs (js)

Issue:
Call the wrong command handler in some situation
I'm not sure if this is a bug...

I just add two commands:

```javascript
// cli.js
#!/usr/bin/env node
var yargs = require('yargs');
yargs.command('foo', 'the foo command', {}, function(argv) {
  console.log('command foo--', argv);
});
yargs.command('bar', 'the bar command', {}, function(argv){
  console.log('command bar--', argv);
});
console.log(yargs.parse(process.argv.slice(2)));
```

```bash
$ ./cli.js foo
```

It call command foo's handler, and print: `command foo-- { _: [ 'foo' ], '$0': 'cli.js' }`.

```bash
$ ./cli.js bar foo
```

***It also call command foo's handler! But I think it should call command bar's handler.***

And I dig into the source code, <https://github.com/yargs/yargs/blob/master/yargs.js#L645>:

```javascript
if (~argv._.indexOf(cmd) && cmd !== completionCommand) {
  setPlaceholderKeys(argv)
  return command.runCommand(cmd, self, parsed)
}
```

Why `argv._.indexOf(cmd)` not is `argv._[0] === cmd`?

Pull request:
fix: we now respect the order of _ when applying commands
We were applying commands in the order that handlers were defined, rather than the order of `_`, fixes #514 

Patch:
diff --git a/yargs.js b/yargs.js
index 5b4807f..4aa4b3b 100644
--- a/yargs.js
+++ b/yargs.js
@@ -647,8 +647,8 @@ function Yargs (processArgs, cwd, parentRequire) {
     // if there's a handler associated with a
     // command defer processing to it.
     var handlerKeys = command.getCommands()
-    for (var i = 0, cmd; (cmd = handlerKeys[i]) !== undefined; i++) {
-      if (~argv._.indexOf(cmd) && cmd !== completionCommand) {
+    for (var i = 0, cmd; (cmd = argv._[i]) !== undefined; i++) {
+      if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) {
         setPlaceholderKeys(argv)
         return command.runCommand(cmd, self, parsed)
       }


Test patch:
diff --git a/test/command.js b/test/command.js
index 965942a..890fb8f 100644
--- a/test/command.js
+++ b/test/command.js
@@ -455,4 +455,20 @@ describe('Command', function () {
       ])
     })
   })
+
+  // addresses https://github.com/yargs/yargs/issues/514.
+  it('respects order of positional arguments when matching commands', function () {
+    var output = []
+    yargs('bar foo')
+      .command('foo', 'foo command', function (yargs) {
+        output.push('foo')
+      })
+      .command('bar', 'bar command', function (yargs) {
+        output.push('bar')
+      })
+      .argv
+
+    output.should.include('bar')
+    output.should.not.include('foo')
+  })
 })
Repository: hashicorp/go-hclog (go)

Issue:
doc for SupportsColor lacks hints to Writers implementing it
The documentation for interface [`SupportsColor`](https://pkg.go.dev/github.com/hashicorp/go-hclog#SupportsColor) doesn't give hints to libraries which expose an `io.Writer` which implement this interface. Is it purely abstract (just a facility with no yet known implementation)?

Pull request:
Fix colors not being forced on correctly.
Turns out that the color package we use was doing it's own "should
colors be on or not" detection, which interferred with our own
detection. This caused situations where colors were forced on to still
be off (and, maddeningly, would show up in weird contexts because it
dependent on Stdout being not a terminal to break when forced).

Fixes #127 
Closes #131 

Patch:
diff --git a/intlogger.go b/intlogger.go
index 0f63466..1a80008 100644
--- a/intlogger.go
+++ b/intlogger.go
@@ -55,11 +55,25 @@ var (
 
 	faintBoldColor                 = color.New(color.Faint, color.Bold)
 	faintColor                     = color.New(color.Faint)
-	faintMultiLinePrefix           = faintColor.Sprint("  | ")
-	faintFieldSeparator            = faintColor.Sprint("=")
-	faintFieldSeparatorWithNewLine = faintColor.Sprint("=\n")
+	faintMultiLinePrefix           string
+	faintFieldSeparator            string
+	faintFieldSeparatorWithNewLine string
 )
 
+func init() {
+	// Force all the colors to enabled because we do our own detection of color usage.
+	for _, c := range _levelToColor {
+		c.EnableColor()
+	}
+
+	faintBoldColor.EnableColor()
+	faintColor.EnableColor()
+
+	faintMultiLinePrefix = faintColor.Sprint("  | ")
+	faintFieldSeparator = faintColor.Sprint("=")
+	faintFieldSeparatorWithNewLine = faintColor.Sprint("=\n")
+}
+
 // Make sure that intLogger is a Logger
 var _ Logger = &intLogger{}
 


Test patch:
diff --git a/logger_test.go b/logger_test.go
index 1d10e3e..1ab9fd5 100644
--- a/logger_test.go
+++ b/logger_test.go
@@ -257,6 +257,38 @@ func TestLogger(t *testing.T) {
 		assert.Equal(t, "[INFO]  sublogger: this is test\n", rest)
 	})
 
+	t.Run("can force colors to on in any context", func(t *testing.T) {
+		if runtime.GOOS == "windows" {
+			t.Skip("colors are different on windows")
+		}
+
+		var buf bytes.Buffer
+
+		logger := New(&LoggerOptions{
+			// No name!
+			Output:     &buf,
+			Level:      Trace,
+			Color:      ForceColor,
+			TimeFormat: "<time>",
+		})
+
+		logger.Trace("trace")
+		logger.Debug("debug")
+		logger.Info("info")
+		logger.Warn("warn")
+		logger.Error("error")
+		str := buf.String()
+
+		assert.Equal(t, ""+
+			"\033[92m<time> [TRACE] trace\n\033[0m"+
+			"\033[97m<time> [DEBUG] debug\n\033[0m"+
+			"\033[94m<time> [INFO]  info\n\033[0m"+
+			"\033[93m<time> [WARN]  warn\n\033[0m"+
+			"\033[91m<time> [ERROR] error\n\033[0m",
+			str,
+		)
+	})
+
 	t.Run("use a different time format", func(t *testing.T) {
 		var buf bytes.Buffer
Repository: tallarium/reverse_proxy_plug (elixir)

Issue:
Error callback can be simplified
It will be a breaking change, but there is no reason for the `opts[:error_callback]` to pass `{:error, error}` through from `response/3` - we should pattern match in the function head and pass `error` through to the callback instead.

Pull request:
no need to pass entire tuple to error callbacks
fixes #182 

Patch:
diff --git a/lib/reverse_proxy_plug.ex b/lib/reverse_proxy_plug.ex
index 9436013..72ede92 100644
--- a/lib/reverse_proxy_plug.ex
+++ b/lib/reverse_proxy_plug.ex
@@ -119,7 +119,7 @@ defmodule ReverseProxyPlug do
     process_response(opts[:response_mode], conn, resp, opts)
   end
 
-  def response(error, conn, opts) do
+  def response({:error, error}, conn, opts) do
     do_error_callback(opts[:error_callback], error, conn)
   end
 
@@ -156,7 +156,7 @@ defmodule ReverseProxyPlug do
     |> Conn.send_resp()
   end
 
-  defp status_from_error({:error, %HTTPClient.Error{id: nil, reason: reason}})
+  defp status_from_error(%HTTPClient.Error{id: nil, reason: reason})
        when reason in @timeout_error_reasons do
     :gateway_timeout
   end


Test patch:
diff --git a/test/reverse_proxy_plug_test.exs b/test/reverse_proxy_plug_test.exs
index 7bf091a..5e231b6 100644
--- a/test/reverse_proxy_plug_test.exs
+++ b/test/reverse_proxy_plug_test.exs
@@ -333,12 +333,12 @@ defmodule ReverseProxyPlugTest do
   end
 
   defmodule ErrorHandling do
-    def mfa_error_callback(arg, {:error, error}) do
+    def mfa_error_callback(arg, error) do
       send(self(), {:got_arg, arg})
       send(self(), {:got_error, error})
     end
 
-    def mfa_error_callback(arg, {:error, error}, conn) do
+    def mfa_error_callback(arg, error, conn) do
       send(self(), {:got_arg, arg})
       send(self(), {:got_error, error})
       send(self(), {:got_conn, conn})
@@ -347,11 +347,11 @@ defmodule ReverseProxyPlugTest do
 
     def mfa_error_callback1(arg, error), do: mfa_error_callback(arg, error)
 
-    def fun_error_callback({:error, error}) do
+    def fun_error_callback(error) do
       send(self(), {:got_error, error})
     end
 
-    def fun_error_callback({:error, error}, conn) do
+    def fun_error_callback(error, conn) do
       send(self(), {:got_error, error})
       send(self(), {:got_conn, conn})
       resp(conn, :internal_server_error, "internal server error")