nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: quantumlib/OpenFermion
Pull request #30 (2017-10-12 16:28:41)

Hubbard model periodic fix
Fixed the same bug for right/left periodic conditions.

googlebot: So there's good news and bad news.

:thumbsup: The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so.  Everything is all good there.

:confused: The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter.  We need to confirm that they're okay with their commits being contributed to this project.  Please have them confirm that here in the pull request.

*Note to project maintainer: This is a terminal state, meaning the `cla/google` commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.*

<!-- need_author_consent -->

Patch:
diff --git a/src/openfermion/utils/_hubbard.py b/src/openfermion/utils/_hubbard.py
index ec3167a..1d9e072 100644
--- a/src/openfermion/utils/_hubbard.py
+++ b/src/openfermion/utils/_hubbard.py
@@ -129,7 +129,7 @@ def fermi_hubbard(x_dimension, y_dimension, tunneling, coulomb,
         # Account for periodic boundaries.
         if periodic:
             if (x_dimension > 2) and ((site + 1) % x_dimension == 0):
-                right_neighbor -= (x_dimension - 1)
+                right_neighbor -= x_dimension
             if (y_dimension > 2) and (site + x_dimension + 1 > n_sites):
                 bottom_neighbor -= x_dimension * y_dimension
 


Test patch:
diff --git a/src/openfermion/utils/_hubbard_test.py b/src/openfermion/utils/_hubbard_test.py
index 8eabe1b..0947b54 100644
--- a/src/openfermion/utils/_hubbard_test.py
+++ b/src/openfermion/utils/_hubbard_test.py
@@ -102,7 +102,6 @@ class FermiHubbardTest(unittest.TestCase):
             self.chemical_potential, self.magnetic_field,
             periodic=True, spinless=True)
 
-
     def test_two_by_three_spinless_periodic_rudimentary(self):
         hubbard_model = fermi_hubbard(
             2, 3, self.tunneling, self.coulomb,
@@ -111,3 +110,12 @@ class FermiHubbardTest(unittest.TestCase):
         # Check up top/bottom hopping terms.
         self.assertAlmostEqual(hubbard_model.terms[((4, 1), (0, 0))],
                                -self.tunneling)
+
+    def test_three_by_two_spinless_periodic_rudimentary(self):
+        hubbard_model = fermi_hubbard(
+            3, 2, self.tunneling, self.coulomb,
+            self.chemical_potential, self.magnetic_field,
+            periodic=True, spinless=True)
+        # Check up top/bottom hopping terms.
+        self.assertAlmostEqual(hubbard_model.terms[((2, 1), (0, 0))],
+                               -self.tunneling)
Repository: bytecodealliance/wasmtime
Pull request #8039 (2024-03-01 23:52:31)

Don't fail with `--env` and nonexistent env vars
Instead just leave it unset in the guest.

<!--
Please make sure you include the following information:

- If this work has been discussed elsewhere, please include a link to that
  conversation. If it was discussed in an issue, just mention "issue #...".

- Explain why this change is needed. If the details are in an issue already,
  this can be brief.

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->



Patch:
diff --git a/src/commands/run.rs b/src/commands/run.rs
index aabfe199b..c0c04c787 100644
--- a/src/commands/run.rs
+++ b/src/commands/run.rs
@@ -743,8 +743,15 @@ impl RunCommand {
         for (key, value) in self.vars.iter() {
             let value = match value {
                 Some(value) => value.clone(),
-                None => std::env::var(key)
-                    .map_err(|_| anyhow!("environment variable `{key}` not found"))?,
+                None => match std::env::var_os(key) {
+                    Some(val) => val
+                        .into_string()
+                        .map_err(|_| anyhow!("environment variable `{key}` not valid utf-8"))?,
+                    None => {
+                        // leave the env var un-set in the guest
+                        continue;
+                    }
+                },
             };
             builder.env(key, &value)?;
         }
@@ -775,8 +782,15 @@ impl RunCommand {
         for (key, value) in self.vars.iter() {
             let value = match value {
                 Some(value) => value.clone(),
-                None => std::env::var(key)
-                    .map_err(|_| anyhow!("environment variable `{key}` not found"))?,
+                None => match std::env::var_os(key) {
+                    Some(val) => val
+                        .into_string()
+                        .map_err(|_| anyhow!("environment variable `{key}` not valid utf-8"))?,
+                    None => {
+                        // leave the env var un-set in the guest
+                        continue;
+                    }
+                },
             };
             builder.env(key, &value);
         }


Test patch:
diff --git a/tests/all/cli_tests.rs b/tests/all/cli_tests.rs
index f5fcc6a5e..175d3de1a 100644
--- a/tests/all/cli_tests.rs
+++ b/tests/all/cli_tests.rs
@@ -519,7 +519,7 @@ fn specify_env() -> Result<()> {
             "tests/all/cli_tests/print_env.wat",
         ])
         .output()?;
-    assert!(!output.status.success());
+    assert!(output.status.success());
 
     Ok(())
 }