PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: pion/mediadevices (go)

Issue:
Add video throttle transform
Drop frames to limit output framerate.

Pull request:
Add video throttle transform
### Reference issue
Fixes #63


Patch:
diff --git a/pkg/io/video/throttle.go b/pkg/io/video/throttle.go
new file mode 100644
index 0000000..45707ce
--- /dev/null
+++ b/pkg/io/video/throttle.go
@@ -0,0 +1,28 @@
+package video
+
+import (
+	"image"
+	"time"
+)
+
+// Throttle returns video throttling transform.
+// This transform drops some of the incoming frames to achieve given framerate in fps.
+func Throttle(rate float32) TransformFunc {
+	return func(r Reader) Reader {
+		ticker := time.NewTicker(time.Duration(int64(float64(time.Second) / float64(rate))))
+		return ReaderFunc(func() (image.Image, error) {
+			for {
+				img, err := r.Read()
+				if err != nil {
+					ticker.Stop()
+					return nil, err
+				}
+				select {
+				case <-ticker.C:
+					return img, nil
+				default:
+				}
+			}
+		})
+	}
+}


Test patch:
diff --git a/pkg/io/video/throttle_test.go b/pkg/io/video/throttle_test.go
new file mode 100644
index 0000000..d6536fa
--- /dev/null
+++ b/pkg/io/video/throttle_test.go
@@ -0,0 +1,34 @@
+package video
+
+import (
+	"image"
+	"testing"
+	"time"
+)
+
+func TestThrottle(t *testing.T) {
+	img := image.NewRGBA(image.Rect(0, 0, 640, 480))
+
+	ticker := time.NewTicker(time.Millisecond)
+	defer ticker.Stop()
+
+	var cntPush int
+	trans := Throttle(100)
+	r := trans(ReaderFunc(func() (image.Image, error) {
+		<-ticker.C
+		cntPush++
+		return img, nil
+	}))
+
+	for i := 0; i < 50; i++ {
+		_, err := r.Read()
+		if err != nil {
+			t.Fatalf("Unexpected error: %v", err)
+		}
+	}
+	cntExpected := 500
+	if cntPush < cntExpected*9/10 || cntExpected*11/10 < cntPush {
+		t.Fatalf("Number of pushed images is expected to be %d, but pushed %d", cntExpected, cntPush)
+	}
+	t.Log(cntPush)
+}
Repository: Hopding/pdf-lib (ts)

Issue:
[Feature request] Add PDFDocument.setLanguage method
This method should set the language on the PDF document as described in the following specification: https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf

More specifically, it should add an entry named `Lang` in the catalog.

Pull request:
resolves #258 add PDFDocument.setLanguage method

Patch:
diff --git a/src/api/PDFDocument.ts b/src/api/PDFDocument.ts
index 19a35c6..e2ec917 100644
--- a/src/api/PDFDocument.ts
+++ b/src/api/PDFDocument.ts
@@ -294,6 +294,25 @@ export default class PDFDocument {
     this.getInfoDict().set(key, PDFHexString.fromText(producer));
   }
 
