PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: FormidableLabs/urql (ts)

Issue:
Unable to parse some scalar values for fieldKey
```
urql@1.9.6
@urql/exchange-graphcache@2.3.1
```

**Steps to reproduce**

1. Define a field that uses the [`DateTime`](https://github.com/excitement-engineer/graphql-iso-date#datetime) type for an argument:

```graphql
type Query {
  timetable(from: DateTime!, to: DateTime!): [Session!]!
}
```

2. Query that field with the DateTime args:

```graphql
query {
  timetable(from: 2020-04-13T03:00:00.000Z, to: 2020-04-20T02:59:59.999Z}) {
    ...
  }
}
```

3. In a Graphcache Custom Update, try to inspect the `Query` fields:

```js
cache.inspectFields({ __typename: 'Query' })
```

**Expected behavior**

You get the `timetable` field with the used args:

```js
[
  { fieldName: 'timetable', arguments: { from: '2020-04-13T03:00:00.000Z', to: '2020-04-20T02:59:59.999Z' }, fieldKey: 'timetable({"from":"2020-04-13T03:00:00.000Z","to":"2020-04-20T02:59:59.999Z"})' },
]
```

**Actual behavior**

`fieldInfoOfKey` throws:

```
SyntaxError: Unexpected number in JSON at position 12
```

at this line:

https://github.com/FormidableLabs/urql/blob/522736606028fafcb8a313b2b2c3160a6400a852/exchanges/graphcache/src/store/keys.ts#L13

when trying to parse:

```
{"from":2020-04-13T03:00:00.000Z,"to":2020-04-20T02:59:59.999Z}
```

This is because `2020-04-13T03:00:00.000Z` is not a valid JSON value.

**Further comments**

I fixed this by calling `.toString()` on the dates before passing them to `urql` which also works with the DateTime type.

Pull request:
Fix stringifyVariables not stringifying toJSON values for scalars
Fix #717 

Patch:
diff --git a/.changeset/stale-onions-check.md b/.changeset/stale-onions-check.md
new file mode 100644
index 00000000..733b757a
--- /dev/null
+++ b/.changeset/stale-onions-check.md
@@ -0,0 +1,5 @@
+---
+'@urql/core': patch
+---
+
+Fix stringifyVariables breaking on x.toJSON scalars.
diff --git a/packages/core/src/utils/stringifyVariables.ts b/packages/core/src/utils/stringifyVariables.ts
index 493cb42c..d8ce554e 100644
--- a/packages/core/src/utils/stringifyVariables.ts
+++ b/packages/core/src/utils/stringifyVariables.ts
@@ -7,7 +7,7 @@ const stringify = (x: any): string => {
   } else if (typeof x !== 'object') {
     return JSON.stringify(x) || '';
   } else if (x.toJSON) {
-    return x.toJSON();
+    return stringify(x.toJSON());
   } else if (Array.isArray(x)) {
     let out = '[';
     for (let i = 0, l = x.length; i < l; i++) {


Test patch:
diff --git a/packages/core/src/utils/stringifyVariables.test.ts b/packages/core/src/utils/stringifyVariables.test.ts
index 6e6c6ae4..2d592e4e 100644
--- a/packages/core/src/utils/stringifyVariables.test.ts
+++ b/packages/core/src/utils/stringifyVariables.test.ts
@@ -29,7 +29,7 @@ it('returns null for circular structures', () => {
 
 it('stringifies dates correctly', () => {
   const date = new Date('2019-12-11T04:20:00');
-  expect(stringifyVariables(date)).toBe(date.toJSON());
+  expect(stringifyVariables(date)).toBe(`"${date.toJSON()}"`);
 });
 
 it('stringifies dictionaries (Object.create(null)) correctly', () => {
Repository: mathnet/mathnet-numerics (csharp)

Issue:
Bug in SpecialFunctions.Hypotenuse
Hello, the implementation of Hypotenuse is buggy. The following test fails:

```
[Fact]
void TestHypotenuse()
{
  Assert.True(double.IsNaN(SpecialFunctions.Hypotenuse(double.NaN, 0)));
}
```

This has severe consequences, because e.g. the following test also fails:

```
 [Fact]
 void TestL2Norm()
 {
   var v = Vector<double>.Build.Dense([double.NaN, 0]);
   Assert.True(double.IsNaN(v.L2Norm()));
 }
```

Best regards, Dirk

Pull request:
Fixes #1071

Patch:
diff --git a/src/Numerics/SpecialFunctions/Stability.cs b/src/Numerics/SpecialFunctions/Stability.cs
index 1bca52240..6692f5c99 100644
--- a/src/Numerics/SpecialFunctions/Stability.cs
+++ b/src/Numerics/SpecialFunctions/Stability.cs
@@ -91,6 +91,11 @@ public static Complex32 Hypotenuse(Complex32 a, Complex32 b)
         /// <returns>Returns <code>sqrt(a<sup>2</sup> + b<sup>2</sup>)</code> without underflow/overflow.</returns>
         public static double Hypotenuse(double a, double b)
         {
+            if (double.IsNaN(a) || double.IsNaN(b))
+            {
+                return double.NaN;
+            }
+
             if (Math.Abs(a) > Math.Abs(b))
             {
                 double r = b/a;


Test patch:
diff --git a/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs b/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
index 01f5fbffd..4a2761250 100644
--- a/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
+++ b/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
@@ -332,5 +332,18 @@ public void Log1p(double x, double y)
         {
             AssertHelpers.AlmostEqualRelative(y, SpecialFunctions.Log1p(x), 14);
         }
+
+        [Test]
+        public void HypotenuseWhenArgumentIsNanReturnesNan()
+        {
+            Assert.True(double.IsNaN(SpecialFunctions.Hypotenuse(double.NaN, 0)));
+        }
+
+        [Test]
+        public void L2NormOfVectorWhenElementsNanReturnsNan()
+        {
+            var v = LinearAlgebra.Vector<double>.Build.Dense(new[] { double.NaN, 0 });
+            Assert.True(double.IsNaN(v.L2Norm()));
+        }
     }
 }
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 379
Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

Given a string, generate all possible subsequences of the string.

For example, given the string `xyz`, return an array or set with the following strings:

```
x
y
z
xy
xz
yz
xyz
```
Note that `zx` is not a valid subsequence since it is not in the order of the given string.

Pull request:
Day379
Resolves #764.

Patch:
diff --git a/README.md b/README.md
index d7d471a..e3d0159 100644
--- a/README.md
+++ b/README.md
@@ -374,4 +374,5 @@ problems from
 * [Day 376](https://github.com/vaskoz/dailycodingproblem-go/issues/758)
 * [Day 377](https://github.com/vaskoz/dailycodingproblem-go/issues/760)
 * [Day 378](https://github.com/vaskoz/dailycodingproblem-go/issues/762)
+* [Day 379](https://github.com/vaskoz/dailycodingproblem-go/issues/764)
 
diff --git a/day379/problem.go b/day379/problem.go
new file mode 100644
index 0000000..2b9685d
--- /dev/null
+++ b/day379/problem.go
@@ -0,0 +1,23 @@
+package day379
+
+// AllPossibleSubsequences returns all the possible
+// ordered subsequences.
+func AllPossibleSubsequences(str string) map[string]struct{} {
+	ansSet := make(map[string]struct{})
+	allPossibleSubsequences(str, ansSet)
+
+	return ansSet
+}
+
+func allPossibleSubsequences(str string, ansSet map[string]struct{}) {
+	if _, alreadyExists := ansSet[str]; len(str) == 0 || alreadyExists {
+		return
+	}
+
+	for i := range str {
+		sub := str[:i] + str[i+1:]
+		allPossibleSubsequences(sub, ansSet)
+	}
+
+	ansSet[str] = struct{}{}
+}


Test patch:
diff --git a/day379/problem_test.go b/day379/problem_test.go
new file mode 100644
index 0000000..20658c6
--- /dev/null
+++ b/day379/problem_test.go
@@ -0,0 +1,41 @@
+package day379
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	input  string
+	subseq map[string]struct{}
+}{
+	{"xyz",
+		map[string]struct{}{
+			"x":   {},
+			"y":   {},
+			"z":   {},
+			"xy":  {},
+			"xz":  {},
+			"yz":  {},
+			"xyz": {},
+		}},
+}
+
+func TestAllPossibleSubsequences(t *testing.T) {
+	t.Parallel()
+
+	for _, tc := range testcases {
+		if result := AllPossibleSubsequences(tc.input); !reflect.DeepEqual(result, tc.subseq) {
+			t.Errorf("Expected %v, got %v", tc.subseq, result)
+		}
+	}
+}
+
+func BenchmarkAllPossibleSubsequences(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			AllPossibleSubsequences(tc.input)
+		}
+	}
+}
Repository: pinojs/pino (js)

Issue:
mapLine as option for pretty
It would be nice to be able to provide the mapLine function as an option for the pretty stream, so that I can define my own application specific format for log lines.

Pull request:
Add formatter option for `pino.pretty()`
Allows the application to define its own formatter for the `pino.pretty()` transform stream.

resolves #120

Patch:
diff --git a/README.md b/README.md
index bfb1f08..9ee3932 100644
--- a/README.md
+++ b/README.md
@@ -545,6 +545,8 @@ Options:
 
 * `timeTransOnly`, if set to `true`, it will only covert the unix timestamp to
   ISO 8601 date format, and reserialize the JSON (equivalent to `pino -t`).
+* `formatter`, a custom function to format the line, is passed the JSON
+  object as an argument and should return a string value
 
 You can use the pretty transformer internally, like so:
 
@@ -785,12 +787,12 @@ pino.info({
     to: {key: 'sensitive', another: 'thing'}
   },
   more: 'stuff'
-}) 
+})
 
 // {"pid":7306,"hostname":"x","level":30,"time":1475519922198,"key":"[Redacted]","path":{"to":{"key":"[Redacted]","another":"thing"}},"more":"stuff","v":1}
 ```
 
-If you have other serializers simply extend: 
+If you have other serializers simply extend:
 
 ```js
 var noir = require('pino-noir')
diff --git a/pretty.js b/pretty.js
index 6c19209..24ccb00 100755
--- a/pretty.js
+++ b/pretty.js
@@ -52,6 +52,7 @@ function isPinoLine (line) {
 
 function pretty (opts) {
   var timeTransOnly = opts && opts.timeTransOnly
+  var formatter = opts && opts.formatter
   var levelFirst = opts && opts.levelFirst
 
   var stream = split(mapLine)
@@ -88,6 +89,10 @@ function pretty (opts) {
       return line + '\n'
     }
 
+    if (formatter) {
+      return opts.formatter(parsed.value) + '\n'
+    }
+
     if (timeTransOnly) {
       value.time = asISODate(value.time)
       return JSON.stringify(value) + '\n'


Test patch:
diff --git a/test/pretty.test.js b/test/pretty.test.js
index 7fcdd00..dc5d937 100644
--- a/test/pretty.test.js
+++ b/test/pretty.test.js
@@ -49,6 +49,20 @@ test('pino transform can just parse the dates', function (t) {
   instance.info('hello world')
 })
 
+test('pino transform can format with a custom function', function (t) {
+  t.plan(1)
+  var pretty = pino.pretty({ formatter: function (line) {
+    return 'msg: ' + line.msg + ', foo: ' + line.foo
+  } })
+  pretty.pipe(split(function (line) {
+    t.ok(line === 'msg: hello world, foo: bar', 'line matches')
+    return line
+  }))
+  var instance = pino(pretty)
+
+  instance.info({foo: 'bar'}, 'hello world')
+})
+
 test('pino transform prettifies Error', function (t) {
   var pretty = pino.pretty()
   var err = new Error('hello world')
Repository: absinthe-graphql/absinthe_plug (elixir)

Issue:
upgrade from 1.5.3 to 1.5.4 breaks default pub sub option
The upgrade from 1.5.3 to 1.5.4 broke our application. We didn't set the `pubsub` option explicitly, but relied on the default `conn.private[:phoenix_endpoint]`. After the upgrade, this default apparently gets overwritten by the `update_config` function. We noticed because subscription triggers still worked when pushing mutations via a socket, but they didn't work anymore when sending a mutation via HTTP.

Pull request:
Fix update_config bug
This PR fixes a bug in the `update_config` function so that it doesn't stomp any existing values in the `context`

Fixes #247 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39adbc1..d0312e2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## v1.5.5
+
+- Bug Fix: [Don't wipe out an existing pubsub value in context](https://github.com/absinthe-graphql/absinthe_plug/pull/249)
+
 ## v1.5.4
 
 - Feature: [Set all plug options via put_options](https://github.com/absinthe-graphql/absinthe_plug/pull/243)
diff --git a/lib/absinthe/plug.ex b/lib/absinthe/plug.ex
index aa2ebaf..5952346 100644
--- a/lib/absinthe/plug.ex
+++ b/lib/absinthe/plug.ex
@@ -320,11 +320,12 @@ defmodule Absinthe.Plug do
     end
   end
 
-  defp update_config(conn, config) do
+  @doc false
+  def update_config(conn, config) do
     config
-    |> update_config(:pubsub, conn)
     |> update_config(:raw_options, conn)
     |> update_config(:init_options, conn)
+    |> update_config(:pubsub, conn)
   end
 
   defp update_config(config, :pubsub, conn) do
diff --git a/mix.exs b/mix.exs
index ab09979..db4c349 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,7 +1,7 @@
 defmodule Absinthe.Plug.Mixfile do
   use Mix.Project
 
-  @version "1.5.4"
+  @version "1.5.5"
 
   def project do
     [


Test patch:
diff --git a/test/lib/absinthe/plug_test.exs b/test/lib/absinthe/plug_test.exs
index 7a5364e..2f5ce2a 100644
--- a/test/lib/absinthe/plug_test.exs
+++ b/test/lib/absinthe/plug_test.exs
@@ -559,6 +559,19 @@ defmodule Absinthe.PlugTest do
       assert %{"errors" => [%{"message" => "No query!!"}]} = resp_body
       assert {"content-type", "text/who-knows; charset=utf-8"} in resp_headers
     end
+
+    test "don't wipe out pubsub" do
+      config = Absinthe.Plug.init(schema: TestSchema, context: %{user_id: 1})
+
+      conn =
+        conn(:post, "/")
+        |> Absinthe.Plug.put_options(pubsub: PubSub)
+
+      updated_config = Absinthe.Plug.update_config(conn, config)
+
+      assert updated_config.context.pubsub == PubSub
+      assert updated_config.context.user_id == 1
+    end
   end
 
   describe "assign_context/2" do
Repository: Hacker0x01/react-datepicker (ts)

Issue:
All options are selected for year picker
**Describe the bug**

https://github.com/user-attachments/assets/b69c38ef-e3fb-4a1c-8bcc-3f9bb3b16dfd

**To Reproduce**

Use a year picker with no value

**Expected behavior**

Options shouldn't have the selected style


Visible with latest version 8.3.0 (not seen with 8.2.1)

Pull request:
Fix #5573 🐛 Fix the Selected Year Picker style when no date is selected
Closes #5573

## Description
As mentioned in the attached ticket, we're having an issue that the year picker is highlighting all the available years when do date is entered.  In this PR I added a fix for it along with the test cases to validate the fix.

## Contribution checklist
- [x] I have followed the [contributing guidelines](https://github.com/Hacker0x01/react-datepicker/blob/main/CONTRIBUTING.md).
- [x] I have added sufficient test coverage for my changes.
- [x] I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.


Patch:
diff --git a/src/year.tsx b/src/year.tsx
index 8bbfad18..5ac50998 100644
--- a/src/year.tsx
+++ b/src/year.tsx
@@ -248,7 +248,7 @@ export default class Year extends Component<YearProps> {
     if (selectsMultiple) {
       return selectedDates?.some((date) => year === getYear(date));
     }
-    return !selected || year === getYear(selected);
+    return !!selected && year === getYear(selected);
   };
 
   onYearClick = (


Test patch:
diff --git a/src/test/year_picker_test.test.tsx b/src/test/year_picker_test.test.tsx
index 440c9bc3..ef5e16d9 100644
--- a/src/test/year_picker_test.test.tsx
+++ b/src/test/year_picker_test.test.tsx
@@ -148,6 +148,20 @@ describe("YearPicker", () => {
     expect(yearElements.length).toBe(0);
   });
 
+  it("should not has selected class where there is no selectedDates", () => {
+    const { container } = render(
+      <Year
+        date={new Date()}
+        onYearMouseEnter={() => {}}
+        onYearMouseLeave={() => {}}
+      />,
+    );
+    const yearElements = Array.from(
+      container.querySelectorAll(".react-datepicker__year-text--selected"),
+    );
+    expect(yearElements.length).toBe(0);
+  });
+
   it("should have current year class when element of array equal of current year", () => {
     const date = new Date();
     const { container } = render(
Repository: sanctuary-js/sanctuary (js)

Issue:
boolean :: a -> a -> Boolean -> a
We have [`S.ifElse`][1], but we currently lack straightforward case folding for the `Boolean` type ([`S.maybe`][2] and [`S.either`][3] provide case folding for `Maybe a` and `Either a b` respectively).

I think `S.boolean` would be a good addition to the library.

```javascript
> S.boolean ('false') ('true') (false)
'false'

> S.boolean ('false') ('true') (true)
'true'
```

The one thing I very much dislike about the function is that one must learn that the constructors are essentially defined in `false | true` order rather than in `true | false` order. This is arbitrary, and does not match the argument order of `S.ifElse`. If we decide to add this function we should make it consistent with Haskell's [`bool`][4], so some confusion is unavoidable.


[1]: https://sanctuary.js.org/#ifElse
[2]: https://sanctuary.js.org/#maybe
[3]: https://sanctuary.js.org/#either
[4]: https://hackage.haskell.org/package/base-4.11.1.0/docs/Data-Bool.html#v:bool


Pull request:
logic: add S.boolean
Closes #577


Patch:
diff --git a/index.js b/index.js
index 9ddfe13..250a44d 100644
--- a/index.js
+++ b/index.js
@@ -2767,6 +2767,31 @@
     impl: B (not)
   };
 
+  //# boolean :: a -> a -> Boolean -> a
+  //.
+  //. Case analysis for the `Boolean` type. `boolean (x) (y) (b)` evaluates
+  //. to `x` if `b` is `false`; to `y` if `b` is `true`.
+  //.
+  //. ```javascript
+  //. > S.boolean ('no') ('yes') (false)
+  //. 'no'
+  //.
+  //. > S.boolean ('no') ('yes') (true)
+  //. 'yes'
+  //. ```
+  function boolean(x) {
+    return function(y) {
+      return function(b) {
+        return b ? y : x;
+      };
+    };
+  }
+  _.boolean = {
+    consts: {},
+    types: [a, a, $.Boolean, a],
+    impl: boolean
+  };
+
   //# ifElse :: (a -> Boolean) -> (a -> b) -> (a -> b) -> a -> b
   //.
   //. Takes a unary predicate, a unary "if" function, a unary "else"


Test patch:
diff --git a/test/boolean.js b/test/boolean.js
new file mode 100644
index 0000000..2e5ab76
--- /dev/null
+++ b/test/boolean.js
@@ -0,0 +1,17 @@
+'use strict';
+
+var S = require ('..');
+
+var eq = require ('./internal/eq');
+
+
+test ('boolean', function() {
+
+  eq (typeof S.boolean) ('function');
+  eq (S.boolean.length) (1);
+  eq (S.show (S.boolean)) ('boolean :: a -> a -> Boolean -> a');
+
+  eq (S.boolean ('no') ('yes') (false)) ('no');
+  eq (S.boolean ('no') ('yes') (true)) ('yes');
+
+});