nebius/SWE-bench-extra huggingface dataset:
Repository: python/bedevere

Issue:
Add docs label for PRs that touch Doc/tools/.nitignore
See e.g. https://github.com/python/cpython/pull/114280 or https://github.com/python/cpython/pull/114194

Comments:

Patch:
diff --git a/bedevere/prtype.py b/bedevere/prtype.py
index 0105e50..bccd879 100644
--- a/bedevere/prtype.py
+++ b/bedevere/prtype.py
@@ -43,7 +43,7 @@ async def classify_by_filepaths(gh, pull_request, filenames):
         if util.is_news_dir(filename):
             news = True
         filepath = pathlib.PurePath(filename)
-        if filepath.suffix == ".rst":
+        if filepath.suffix == ".rst" or filepath.name == ".nitignore":
             docs = True
         elif filepath.name.startswith("test_"):
             tests = True


Test patch:
diff --git a/tests/test_prtype.py b/tests/test_prtype.py
index 4fcaf0c..c9b0777 100644
--- a/tests/test_prtype.py
+++ b/tests/test_prtype.py
@@ -85,6 +85,26 @@ async def test_docs_no_news():
     assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]
 
 
+async def test_docs_no_news_with_dotnitignore():
+    filenames = {"path/to/docs1.rst", "path/to/.nitignore"}
+    issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
+    gh = FakeGH(getitem=issue)
+    event_data = {
+        "action": "opened",
+        "number": 1234,
+        "pull_request": {
+            "url": "https://api.github.com/repos/cpython/python/pulls/1234",
+            "statuses_url": "https://api.github.com/some/status",
+            "issue_url": "https://api.github.com/repos/cpython/python/issue/1234",
+        },
+    }
+    await prtype.classify_by_filepaths(gh, event_data["pull_request"], filenames)
+    assert gh.getitem_url == "https://api.github.com/repos/cpython/python/issue/1234"
+    assert len(gh.post_url) == 1
+    assert gh.post_url[0] == "https://api.github.com/some/label"
+    assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]
+
+
 async def test_docs_and_news():
     filenames = {"/path/to/docs1.rst", f"Misc/NEWS.d/next/Lib/{GOOD_BASENAME}"}
     issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
Repository: python/cherry-picker

Issue:
Username detection fails with a trailing slash
I have my remote origin set to ``https://github.com/AA-Turner/cpython/``.

```ps1con
PS> git remote -v
origin  https://github.com/AA-Turner/cpython/ (fetch)
origin  https://github.com/AA-Turner/cpython/ (push)
upstream        https://github.com/python/cpython/ (fetch)
upstream        https://github.com/python/cpython/ (push)
```

``cherry_picker`` runs ``git config --get remote.origin.url``, which returns the above url, and then runs ``username = result.replace(":", "/").split("/")[-2]``. This returns ``cpython``, which means that I have to manually edit the URL on every backport.

``cherry_picker`` should instead trim any trailing slash.

A

Comments:

Patch:
diff --git a/cherry_picker/cherry_picker.py b/cherry_picker/cherry_picker.py
index 66bde15..3e59f39 100755
--- a/cherry_picker/cherry_picker.py
+++ b/cherry_picker/cherry_picker.py
@@ -198,7 +198,7 @@ class CherryPicker:
         cmd = ["git", "config", "--get", f"remote.{self.pr_remote}.url"]
         result = self.run_cmd(cmd, required_real_result=True)
         # implicit ssh URIs use : to separate host from user, others just use /
-        username = result.replace(":", "/").split("/")[-2]
+        username = result.replace(":", "/").rstrip("/").split("/")[-2]
         return username
 
     def get_cherry_pick_branch(self, maint_branch):


