PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: rigetticomputing/pyquil (python)

Issue:
DEFGATEs are not correct
There is a problem with DEFGATEs that has manifested itself in the `phase_estimation` module of Grove (brought to our attention here: https://github.com/rigetticomputing/grove/issues/145). 

I have traced the problem to commit d309ac11dabd9ea9c7ffa57dd26e68b5e7129aa9 

Each of the below test cases should deterministically return the input phase, for both `phase_estimation` and `estimate_gradient`. With this commit, result is not correct and nondeterministic for phase=3/4.

```
import numpy as np
import scipy.linalg
import pyquil.api as api
from grove.alpha.phaseestimation.phase_estimation import phase_estimation
from grove.alpha.jordan_gradient.gradient_utils import *
from grove.alpha.jordan_gradient.jordan_gradient import estimate_gradient

qvm = api.QVMConnection()
trials = 1
precision = 8
for phase in [1/2, 1/4, 3/4, 1/8, 1/16, 1/32]:

    Z = np.asarray([[1.0, 0.0], [0.0, -1.0]])
    Rz = scipy.linalg.expm(-1j*Z*np.pi*phase)

    p = phase_estimation(Rz, precision)
    out = qvm.run(p, list(range(precision)), trials)
    wf = qvm.wavefunction(p)

    bf_estimate = measurements_to_bf(out)
    bf_explicit = '{0:.16f}'.format(bf_estimate)
    deci_estimate = binary_to_real(bf_explicit)

    print('phase: ', phase)
    print('pe', deci_estimate)
    print('jg', estimate_gradient(phase, precision, n_measurements=trials, cxn=qvm))
    print('\n')
```


Pull request:
Bugfix/incorrect defgates
This fixes #398 

Patch:
diff --git a/pyquil/parameters.py b/pyquil/parameters.py
index e660024..0d10e5f 100644
--- a/pyquil/parameters.py
+++ b/pyquil/parameters.py
@@ -31,9 +31,11 @@ def format_parameter(element):
             out += repr(r)
 
         if i == 1:
-            out += 'i'
+            assert np.isclose(r, 0, atol=1e-14)
+            out = 'i'
         elif i == -1:
-            out += '-i'
+            assert np.isclose(r, 0, atol=1e-14)
+            out = '-i'
         elif i < 0:
             out += repr(i) + 'i'
         else:


Test patch:
diff --git a/pyquil/tests/test_parameters.py b/pyquil/tests/test_parameters.py
index c9298d2..7921057 100644
--- a/pyquil/tests/test_parameters.py
+++ b/pyquil/tests/test_parameters.py
@@ -14,6 +14,8 @@ def test_format_parameter():
         (1j, 'i'),
         (0 + 1j, 'i'),
         (-1j, '-i'),
+        (1e-15 + 1j, 'i'),
+        (1e-15 - 1j, '-i')
     ]
 
     for test_case in test_cases:
Repository: graphhopper/graphhopper (java)

Issue:
bicycle=use_sidepath not recognized; preference for cycleways is off
https://www.openstreetmap.org/directions?engine=graphhopper_bicycle&route=51.51773%2C9.94051%3B51.52776%2C9.93919#map=18/51.52173/9.94200
I'm not sure if they have their own graphhopper (and what version) or whether it is delegated to an external instance. I hope it does not matter.

The route so determined includes e.g. way 262459057, which is not allowed for bicycles due to `bicycle=use_sidepath`. Even so, the routing engine IMO should even prefer highway=cycleway over highway=primary if the time difference is miniscule.

https://www.openstreetmap.org/directions?engine=graphhopper_bicycle&route=51.51659%2C9.94031%3B51.52776%2C9.93919#map=16/51.5231/9.9442
This routing result is also a strange one. Seems like a cycle road is given (unnecessarily) higher preferrence over a cycleway.

Pull request:
Avoid "bicycle=use_sidepath" ways instead of preferring it.
Fixes #1454.
Prefering ways with "bicycle=use_sidepath" is the opposite to what is correct for bicycles. Now we are avoiding these ways.
See https://wiki.openstreetmap.org/wiki/Tag:bicycle%3Duse_sidepath.

