PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: invenia/NamedDims.jl (julia)

Issue:
argmax and argmin
Any reason these aren't implemented?

e.g.

```
X = NamedDimsArray{(:a, :b)}(rand(2,2))
@assert argmax(X; dims=:a) == argmax(X; dims=1)
```

Pull request:
Fixes #185

Patch:
diff --git a/src/functions.jl b/src/functions.jl
index e098dac..8b618fd 100644
--- a/src/functions.jl
+++ b/src/functions.jl
@@ -17,7 +17,7 @@ end
 
 # 1 Arg
 for (mod, funs) in (
-    (:Base, (:sum, :prod, :maximum, :minimum, :extrema)),
+    (:Base, (:sum, :prod, :maximum, :minimum, :extrema, :argmax, :argmin)),
     (:Statistics, (:mean, :std, :var, :median)),
 )
     for fun in funs
@@ -29,6 +29,19 @@ for (mod, funs) in (
     end
 end
 
+# 1 Arg, 2 Results
+for (mod, funs) in ((:Base, (:findmax, :findmin)),)
+    for fun in funs
+        @eval function $mod.$fun(a::NamedDimsArray; dims=:, kwargs...)
+            numerical_dims = dim(a, dims)
+            data = $mod.$fun(parent(a); dims=numerical_dims, kwargs...)
+            map(data) do item  # value and index
+                nameddimsarray_result(a, item, numerical_dims)
+            end
+        end
+    end
+end
+
 # 1 Arg - no default for `dims` keyword
 for (mod, funs) in ((:Base, (:cumsum, :cumprod, :sort, :sort!, :sortslices)),)
     for fun in funs


Test patch:
diff --git a/test/functions.jl b/test/functions.jl
index 62c59b7..5ce8d68 100644
--- a/test/functions.jl
+++ b/test/functions.jl
@@ -7,13 +7,21 @@ using Statistics
     a = [10 20; 31 40]
     nda = NamedDimsArray(a, (:x, :y))
 
-    @testset "$f" for f in (sum, prod, maximum, minimum, extrema)
+    @testset "$f" for f in (sum, prod, maximum, minimum, extrema, argmax, argmin)
         @test f(nda) == f(a)
         @test f(nda; dims=:x) == f(nda; dims=1) == f(a; dims=1)
 
         @test dimnames(f(nda; dims=:x)) == (:x, :y) == dimnames(f(nda; dims=1))
     end
 
+    @testset "$f" for f in (findmax, findmin)
+        @test f(nda) == f(a)
+        @test f(nda; dims=:x) == f(nda; dims=1) == f(a; dims=1)
+
+        @test dimnames(f(nda; dims=:x)[1]) == (:x, :y) == dimnames(f(nda; dims=1)[1])  # value
+        @test dimnames(f(nda; dims=:x)[2]) == (:x, :y) == dimnames(f(nda; dims=1)[2])  # index
+    end
+
     @testset "$f" for f in (cumsum, cumprod, sort, sortslices)
         @test f(nda; dims=:x) == f(nda; dims=1) == f(a; dims=1)
Repository: webpack/enhanced-resolve (js)

Issue:
Ignore `Default condition should be last one`
I am looking for a way to more closely mimic the nodejs resolution as in both https://github.com/eslint-community/eslint-plugin-n/issues/182 and https://github.com/eslint-community/eslint-plugin-n/issues/242 we have packages that don't correctly implement the exports order. However, they do resolve correctly when called in either `import` or `require`.

When debugging this initially I discoved the error was throw here: https://github.com/webpack/enhanced-resolve/blob/main/lib/util/entrypoints.js#L474-L476

What I am hoping for is that we can (via a passed in option) disable the throw?

---

I am very willing to submit code if that would help!

Pull request:
feat: allow default condition to be anywhere
### Description
This aligns the "default" condition behaviour with Node.Js. Specifically, this allows the "default" condition to be found anywhere in the "exports" without throwing an error.

### Related Issues:
- https://github.com/webpack/enhanced-resolve/issues/421
- https://github.com/eslint-community/eslint-plugin-n/issues/242
- https://github.com/oxc-project/oxc-resolver/issues/160

---

fixes #421 

Patch:
diff --git a/lib/util/entrypoints.js b/lib/util/entrypoints.js
index 392898c..bba26a6 100644
--- a/lib/util/entrypoints.js
+++ b/lib/util/entrypoints.js
@@ -464,17 +464,11 @@ function conditionalMapping(conditionalMapping_, conditionNames) {
 
 	loop: while (lookup.length > 0) {
 		const [mapping, conditions, j] = lookup[lookup.length - 1];
-		const last = conditions.length - 1;
 
 		for (let i = j; i < conditions.length; i++) {
 			const condition = conditions[i];
 
-			// assert default. Could be last only
-			if (i !== last) {
-				if (condition === "default") {
-					throw new Error("Default condition should be last one");
-				}
-			} else if (condition === "default") {
+			if (condition === "default") {
 				const innerMapping = mapping[condition];
 				// is nested
 				if (isConditionalMapping(innerMapping)) {


Test patch:
diff --git a/test/exportsField.test.js b/test/exportsField.test.js
index 057f55d..b8a0375 100644
--- a/test/exportsField.test.js
+++ b/test/exportsField.test.js
@@ -543,7 +543,7 @@ describe("Process exports field", function exportsField() {
 		},
 		{
 			name: "Direct mapping #7",
-			expect: new Error(), // Default is first one
+			expect: ["./src/index.js"], // Default is first one
 			suite: [
 				{
 					".": {
diff --git a/test/importsField.test.js b/test/importsField.test.js
index a57055f..ea6702f 100644
--- a/test/importsField.test.js
+++ b/test/importsField.test.js
@@ -451,7 +451,7 @@ describe("Process imports field", function exportsField() {
 		},
 		{
 			name: "Direct mapping #7",
-			expect: new Error(), // Default is first one
+			expect: ["./src/index.js"], // Default is first one
 			suite: [
 				{
 					"#a": {
@@ -1309,7 +1309,6 @@ describe("ImportsFieldPlugin", () => {
 				fs.rmdirSync(dir);
 				if (err) return done(err);
 				if (!result) return done(new Error("No result"));
-				console.log(result);
 				expect(result).toEqual(file);
 				done();
 			});
Repository: icebob/fastest-validator (js)

Issue:
Multiple validators + optional = false negative
```js
> (new (require('fastest-validator'))).validate({}, {
    a: [
        { type: 'number', optional: true },
        { type: 'string', optional: true },
    ]
})
[ { type: 'required',
    expected: undefined,
    actual: undefined,
    field: 'a',
    message: 'The \'a\' field is required!' } ]
```

I expected `a` not to be considered required.

Pull request:
Fixes #25
Fixes #25 and adds a testcase for it.

Patch:
diff --git a/lib/validator.js b/lib/validator.js
index fc035c9..1e389c2 100644
--- a/lib/validator.js
+++ b/lib/validator.js
@@ -185,7 +185,7 @@ Validator.prototype._checkWrapper = function(rules, isMultipleRules) {
 
 			// Check required fields
 			if ((value === undefined || value === null) && check.type !== "forbidden") {
-				if (schema.optional !== true) {
+				if (schema.optional !== true && !Array.isArray(schema)) {
 					self.handleResult(errors, stack, self.makeError("required"));
 				} else
 					continue;


Test patch:
diff --git a/test/validator.spec.js b/test/validator.spec.js
index 01d2187..674aaf1 100644
--- a/test/validator.spec.js
+++ b/test/validator.spec.js
@@ -586,6 +586,15 @@ describe("Test multiple rules", () => {
 
 	let check = v.compile(schema);
 
+	let schemaOptional = {
+		a: [
+			{ type: 'number', optional: true },
+			{ type: 'string', optional: true },
+		]
+	};
+
+	let checkOptional = v.compile(schema);
+
 	it("should give true if value is string", () => {
 		let obj = { value: "John" };
 
@@ -630,6 +639,14 @@ describe("Test multiple rules", () => {
 
 	});
 
+	it("should work with optional", () => {
+		let obj = {};
+		let res = checkOptional(obj);
+
+		expect(res).toBe(true);
+
+	});
+
 });
 
 describe("Test multiple rules with objects", () => {
Repository: JuliaStats/HypothesisTests.jl (julia)

Issue:
Lower and upper limits of CI for proportion
Should lower limit be `min(0, val)` and upper `max(val, 1)`?

for example:
```
confint(HypothesisTests.BinomialTest(0, 5), method = :agresti_coull)
```

Result
```
(**-**0.05457239484968546, 0.4890548596328611)
```

Pull request:
closes #295

Patch:
diff --git a/Project.toml b/Project.toml
index 768b4912..e707ba77 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,6 +1,6 @@
 name = "HypothesisTests"
 uuid = "09f84164-cd44-5f33-b23f-e6b0d136a0d5"
-version = "0.10.12"
+version = "0.10.13"
 
 [deps]
 Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
diff --git a/src/binomial.jl b/src/binomial.jl
index 55fcbbfa..d2aa74f4 100644
--- a/src/binomial.jl
+++ b/src/binomial.jl
@@ -140,7 +140,9 @@ end
 function ci_wald(x::BinomialTest, alpha::Float64=0.05)
     μ = x.x / x.n
     σ = sqrt(μ*(1-μ)/x.n)
-    (quantile(Normal(μ, σ), alpha/2), quantile(Normal(μ, σ), 1-alpha/2))
+    lower, upper = (quantile(Normal(μ, σ), alpha/2), quantile(Normal(μ, σ), 1-alpha/2))
+    # make sure we stay in [0, 1]
+    (max(lower, 0), min(upper, 1))
 end
 
 # Jeffreys interval
@@ -154,7 +156,8 @@ function ci_agresti_coull(x::BinomialTest, alpha::Float64=0.05)
     n = x.n + q^2
     μ = (x.x + q^2/2)/n
     σ = sqrt(μ*(1-μ)/n)
-    (μ-q*σ, μ+q*σ)
+    # make sure we stay in [0, 1]
+    (max(μ-q*σ, 0), min(μ+q*σ, 1))
 end
 
 # Wilson score interval
@@ -166,7 +169,8 @@ function ci_wilson(x::BinomialTest, alpha::Float64=0.05)
     μ /= denominator
     σ = sqrt(p*(1-p)/x.n + q^2/(4x.n^2))
     σ /= denominator
-    (μ-q*σ, μ+q*σ)
+    # make sure we stay in [0, 1]
+    (max(μ-q*σ, 0), min(μ+q*σ, 1))
 end
 
 # Arcsine transformation interval as based on Cohen's H: https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Arcsine_transformation


Test patch:
diff --git a/test/binomial.jl b/test/binomial.jl
index b0f5197d..622b168b 100644
--- a/test/binomial.jl
+++ b/test/binomial.jl
@@ -59,6 +59,20 @@ using HypothesisTests: default_tail
     t = BinomialTest(100, 100, 0.99)
     @test pvalue(t) ≈ 0.7320646825464584
     show(IOBuffer(), t)
+
+    # from issue #295
+    # without clamping: (-0.05457239484968546, 0.4890548596328611)
+    @test_ci_approx confint(BinomialTest(0, 5), method=:agresti_coull) (0.0, 0.4890548596328611)
+    # without clamping: (0.5109451403671388, 1.0545723948496855)
+    @test_ci_approx confint(BinomialTest(5, 5), method=:agresti_coull) (0.5109451403671388, 1.0)
+    # without clamping: (-0.15060901623063327, 0.5506090162306333)
+    @test_ci_approx confint(BinomialTest(1, 5), method=:wald) (0.0, 0.5506090162306333)
+    # without clamping: (0.44939098376936687, 1.1506090162306333)
+    @test_ci_approx confint(BinomialTest(4, 5), method=:wald) (0.44939098376936687, 1.0)
+    # without clamping: (-2.7755575615628914e-17, 0.2775327998628899)
+    @test_ci_approx confint(BinomialTest(0, 10), method=:wilson) (0.0, 0.2775327998628899)
+    # without clamping: (0.7575059933447587, 1.0000000000000002)
+    @test_ci_approx confint(BinomialTest(12, 12), method=:wilson) (0.7575059933447587, 1.0)
 end
 
 @testset "SignTest" begin
Repository: go-resty/resty (go)

Issue:
retry not reset multipartFields reader when RetryResetReaders is true
retry not reset multipartFields reader when RetryResetReaders is true

Pull request:
fix: retry not reset multipartField reader
fix #952 

Patch:
diff --git a/retry.go b/retry.go
index 416107e..f3198a5 100644
--- a/retry.go
+++ b/retry.go
@@ -139,6 +139,9 @@ func Backoff(operation func() (*Response, error), options ...Option) error {
 			if err := resetFileReaders(resp.Request.multipartFiles); err != nil {
 				return err
 			}
+			if err := resetFieldReaders(resp.Request.multipartFields); err != nil {
+				return err
+			}
 		}
 
 		for _, hook := range opts.retryHooks {
@@ -250,3 +253,15 @@ func resetFileReaders(files []*File) error {
 
 	return nil
 }
+
+func resetFieldReaders(fields []*MultipartField) error {
+	for _, f := range fields {
+		if rs, ok := f.Reader.(io.ReadSeeker); ok {
+			if _, err := rs.Seek(0, io.SeekStart); err != nil {
+				return err
+			}
+		}
+	}
+
+	return nil
+}


Test patch:
diff --git a/retry_test.go b/retry_test.go
index cef9e81..34dcc64 100644
--- a/retry_test.go
+++ b/retry_test.go
@@ -823,3 +823,58 @@ func TestResetMultipartReaders(t *testing.T) {
 	assertEqual(t, 500, resp.StatusCode())
 	assertNil(t, err)
 }
+
+func TestResetMultipartFieldReaderSeekStartError(t *testing.T) {
+	ts := createFilePostServer(t)
+	defer ts.Close()
+
+	testSeeker := &failingSeeker{
+		bytes.NewReader([]byte("test")),
+	}
+
+	c := dc().
+		SetRetryCount(2).
+		SetTimeout(time.Second * 3).
+		SetRetryResetReaders(true).
+		AddRetryAfterErrorCondition()
+
+	resp, err := c.R().
+		SetMultipartField("file", "audio.wav", "audio/wav", testSeeker).
+		Post(ts.URL + "/set-reset-multipart-readers-test")
+
+	assertEqual(t, 500, resp.StatusCode())
+	assertEqual(t, err.Error(), errSeekFailure.Error())
+}
+
+func TestResetMultipartFieldReaders(t *testing.T) {
+	ts := createFilePostServer(t)
+	defer ts.Close()
+
+	str := "test"
+	buf := []byte(str)
+
+	bufReader := bytes.NewReader(buf)
+	bufCpy := make([]byte, len(buf))
+
+	c := dc().
+		SetRetryCount(2).
+		SetTimeout(time.Second * 3).
+		SetRetryResetReaders(true).
+		AddRetryAfterErrorCondition().
+		AddRetryHook(
+			func(response *Response, _ error) {
+				read, err := bufReader.Read(bufCpy)
+
+				assertNil(t, err)
+				assertEqual(t, len(buf), read)
+				assertEqual(t, str, string(bufCpy))
+			},
+		)
+
+	resp, err := c.R().
+		SetMultipartField("file", "audio.wav", "audio/wav", bufReader).
+		Post(ts.URL + "/set-reset-multipart-readers-test")
+
+	assertEqual(t, 500, resp.StatusCode())
+	assertNil(t, err)
+}
Repository: platers/obsidian-linter (ts)

Issue:
Bug:  inline LaTeX ends with Chinese may fail for 1 inserted space 
## Describe the Bug
version 1.4.4, when Sapce between Chinese and English option is ON, linter will insert a space between ending Chinese and $, this may cause LaTeX fails to render properly.

## How to Reproduce

before: `$M0 = 现金$`, 
after lint: `$M0 = 现金 $`, there is one redundant space added, and obsidian latex fails. (maybe this is the problem of obsidian, github can render it correctly.)

## Expected Behavior

expects that no space added before inline latex ending $ sign.

Pull request:
Ignore Math Blocks for Chinese Spacing with English Characters or Numbers
Fixes #407 

Changes Made:
- Added inline math and regular math to the ignore types for the Chinese spacing rule
- Added a UT to verify the fix and hopefully make sure we do not come across this issue again

Patch:
diff --git a/src/rules/space-between-chinese-and-english-or-numbers.ts b/src/rules/space-between-chinese-and-english-or-numbers.ts
index 6cf3fdc..495876e 100644
--- a/src/rules/space-between-chinese-and-english-or-numbers.ts
+++ b/src/rules/space-between-chinese-and-english-or-numbers.ts
@@ -28,7 +28,7 @@ export default class SpaceBetweenChineseAndEnglishOrNumbers extends RuleBuilder<
       return text.replace(head, '$1 $3').replace(tail, '$1 $3');
     };
 
-    let newText = ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.yaml, IgnoreTypes.image, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag, IgnoreTypes.italics, IgnoreTypes.bold], text, addSpaceAroundChineseAndEnglish);
+    let newText = ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.yaml, IgnoreTypes.image, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag, IgnoreTypes.italics, IgnoreTypes.bold, IgnoreTypes.math, IgnoreTypes.inlineMath], text, addSpaceAroundChineseAndEnglish);
 
     newText = updateItalicsText(newText, addSpaceAroundChineseAndEnglish);
 


Test patch:
diff --git a/__tests__/space-between-chinese-and-english-or-numbers.test.ts b/__tests__/space-between-chinese-and-english-or-numbers.test.ts
index e2efbd8..678ae79 100644
--- a/__tests__/space-between-chinese-and-english-or-numbers.test.ts
+++ b/__tests__/space-between-chinese-and-english-or-numbers.test.ts
@@ -55,5 +55,19 @@ ruleTest({
         \`filepath = './知识_巴别图书馆.md'\`
       `,
     },
+    {
+      // accounts for https://github.com/platers/obsidian-linter/issues/407
+      testName: 'Make sure that inline math blocks are not affected',
+      before: dedent`
+        # Title Here
+
+        $M0 = 现金$
+      `,
+      after: dedent`
+        # Title Here
+
+        $M0 = 现金$
+      `,
+    },
   ],
 });
Repository: platers/obsidian-linter (ts)

Issue:
Replace tabs by spaces at frontmatter
LINTER do not work at the frontmatter section, when I use tabs instead of spaces for 
aliases:  and tabs: elements

The tabs should be replaced by spaces to make the frontmatter correct

Pull request:
Fix Frontmatter Parsing with Lines that Start with Tabs
Fixes #157 

The issue was the parser expected 2 spaces instead of a tab. To remedy this, I have gone ahead and converted tabs to 2 spaces. I am not sure how nested lists would be affected if those are even allowed in the frontmatter. Nevertheless, this should take care of the issue until it is reported that we are using nested lists if this does cause some kind of issue with that.

Changes Made:
- replaced any number of tabs after a new line character with 2 spaces when parsing the yaml frontmatter
- Added a test to help us know if the issue is accidentally created again in the future

Patch:
diff --git a/src/utils.ts b/src/utils.ts
index 5fe71a8..829106d 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -198,7 +198,9 @@ export function stripCr(text: string): string {
 }
 
 export function loadYAML(yaml_text: string): any {
-  const parsed_yaml = load(yaml_text) as {};
+  // replacing tabs at the beginning of new lines with 2 spaces fixes loading yaml that has tabs at the start of a line
+  // https://github.com/platers/obsidian-linter/issues/157
+  const parsed_yaml = load(yaml_text.replace(/\n(\t)+/g, '\n  ')) as {};
   if (!parsed_yaml) {
     return {};
   }


Test patch:
diff --git a/src/test.ts b/src/test.ts
index a86622b..f29c898 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -581,6 +581,27 @@ describe('Insert yaml attributes', () => {
     `;
     expect(rulesDict['insert-yaml-attributes'].apply(before, {'Text to insert': 'tags:'})).toBe(after);
   });
+  // accounts for https://github.com/platers/obsidian-linter/issues/157
+  it('When a file has tabs at the start of a line in the frontmatter, the yaml insertion still works leaving other tabs as they were', () => {
+    const before = dedent`
+    ---
+    title: this title\thas a tab
+    tags:
+    \t- test1
+    \t- test2
+    ---
+    `;
+    const after = dedent`
+    ---
+    blob:
+    title: this title\thas a tab
+    tags:
+    \t- test1
+    \t- test2
+    ---
+    `;
+    expect(rulesDict['insert-yaml-attributes'].apply(before, {'Text to insert': 'blob:'})).toBe(after);
+  });
 });
 
 describe('Disabled rules parsing', () => {