Test patch:
diff --git a/cherry_picker/test_cherry_picker.py b/cherry_picker/test_cherry_picker.py
index bffb11d..3a9f670 100644
--- a/cherry_picker/test_cherry_picker.py
+++ b/cherry_picker/test_cherry_picker.py
@@ -343,10 +343,13 @@ def test_get_pr_url(config):
     [
         b"git@github.com:mock_user/cpython.git",
         b"git@github.com:mock_user/cpython",
+        b"git@github.com:mock_user/cpython/",
         b"ssh://git@github.com/mock_user/cpython.git",
         b"ssh://git@github.com/mock_user/cpython",
+        b"ssh://git@github.com/mock_user/cpython/",
         b"https://github.com/mock_user/cpython.git",
         b"https://github.com/mock_user/cpython",
+        b"https://github.com/mock_user/cpython/",
     ],
 )
 def test_username(url, config):
Repository: qiboteam/qibolab

Issue:
Pulse duration validation
Currently the pulse duration and start parameters are in integers of nanoseconds. However, this is an issue for instruments with sampling rates that are not 1GSps.

For the IcarusQ RFSoC, we are using a [bisection](https://github.com/qiboteam/qibolab/blob/icarusq_multiqubit/src/qibolab/instruments/icarusqfpga.py#L263-L268) to retrieve the sample indices associated with the pulse.

Perhaps this parameter can be sanitized on the driver side instead?

Comments:

Patch:
diff --git a/src/qibolab/pulses.py b/src/qibolab/pulses.py
index 90c6c1d6..100bf498 100644
--- a/src/qibolab/pulses.py
+++ b/src/qibolab/pulses.py
@@ -733,7 +733,7 @@ class Pulse:
             value (se_int | int | np.integer): the time in ns.
         """
 
-        if not isinstance(value, (se_int, int, np.integer)):
+        if not isinstance(value, (se_int, int, np.integer, float)):
             raise TypeError(f"start argument type should be intSymbolicExpression or int, got {type(value).__name__}")
         if not value >= 0:
             raise ValueError(f"start argument must be >= 0, got {value}")
@@ -749,7 +749,7 @@ class Pulse:
         else:
             if isinstance(value, np.integer):
                 self._start = int(value)
-            elif isinstance(value, int):
+            else:
                 self._start = value
 
         if not self._duration is None:
@@ -794,7 +794,7 @@ class Pulse:
         else:
             if isinstance(value, np.integer):
                 self._duration = int(value)
-            elif isinstance(value, int):
+            else:
                 self._duration = value
 
         if not self._start is None:


Test patch:
diff --git a/tests/test_pulses.py b/tests/test_pulses.py
index 9c0edb98..b4970f39 100644
--- a/tests/test_pulses.py
+++ b/tests/test_pulses.py
@@ -158,6 +158,23 @@ def test_pulses_pulse_init():
     p11 = FluxPulse(0, 40, 0.9, SNZ(t_half_flux_pulse=17, b_amplitude=0.8), 0, 200)
     p11 = Pulse(0, 40, 0.9, 400e6, 0, eCap(alpha=2), 0, PulseType.DRIVE)
 
+    # initialisation with float duration and start
+    p12 = Pulse(
+        start=5.5,
+        duration=34.33,
+        amplitude=0.9,
+        frequency=20_000_000,
+        relative_phase=1,
+        shape=Rectangular(),
+        channel=0,
+        type=PulseType.READOUT,
+        qubit=0,
+    )
+    assert repr(p12) == "Pulse(5.5, 34.33, 0.9, 20_000_000, 1, Rectangular(), 0, PulseType.READOUT, 0)"
+    assert isinstance(p12.start, float)
+    assert isinstance(p12.duration, float)
+    assert p12.finish == 5.5 + 34.33
+
 
 def test_pulses_pulse_attributes():
     channel = 0
@@ -1152,9 +1169,9 @@ def test_pulse_properties(start, duration):
     check_properties(p0)
 
 
-@pytest.mark.parametrize("faulty_start", [10.0, "hello"])
-@pytest.mark.parametrize("faulty_duration", [100.0, "hello"])
-def test_pulse_setter_errors(faulty_start, faulty_duration):
+def test_pulse_setter_errors():
+    faulty_duration = "hello"
+    faulty_start = "hello"
     with pytest.raises(TypeError):
         p0 = Pulse(faulty_start, 100, 0.9, 0, 0, Rectangular(), 0)
     with pytest.raises(TypeError):