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

Issue:
Day 295
Good morning! Here's your coding interview problem for today.

This problem was asked by Stitch Fix.

Pascal's triangle is a triangular array of integers constructed with the following formula:

The first row consists of the number 1.
For each subsequent row, each element is the sum of the numbers directly above it, on either side.
For example, here are the first few rows:
```
    1
   1 1
  1 2 1
 1 3 3 1
1 4 6 4 1
```
Given an input `k`, return the kth row of Pascal's triangle.

Bonus: Can you do this using only O(k) space?

Pull request:
Day295
Resolves #601.

Patch:
diff --git a/README.md b/README.md
index e9aac2b..6c9d998 100644
--- a/README.md
+++ b/README.md
@@ -301,3 +301,4 @@ problems from
 * [Day 288](https://github.com/vaskoz/dailycodingproblem-go/issues/590)
 * [Day 290](https://github.com/vaskoz/dailycodingproblem-go/issues/594)
 * [Day 291](https://github.com/vaskoz/dailycodingproblem-go/issues/596)
+* [Day 295](https://github.com/vaskoz/dailycodingproblem-go/issues/601)
diff --git a/day295/problem.go b/day295/problem.go
new file mode 100644
index 0000000..79d9fea
--- /dev/null
+++ b/day295/problem.go
@@ -0,0 +1,23 @@
+package day295
+
+// PascalTriangleRow returns a particular row in Pascal's triangle.
+// Runs in O(row) time and space.
+func PascalTriangleRow(row int) []int {
+	result := make([]int, row+1)
+	for entry := range result {
+		result[entry] = combinations(row, entry)
+	}
+	return result
+}
+
+func combinations(n, k int) int {
+	return factorial(n) / (factorial(k) * factorial(n-k))
+}
+
+func factorial(n int) int {
+	result := 1
+	for i := 2; i <= n; i++ {
+		result *= i
+	}
+	return result
+}


Test patch:
diff --git a/day295/problem_test.go b/day295/problem_test.go
new file mode 100644
index 0000000..4190bdb
--- /dev/null
+++ b/day295/problem_test.go
@@ -0,0 +1,38 @@
+package day295
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	row      int
+	expected []int
+}{
+	{0, []int{1}},
+	{1, []int{1, 1}},
+	{2, []int{1, 2, 1}},
+	{3, []int{1, 3, 3, 1}},
+	{4, []int{1, 4, 6, 4, 1}},
+	{5, []int{1, 5, 10, 10, 5, 1}},
+	{6, []int{1, 6, 15, 20, 15, 6, 1}},
+	{7, []int{1, 7, 21, 35, 35, 21, 7, 1}},
+}
+
+func TestPascalTriangleRow(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := PascalTriangleRow(tc.row); !reflect.DeepEqual(result, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkPascalTriangleRow(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			PascalTriangleRow(tc.row)
+		}
+	}
+}
Repository: chaijs/chai (js)

Issue:
"use" doesn't behave as expected as an ES6 named export
The following code throws an error:

```js
import sinonChai from "sinon-chai";
import {expect, use} from "chai";

use(sinonChai);
```

The reason it throws an error is because the necessary `this` binding is lost when calling `use` via the above syntax as opposed to calling it via `chai.use(sinonChai)`.

I'd argue that it's unexpected and undesirable for a singleton module to utilize `this` in such a way.

One possible solution might be to change [use](https://github.com/chaijs/chai/blob/2194a89e0290a3152446995afe877d4248256c91/lib/chai.js#L38-L45) from:

```js
exports.use = function (fn) {
  if (!~used.indexOf(fn)) {
    fn(this, util);
    used.push(fn);
  }

  return this;
};
```

To:

```js
exports.use = function (fn) {
  if (!~used.indexOf(fn)) {
    fn(exports, util);
    used.push(fn);
  }

  return exports;
};
```

Pull request:
Fix chai.use as ES6 named export
- Fixes #718 
- Allows `use` to be imported in ES6 as follows:
```js
import {use} from "chai";
```

Patch:
diff --git a/lib/chai.js b/lib/chai.js
index 888b485..faa54c9 100644
--- a/lib/chai.js
+++ b/lib/chai.js
@@ -37,11 +37,11 @@ var util = require('./chai/utils');
 
 exports.use = function (fn) {
   if (!~used.indexOf(fn)) {
-    fn(this, util);
+    fn(exports, util);
     used.push(fn);
   }
 
-  return this;
+  return exports;
 };
 
 /*!


Test patch:
diff --git a/test/plugins.js b/test/plugins.js
index c6df554..f56336c 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -21,4 +21,20 @@ describe('plugins', function () {
       chai.use(plugin);
     }).to.not.throw();
   });
+
+  it('.use detached from chai object', function () {
+    function anotherPlugin (chai) {
+      Object.defineProperty(chai.Assertion.prototype, 'moreTesting', {
+        get: function () {
+          return 'more success';
+        }
+      });
+    }
+
+    var use = chai.use;
+    use(anotherPlugin);
+
+    var expect = chai.expect;
+    expect(expect('').moreTesting).to.equal('more success');
+  });
 });
Repository: tursodatabase/limbo (rust)

Issue:
floating point numbers get truncated in json
Running `SELECT json_object('a', 40.7128)` in sqlite3 yields `{"a":40.7128}` but in limbo it yields `{"a":40.7}`. Same with `json_array` or any other json function, but if you run `SELECT 40.7128` both sqlite3 and limbo yields the correct `40.7128`;

Pull request:
Fix floating point truncation in JSON #877
Fixes #877

Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 6a6c9f41..132bfdee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1645,6 +1645,7 @@ dependencies = [
  "rstest",
  "rusqlite",
  "rustix",
+ "ryu",
  "serde",
  "sqlite3-parser",
  "strum",
@@ -2680,9 +2681,9 @@ dependencies = [
 
 [[package]]
 name = "ryu"
-version = "1.0.18"
+version = "1.0.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
+checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
 
 [[package]]
 name = "same-file"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 0f5b7778..3e6a3009 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -72,6 +72,7 @@ strum = "0.26"
 parking_lot = "0.12.3"
 tracing = "0.1.41"
 crossbeam-skiplist = "0.1.3"
+ryu = "1.0.19"
 
 [build-dependencies]
 chrono = "0.4.38"
diff --git a/core/json/ser.rs b/core/json/ser.rs
index 680296c5..ee0f1b13 100644
--- a/core/json/ser.rs
+++ b/core/json/ser.rs
@@ -785,13 +785,8 @@ pub trait Formatter {
                 writer.write_all(infinity.as_bytes())?;
             }
             _ => {
-                // let mut buffer = ryu::Buffer::new();
-                // let s = buffer.format_finite(value);
-
-                // This the previous implementation present in the package
-                // However, serde_json does it differently above.
-                // Not sure if there if its done like this because of the precision
-                let s = &format!("{:.1}", value);
+                let mut buffer = ryu::Buffer::new();
+                let s = buffer.format_finite(value);
                 writer.write_all(s.as_bytes())?;
             }
         }


Test patch:
diff --git a/testing/json.test b/testing/json.test
index 7a189036..d5fa827d 100755
--- a/testing/json.test
+++ b/testing/json.test
@@ -637,6 +637,10 @@ do_execsql_test json_object_simple {
   SELECT json_object('key', 'value');
 } {{{"key":"value"}}}
 
+do_execsql_test json_object_f64 {
+  SELECT json_object('key', 40.7128);
+} {{{"key":40.7128}}}
+
 do_execsql_test json_object_nested {
   SELECT json_object('grandparent',json_object('parent', json_object('child', 'value')));
 } {{{"grandparent":{"parent":{"child":"value"}}}}}
Repository: phoenixframework/phoenix_html (elixir)

Issue:
content_tag/3 doesn't accept a string argument
I'm using the `tag` and `content_tag` functions to generate custom web component elements. Per the spec, custom elements must have dashed names like:

    <my-component></my-component>

The `tag/2` function currently allows a string argument

    iex> safe_to_string tag("my-component")
    "<my-component>"

However, the `content_tag/3` function does not:

    iex> safe_to_string content_tag("my-component", "content")
    ** (FunctionClauseError) no function clause matching in Phoenix.HTML.Tag.content_tag/2

Would it be possible to allow a string argument to the `content_tag` function? 

Another alternative would be to require atoms, but replace underscores with dashes:

    iex> safe_to_string content_tag(:my_component, "content")
    "<my-component>content</my-component>"

That would match the behavior that currently exists for `data` attributes:

    iex> safe_to_string tag(:div, data: [my_attr: "foo"])
    <div data-my-attr="foo">

Pull request:
Allow strings in content_tag
Closes #281 

This removes the `is_atom` guard clauses on the `content_tag` functions allowing strings to be passed.

    content_tag("custom-component", "Hello")

Patch:
diff --git a/lib/phoenix_html/tag.ex b/lib/phoenix_html/tag.ex
index f20be25..95d1e1a 100644
--- a/lib/phoenix_html/tag.ex
+++ b/lib/phoenix_html/tag.ex
@@ -72,19 +72,19 @@ defmodule Phoenix.HTML.Tag do
       "<option data-foo=\"bar\" value=\"value\">Display Value</option>"
 
   """
-  def content_tag(name, do: block) when is_atom(name) do
+  def content_tag(name, do: block) do
     content_tag(name, block, [])
   end
 
-  def content_tag(name, content) when is_atom(name) do
+  def content_tag(name, content) do
     content_tag(name, content, [])
   end
 
-  def content_tag(name, attrs, do: block) when is_atom(name) and is_list(attrs) do
+  def content_tag(name, attrs, do: block) when is_list(attrs) do
     content_tag(name, block, attrs)
   end
 
-  def content_tag(name, content, attrs) when is_atom(name) and is_list(attrs) do
+  def content_tag(name, content, attrs) when is_list(attrs) do
     name = to_string(name)
     {:safe, escaped} = html_escape(content)
     {:safe, [?<, name, build_attrs(name, attrs), ?>, escaped, ?<, ?/, name, ?>]}


Test patch:
diff --git a/test/phoenix_html/tag_test.exs b/test/phoenix_html/tag_test.exs
index 1c905c6..34917db 100644
--- a/test/phoenix_html/tag_test.exs
+++ b/test/phoenix_html/tag_test.exs
@@ -85,6 +85,8 @@ defmodule Phoenix.HTML.TagTest do
     assert content_tag(:div, [autoplay: false], do: "") |> safe_to_string() == ~s(<div></div>)
 
     assert content_tag(:div, [autoplay: nil], do: "") |> safe_to_string() == ~s(<div></div>)
+
+    assert content_tag("custom-tag", "Hi") |> safe_to_string() == ~s(<custom-tag>Hi</custom-tag>)
   end
 
   test "img_tag" do
Repository: derekkraan/curl_req (elixir)

Issue:
Handle/Warn on unsupported flags
In the parser we can use the information from `invalid` in

```elixir
    {options, rest, invalid} =
      command
      |> OptionParser.split()
      |> OptionParser.parse(
...
```
to generate some warnings, which flags have not been recognised and generate a better error message than

```elixir
** (MatchError) no match of right hand side value: []
    (curl_req 0.98.6) lib/curl_req/macro.ex:48: CurlReq.Macro.parse/1
    (curl_req 0.98.6) expanding macro: CurlReq.sigil_CURL/2
    iex:5: (file)
```



Pull request:
Raise on unknown/invalid curl flags
Closes #24 

We need to raise instead of just logging a warning because with an unknown flag we do not know if it is just a boolean flag or needs a value. But instead of just the stacktrace, we can explain why we fail at this stage and help guide the user.

Example:

`curl -k https://example.com` would work if we would know that it's a boolean flag but when we parse it the URI gets set as the value for "-k" and the URI itself will be empty.

Patch:
diff --git a/lib/curl_req/macro.ex b/lib/curl_req/macro.ex
index 4abe676..f2ba56a 100644
--- a/lib/curl_req/macro.ex
+++ b/lib/curl_req/macro.ex
@@ -10,7 +10,7 @@ defmodule CurlReq.Macro do
       |> String.replace("\\\n", " ")
       |> String.replace("\n", " ")
 
-    {options, rest, _invalid} =
+    {options, rest, invalid} =
       command
       |> OptionParser.split()
       |> OptionParser.parse(
@@ -39,6 +39,25 @@ defmodule CurlReq.Macro do
         ]
       )
 
+    if invalid != [] do
+      errors =
+        Enum.map(invalid, fn
+          {flag, nil} -> "Unknown #{inspect(flag)}"
+          {flag, value} -> "Invalid value #{inspect(value)} for #{inspect(flag)}"
+        end)
+        |> Enum.join("\n")
+
+      raise ArgumentError, """
+
+      Command: \'curl #{command}\"
+      Unsupported or invalid flag(s) encountered:
+
+      #{errors}
+
+      Please remove the unknown flags and open an issue at https://github.com/derekkraan/curl_req
+      """
+    end
+
     [url] =
       rest
       |> Enum.flat_map(fn part ->


Test patch:
diff --git a/test/curl_req/macro_test.exs b/test/curl_req/macro_test.exs
index c792555..872382b 100644
--- a/test/curl_req/macro_test.exs
+++ b/test/curl_req/macro_test.exs
@@ -290,5 +290,11 @@ defmodule CurlReq.MacroTest do
                    }'
              """
     end
+
+    test "raises on unsupported flag" do
+      assert_raise ArgumentError, ~r/Unknown "--foo"/, fn ->
+        CurlReq.Macro.parse(~s(curl --foo https://example.com))
+      end
+    end
   end
 end
Repository: peopledoc/workalendar (python)

Issue:
Russia - Day of Unity
Day of Unity in Russia is celebrated on Nov, 4 (https://en.wikipedia.org/wiki/Unity_Day_(Russia)), but this code seems to put it on Nov 5.
```
(11, 5, "Day of Unity")
```

If I understand it properly, this line should be changed to
```
(11, 4, "Day of Unity")
```

I'll do it if needed. Should I?

Pull request:
Fix Russia's Day of Unity date
closes #317

- [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 52466ce..6435015 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -12,6 +12,7 @@
 
 - Fixed United Kingdom bank holiday for 2002 and 2012 (#315).
 - Fix a small flake8 issue with wrong indentation (#319).
+- Fix Russia "Day of Unity" date, set to November 4th, thx @alexitkes for the bug report (#317).
 
 ## 4.0.0 (2019-01-24)
 
diff --git a/workalendar/europe/russia.py b/workalendar/europe/russia.py
index 1ef2554..a582e2c 100644
--- a/workalendar/europe/russia.py
+++ b/workalendar/europe/russia.py
@@ -18,5 +18,5 @@ class Russia(WesternCalendar):
         (5, 1, "Labour Day"),
         (5, 9, "Victory Day"),
         (6, 12, "National Day"),
-        (11, 5, "Day of Unity"),
+        (11, 4, "Day of Unity"),
     )


Test patch:
diff --git a/workalendar/tests/test_europe.py b/workalendar/tests/test_europe.py
index 36048e3..02f8d6a 100644
--- a/workalendar/tests/test_europe.py
+++ b/workalendar/tests/test_europe.py
@@ -689,7 +689,7 @@ class Russia(GenericCalendarTest):
         self.assertIn(date(2018, 5, 1), holidays)  # Labour Day
         self.assertIn(date(2018, 5, 9), holidays)  # Victory Day
         self.assertIn(date(2018, 6, 12), holidays)  # National Day
-        self.assertIn(date(2018, 11, 5), holidays)  # Day of Unity
+        self.assertIn(date(2018, 11, 4), holidays)  # Day of Unity
 
 
 class UnitedKingdomTest(GenericCalendarTest):