PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: tox-dev/tox (python)

Issue:
Consider supporting 'py2' and 'py3' default environments
- Bitbucket: https://bitbucket.org/hpk42/tox/issue/348
- Originally reported by: [tobias.mcnulty](http://bitbucket.org/tobias.mcnulty)
- Originally created at: 2016-07-19T22:12:41.440


For packages where I want to test *some* version of python3 but I don't really care which one, support for `py2` and `py3` environments would be nice, e.g.:

	[testenv:py2]
	basepython = python2

	[testenv:py3]
	basepython = python3

I can create these easily enough myself, but thought I'd submit this issue in case anyone else would find it useful.


Pull request:
fix #348 - add py2 and py3 as default envs

Patch:
diff --git a/CHANGELOG b/CHANGELOG
index 25c691f7..12828835 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,10 @@ unreleased
 - add support for py36 and py37 and add py36-dev and py37(nightly) to
   travis builds. Thanks John Vandenberg.
 
+- fix #348: add py2 and py3 as default environments pointing to
+  "python2" and "python3" basepython executables.  Also fix #347 by 
+  updating the list of default envs in the tox basic example.
+  Thanks Tobias McNulty.
 
 
 2.4.1
diff --git a/doc/example/basic.txt b/doc/example/basic.txt
index a8d074d2..5b0cf72f 100644
--- a/doc/example/basic.txt
+++ b/doc/example/basic.txt
@@ -31,15 +31,15 @@ you can run restrict the test run to the python2.6 environment.
 Available "default" test environments names are::
 
     py
-    py24
-    py25
+    py2
     py26
     py27
-    py30
-    py31
-    py32
+    py3
     py33
     py34
+    py35
+    py36
+    py37
     jython
     pypy
     pypy3
diff --git a/tox/config.py b/tox/config.py
index 38bfa1a9..dc0d4c2d 100644
--- a/tox/config.py
+++ b/tox/config.py
@@ -22,7 +22,7 @@ import tox
 iswin32 = sys.platform == "win32"
 
 default_factors = {'jython': 'jython', 'pypy': 'pypy', 'pypy3': 'pypy3',
-                   'py': sys.executable}
+                   'py': sys.executable, 'py2': 'python2', 'py3': 'python3'}
 for version in '26,27,32,33,34,35,36,37'.split(','):
     default_factors['py' + version] = 'python%s.%s' % tuple(version)
 


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index c488f583..6445a099 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1480,7 +1480,7 @@ class TestGlobalOptions:
         assert str(env.basepython) == sys.executable
 
     def test_default_environments(self, tmpdir, newconfig, monkeypatch):