+  /**
+   * Set this document's language metadata. The language will appear in the
+   * "Document Properties" section of most PDF readers. For example:
+   * ```js
+   * pdfDoc.setLanguage('en-us')
+   * ```
+   *
+   * A language identifier shall either be the empty text string,
+   * to indicate that the language is unknown,
+   * or a Language-Tag as defined in RFC 3066.
+   *
+   * @param language The language of this document.
+   */
+  setLanguage(language: string): void {
+    assertIs(language, 'language', ['string']);
+    const key = PDFName.of('Lang');
+    this.catalog.set(key, PDFString.of(language));
+  }
+
   /**
    * Set this document's creation date metadata. The creation date will appear
    * in the "Document Properties" section of most PDF readers. For example:


Test patch:
diff --git a/tests/api/PDFDocument.spec.ts b/tests/api/PDFDocument.spec.ts
index 88bd999..30a3e42 100644
--- a/tests/api/PDFDocument.spec.ts
+++ b/tests/api/PDFDocument.spec.ts
@@ -3,6 +3,7 @@ import {
   EncryptedPDFError,
   ParseSpeeds,
   PDFDocument,
+  PDFName,
   PDFPage,
 } from 'src/index';
 
@@ -120,6 +121,24 @@ describe(`PDFDocument`, () => {
     });
   });
 
+  describe(`setLanguage() method`, () => {
+    let pdfDoc: PDFDocument;
+    beforeAll(async () => {
+      const parseSpeed = ParseSpeeds.Fastest;
+      pdfDoc = await PDFDocument.load(unencryptedPdfBytes, { parseSpeed });
+    });
+
+    it(`sets the language of the document`, () => {
+      expect(pdfDoc.catalog.get(PDFName.of('Lang'))).toBe(undefined);
+      pdfDoc.setLanguage('fr-FR');
+      expect(String(pdfDoc.catalog.get(PDFName.of('Lang')))).toBe('(fr-FR)');
+      pdfDoc.setLanguage('en');
+      expect(String(pdfDoc.catalog.get(PDFName.of('Lang')))).toBe('(en)');
+      pdfDoc.setLanguage('');
+      expect(String(pdfDoc.catalog.get(PDFName.of('Lang')))).toBe('()');
+    });
+  });
+
   describe(`getPageCount() method`, () => {
     let pdfDoc: PDFDocument;
     beforeAll(async () => {
Repository: mr-linch/go-tg (go)

Issue:
Sending files using urls always fails 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x10481a3fc]

Pull request:
fix(tg): send files by URL
close #113 

Patch:
diff --git a/request.go b/request.go
index 0d49c81..5b9ede9 100644
--- a/request.go
+++ b/request.go
@@ -76,11 +76,11 @@ func (r *Request) FileID(name string, v FileID) *Request {
 }
 
 func (r *Request) File(name string, arg FileArg) *Request {
-	if arg.FileID != "" {
-		return r.String(name, string(arg.FileID))
-	} else {
-		return r.InputFile(name, arg.Upload)
+	if arg.isRef() {
+		return r.String(name, arg.getRef())
 	}
+
+	return r.InputFile(name, arg.Upload)
 }
 
 func (r *Request) InputMediaSlice(name string, im []InputMedia) *Request {
@@ -99,7 +99,7 @@ func (r *Request) InputMedia(im InputMedia) *Request {
 	id := fmt.Sprintf("attachment_%d", r.attachmentIdx)
 	addr := fmt.Sprintf("attach://%s", id)
 
-	if media.getString() == "" {
+	if media.getRef() == "" {
 		r.InputFile(id, media.Upload)
 		media.addr = addr
 		r.attachmentIdx++
diff --git a/types_gen_ext.go b/types_gen_ext.go
index 57290f9..466cbb4 100644
--- a/types_gen_ext.go
+++ b/types_gen_ext.go
@@ -168,7 +168,7 @@ func NewFileArgID(id FileID) FileArg {
 }
 
 func (arg FileArg) MarshalJSON() ([]byte, error) {
-	str := arg.getString()
+	str := arg.getRef()
 	if str != "" {
 		return json.Marshal(str)
 	}
@@ -176,7 +176,13 @@ func (arg FileArg) MarshalJSON() ([]byte, error) {
 	return nil, fmt.Errorf("FileArg is not json serializable")
 }
 
-func (arg *FileArg) getString() string {
+// isRef returns true if FileArg is just reference
+func (arg *FileArg) isRef() bool {
+	return arg.FileID != "" || arg.URL != "" || arg.addr != ""
+}
+
+// getRef returns text representation of reference
+func (arg *FileArg) getRef() string {
 	if arg.FileID != "" {
 		return string(arg.FileID)
 	} else if arg.URL != "" {


Test patch:
diff --git a/request_test.go b/request_test.go
index 5bf4f09..763df6e 100644
--- a/request_test.go
+++ b/request_test.go
@@ -33,6 +33,9 @@ func TestRequest_Setters(t *testing.T) {
 	r.File("file_by_id", FileArg{
 		FileID: "file_id",
 	})
+	r.File("file_by_url", FileArg{
+		URL: "file_url",
+	})
 	r.File("file_input", FileArg{
 		Upload: NewInputFileBytes("file_name", []byte("file_content")),
 	})
@@ -61,6 +64,7 @@ func TestRequest_Setters(t *testing.T) {
 		"bool",
 		"chat",
 		"file_by_id",
+		"file_by_url",
 		"file_id",
 		"float64",
 		"foo",
diff --git a/types_gen_ext_test.go b/types_gen_ext_test.go
index 4f40198..0267bde 100644
--- a/types_gen_ext_test.go
+++ b/types_gen_ext_test.go
@@ -532,7 +532,7 @@ func TestFileArg_getString(t *testing.T) {
 			Want:    "addr",
 		},
 	} {
-		assert.Equal(t, test.Want, test.FileArg.getString())
+		assert.Equal(t, test.Want, test.FileArg.getRef())
 	}
 }
Repository: JuliaManifolds/ManifoldsBase.jl (julia)

Issue:
Should representation_size return nothing by default?
As in the title, I think this would allow for better support of manifolds that don't have `representation_size`.

Pull request:
Resolves #34 and #41

Patch:
diff --git a/Project.toml b/Project.toml
index c2981bb9a..e1fc239bd 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
 name = "ManifoldsBase"
 uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
 authors = ["Seth Axen <seth.axen@gmail.com>", "Mateusz Baran <mateuszbaran89@gmail.com>", "Ronny Bergmann <manopt@ronnybergmann.net>", "Antoine Levitt <antoine.levitt@gmail.com>"]
-version = "0.8.3"
+version = "0.9.0"
 
 [deps]
 LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
diff --git a/src/ManifoldsBase.jl b/src/ManifoldsBase.jl
index 17580e199..6e305fe28 100644
--- a/src/ManifoldsBase.jl
+++ b/src/ManifoldsBase.jl
@@ -217,8 +217,7 @@ Return type of element of the array that will represent the result of function `
 [`Manifold`](@ref) `M` on given arguments `args` (passed as a tuple).
 """
 function allocate_result_type(M::Manifold, f, args::NTuple{N,Any}) where {N}
-    T = typeof(reduce(+, one(number_eltype(eti)) for eti ∈ args))
-    return T
+    return typeof(mapreduce(eti -> one(number_eltype(eti)), +, args))
 end
 
 """
@@ -579,12 +578,10 @@ To be used in conjuntion with [`allocate`](@ref) or [`allocate_result`](@ref).
 """
 number_eltype(x) = eltype(x)
 function number_eltype(x::AbstractArray)
-    T = typeof(reduce(+, one(number_eltype(eti)) for eti ∈ x))
-    return T
+    return typeof(mapreduce(eti -> one(number_eltype(eti)), +, x))
 end
 function number_eltype(x::Tuple)
-    T = typeof(reduce(+, one(number_eltype(eti)) for eti ∈ x))
-    return T
+    return typeof(mapreduce(eti -> one(number_eltype(eti)), +, x))
 end
 
 """
@@ -664,9 +661,11 @@ end
     representation_size(M::Manifold)
 
 The size of an array representing a point on [`Manifold`](@ref) `M`.
+Returns `nothing` by default indicating that points are not represented using an
+`AbstractArray`.
 """
 function representation_size(M::Manifold)
-    error(manifold_function_not_implemented_message(M, representation_size))
+    return nothing
 end
 
 """


Test patch:
diff --git a/test/empty_manifold.jl b/test/empty_manifold.jl
index 33c86b25a..e99a4aa98 100644
--- a/test/empty_manifold.jl
+++ b/test/empty_manifold.jl
@@ -11,9 +11,9 @@ struct NonCoTVector <: CoTVector end
     M = NonManifold()
     p = NonMPoint()
     v = NonTVector()
-    @test base_manifold(M) == M
-    @test number_system(M) == ℝ
-    @test_throws ErrorException ManifoldsBase.representation_size(M)
+    @test base_manifold(M) === M
+    @test number_system(M) === ℝ
+    @test representation_size(M) === nothing
 
     @test_throws ErrorException manifold_dimension(M)
Repository: Hacker0x01/react-datepicker (ts)

Issue:
The calendar dialog is missing an accessibility property
**Describe the bug**
According to the ARIA authoring practices guide the dialog should contain an aria-label. [Link](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/#:~:text=dialog%20is%20modal.-,aria%2Dlabel%3D%22string%22,-div)


**To Reproduce**

1. Open up calendar
2. Notice there is no aria-label on the aria-modal

**Expected behavior**
aria-label should be set on the aria-modal dialog to something like "choose date".

**Screenshots**
![image](https://github.com/Hacker0x01/react-datepicker/assets/125996778/6c785029-0a32-4781-9ab6-c604cdef569c)

**Additional context**
This is our last open issue from our accessibility vendor on our date picker component. Good job!


Pull request:
Add aria-label to calendar container for accessibility
Fixes #4555

Patch:
diff --git a/src/calendar_container.jsx b/src/calendar_container.jsx
index f02348e1..346d0b06 100644
--- a/src/calendar_container.jsx
+++ b/src/calendar_container.jsx
@@ -3,7 +3,7 @@ import React from "react";
 
 export default function CalendarContainer({ className, children }) {
   return (
-    <div className={className} role="dialog" aria-modal="true">
+    <div className={className} role="dialog" aria-label="Choose Date" aria-modal="true">
       {children}
     </div>
   );


Test patch:
diff --git a/test/calendar_test.test.js b/test/calendar_test.test.js
index d452add0..e21a25a1 100644
--- a/test/calendar_test.test.js
+++ b/test/calendar_test.test.js
@@ -1833,6 +1833,7 @@ describe("Calendar", () => {
       expect(dialog).not.toBeNull();
       expect(dialog.getAttribute("role")).toBe("dialog");
       expect(dialog.getAttribute("aria-modal")).toBe("true");
+      expect(dialog.getAttribute("aria-label")).toBe("Choose Date");
     });
   });
 });