Patch:
diff --git a/core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java b/core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java
index f34ba9423..dbcb5ef77 100644
--- a/core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java
+++ b/core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java
@@ -472,12 +472,13 @@ abstract public class BikeCommonFlagEncoder extends AbstractFlagEncoder {
             weightToPrioMap.put(100d, PREFER.getValue());
         }
 
+        if (way.hasTag("bicycle", "use_sidepath")) {
+            weightToPrioMap.put(100d, REACH_DESTINATION.getValue());
+        }
+
         if (pushingSectionsHighways.contains(highway)
                 || "parking_aisle".equals(service)) {
             int pushingSectionPrio = SLIGHT_AVOID.getValue();
-            if (way.hasTag("bicycle", "use_sidepath")) {
-                pushingSectionPrio = PREFER.getValue();
-            }
             if (way.hasTag("bicycle", "yes") || way.hasTag("bicycle", "permissive"))
                 pushingSectionPrio = PREFER.getValue();
             if (way.hasTag("bicycle", "designated") || way.hasTag("bicycle", "official"))


Test patch:
diff --git a/core/src/test/java/com/graphhopper/routing/util/BikeFlagEncoderTest.java b/core/src/test/java/com/graphhopper/routing/util/BikeFlagEncoderTest.java
index 5dd3b8dfc..4f8abfafe 100644
--- a/core/src/test/java/com/graphhopper/routing/util/BikeFlagEncoderTest.java
+++ b/core/src/test/java/com/graphhopper/routing/util/BikeFlagEncoderTest.java
@@ -227,7 +227,7 @@ public class BikeFlagEncoderTest extends AbstractBikeFlagEncoderTester {
         way.setTag("highway", "residential");
         way.setTag("bicycle", "use_sidepath");
         assertEquals(18, encoder.getSpeed(way));
-        assertPriority(PREFER.getValue(), way);
+        assertPriority(REACH_DESTINATION.getValue(), way);
 
         way.clearTags();
         way.setTag("highway", "steps");
Repository: mehcode/config-rs (rust)

Issue:
Environment::with_prefix() doesn't use custom separator.
At https://github.com/mehcode/config-rs/blob/master/src/env.rs#L81
```rust
        let prefix_pattern = match self.prefix {
            Some(ref prefix) => Some(prefix.clone() + "_"),
            _ => None,
        };
```
"_" is appended by default. Shouldn't the custom separator be appended if it exists instead?

Pull request:
Fix custom separator for group prefixes
Closes #173

Patch provided by @lyuben-todorov in #173

Patch:
diff --git a/src/env.rs b/src/env.rs
index 79472ba..5fc299d 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -76,8 +76,16 @@ impl Source for Environment {
             _ => "",
         };
 
+        let group_separator = match self.separator {
+            Some(ref separator) => separator,
+            _ => "_",
+        };
+
         // Define a prefix pattern to test and exclude from keys
-        let prefix_pattern = self.prefix.as_ref().map(|prefix| prefix.clone() + "_");
+        let prefix_pattern = self
+            .prefix
+            .as_ref()
+            .map(|prefix| format!("{}{}", prefix.clone(), group_separator));
 
         for (key, value) in env::vars() {
             // Treat empty environment variables as unset


Test patch:
diff --git a/tests/env.rs b/tests/env.rs
index bb1a1ec..ffc0572 100644
--- a/tests/env.rs
+++ b/tests/env.rs
@@ -71,3 +71,14 @@ fn test_empty_value_is_ignored() {
 
     env::remove_var("C_A_B");
 }
+
+#[test]
+fn test_custom_separator_behavior() {
+    env::set_var("C.B.A", "abc");
+
+    let environment = Environment::with_prefix("C").separator(".");
+
+    assert!(environment.collect().unwrap().contains_key("b.a"));
+
+    env::remove_var("C.B.A");
+}