-        envs = "py26,py27,py32,py33,py34,py35,py36,py37,jython,pypy,pypy3"
+        envs = "py26,py27,py32,py33,py34,py35,py36,py37,jython,pypy,pypy3,py2,py3"
         inisource = """
             [tox]
             envlist = %s
@@ -1494,6 +1494,8 @@ class TestGlobalOptions:
                 assert env.basepython == "jython"
             elif name.startswith("pypy"):
                 assert env.basepython == name
+            elif name in ("py2", "py3"):
+                assert env.basepython == 'python' + name[-1]
             else:
                 assert name.startswith("py")
                 bp = "python%s.%s" % (name[2], name[3])
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 239
Good morning! Here's your coding interview problem for today.

This problem was asked by Uber.

One way to unlock an Android phone is through a pattern of swipes across a 1-9 keypad.

For a pattern to be valid, it must satisfy the following:

All of its keys must be distinct.
It must not connect two keys by jumping over a third key, unless that key has already been used.
For example, `4 - 2 - 1 - 7` is a valid pattern, whereas `2 - 1 - 7` is not.

Find the total number of valid unlock patterns of length `N`, where `1 <= N <= 9`.

Pull request:
Day239
Resolves #491.

Patch:
diff --git a/README.md b/README.md
index d42c62a..4f7bd49 100644
--- a/README.md
+++ b/README.md
@@ -249,6 +249,7 @@ problems from
 * [Day 236](https://github.com/vaskoz/dailycodingproblem-go/issues/485)
 * [Day 237](https://github.com/vaskoz/dailycodingproblem-go/issues/487)
 * [Day 238](https://github.com/vaskoz/dailycodingproblem-go/issues/489)
+* [Day 239](https://github.com/vaskoz/dailycodingproblem-go/issues/491)
 * [Day 240](https://github.com/vaskoz/dailycodingproblem-go/issues/492)
 * [Day 241](https://github.com/vaskoz/dailycodingproblem-go/issues/493)
 * [Day 242](https://github.com/vaskoz/dailycodingproblem-go/issues/498)
diff --git a/day239/problem.go b/day239/problem.go
new file mode 100644
index 0000000..e471b02
--- /dev/null
+++ b/day239/problem.go
@@ -0,0 +1,36 @@
+package day239
+
+// ValidUnlockKeypadNumber returns the number of possible
+// valid combinations.
+func ValidUnlockKeypadNumber() int {
+	var jumps [10][10]int
+	jumps[1][3], jumps[3][1] = 2, 2
+	jumps[7][9], jumps[9][7] = 8, 8
+	jumps[1][7], jumps[7][1] = 4, 4
+	jumps[3][9], jumps[9][3] = 6, 6
+	jumps[1][9], jumps[9][1], jumps[2][8], jumps[8][2],
+		jumps[3][7], jumps[7][3], jumps[4][6], jumps[6][4] = 5, 5, 5, 5, 5, 5, 5, 5
+	var visited [10]bool
+	ways := 0
+	for numDots := 4; numDots < 10; numDots++ {
+		ways += 4 * validUnlockKeypadNumber(visited, jumps, 1, numDots-1)
+		ways += 4 * validUnlockKeypadNumber(visited, jumps, 2, numDots-1)
+		ways += validUnlockKeypadNumber(visited, jumps, 5, numDots-1)
+	}
+	return ways
+}
+
+func validUnlockKeypadNumber(visited [10]bool, jumps [10][10]int, cur, to int) int {
+	if to == 0 {
+		return 1
+	}
+	ways := 0
+	visited[cur] = true
+	for i := 1; i < 10; i++ {
+		if !visited[i] && (jumps[i][cur] == 0 || visited[jumps[i][cur]]) {
+			ways += validUnlockKeypadNumber(visited, jumps, i, to-1)
+		}
+	}
+	visited[cur] = false
+	return ways
+}


Test patch:
diff --git a/day239/problem_test.go b/day239/problem_test.go
new file mode 100644
index 0000000..4a0365f
--- /dev/null
+++ b/day239/problem_test.go
@@ -0,0 +1,16 @@
+package day239
+
+import "testing"
+
+func TestValidUnlockKeypadNumber(t *testing.T) {
+	t.Parallel()
+	if result := ValidUnlockKeypadNumber(); result != 389112 {
+		t.Errorf("Expected 389112, got %v", result)
+	}
+}
+
+func BenchmarkValidUnlockKeypadNumber(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		ValidUnlockKeypadNumber()
+	}
+}
Repository: ember-cli/ember-cli (js)

Issue:
v3.15 w/ Node 14+ crashes consistently when postBuild hook throws
Discovered during some investigative work by @dfreeman over here https://github.com/typed-ember/ember-cli-typescript/issues/1439#issuecomment-878244006

tldr: 
 - postBuild returns a rejected promise, ember-cli crashes
 - rejected promises need to be caught from postBuild



Pull request:
Handle rebuild failures without exiting
When a rebuild fails, mark it as a builder failure so the watcher doesn't re-throw it, causing it to be an unhandled error that results in the process exiting.

Fixes #9584 #9404

Patch:
diff --git a/lib/models/builder.js b/lib/models/builder.js
index 16b86a417..12e756203 100644
--- a/lib/models/builder.js
+++ b/lib/models/builder.js
@@ -221,6 +221,10 @@ class Builder extends CoreObject {
     } catch (error) {
       await this.processAddonBuildSteps('buildError', error);
 
+      // Mark this as a builder error so the watcher knows it has been handled
+      // and won't re-throw it
+      error.isBuilderError = true;
+
       throw error;
     } finally {
       clearInterval(uiProgressIntervalID);
diff --git a/lib/tasks/server/middleware/history-support/index.js b/lib/tasks/server/middleware/history-support/index.js
index 3d31dc14a..0635fa461 100644
--- a/lib/tasks/server/middleware/history-support/index.js
+++ b/lib/tasks/server/middleware/history-support/index.js
@@ -49,7 +49,16 @@ class HistorySupportAddon {
 
     app.use(async (req, _, next) => {
       try {
-        const results = await watcher;
+        let results;
+        try {
+          results = await watcher;
+        } catch (e) {
+          // This means there was a build error, so we won't actually be serving
+          // index.html, and we have nothing to do. We have to catch it here,
+          // though, or it will go uncaught and cause the process to exit.
+          return;
+        }
+
         if (this.shouldHandleRequest(req, options)) {
           let assetPath = req.path.slice(baseURL.length);
           let isFile = false;


Test patch:
diff --git a/tests/unit/models/builder-test.js b/tests/unit/models/builder-test.js
index f00f5f180..d92af8566 100644
--- a/tests/unit/models/builder-test.js
+++ b/tests/unit/models/builder-test.js
@@ -478,6 +478,20 @@ describe('models/builder.js', function () {
       await expect(builder.build()).to.be.rejected;
       expect(hooksCalled).to.deep.equal(['preBuild', 'build', 'postBuild', 'outputReady', 'buildError']);
     });
+
+    it('sets `isBuilderError` on handled addon errors', async function () {
+      addon.postBuild = function () {
+        return Promise.reject(new Error('preBuild Error'));
+      };
+
+      let error;
+      try {
+        await builder.build();
+      } catch (e) {
+        error = e;
+      }
+      expect(error).to.haveOwnProperty('isBuilderError', true);
+    });
   });
 
   describe('fallback from broccoli 2 to broccoli-builder', function () {