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

Issue:
Add Frame around Table
As a user, I would like to print a border around my Table. I'm assuming I can do that with a Box at the moment, through some hackery, but it's not immediately obvious how to do that, and a setting on `Table` would make it much more convenient. 

Pull request:
feat(table): add `Boxed` option
### Description
Add an option to the `TablePrinter`, which adds a box around it.

### Scope
> What is affected by this pull request?

- [ ] Bug Fix
- [x] New Feature
- [ ] Documentation
- [ ] Other

### Related Issue
Fixes #225 


### To-Do Checklist
- [x] I tested my changes
- [ ] I have commented every method that I created/changed
- [ ] I updated the examples to fit with my changes
- [x] I have added tests for my newly created methods


Patch:
diff --git a/table_printer.go b/table_printer.go
index 16907e1e..747b3f8a 100644
--- a/table_printer.go
+++ b/table_printer.go
@@ -27,6 +27,7 @@ type TablePrinter struct {
 	Separator      string
 	SeparatorStyle *Style
 	Data           TableData
+	Boxed          bool
 }
 
 // WithStyle returns a new TablePrinter with a specific Style.
@@ -73,6 +74,12 @@ func (p TablePrinter) WithCSVReader(reader *csv.Reader) *TablePrinter {
 	return &p
 }
 
+// WithBoxed returns a new TablePrinter with a box around the table.
+func (p TablePrinter) WithBoxed(b ...bool) *TablePrinter {
+	p.Boxed = internal.WithBoolean(b)
+	return &p
+}
+
 // Srender renders the TablePrinter as a string.
 func (p TablePrinter) Srender() (string, error) {
 	if p.Style == nil {
@@ -118,6 +125,10 @@ func (p TablePrinter) Srender() (string, error) {
 
 	ret = strings.TrimSuffix(ret, "\n")
 
+	if p.Boxed {
+		ret = DefaultBox.Sprint(ret)
+	}
+
 	return ret, nil
 }
 


Test patch:
diff --git a/table_printer_test.go b/table_printer_test.go
index 6f4aa3d1..bff10910 100644
--- a/table_printer_test.go
+++ b/table_printer_test.go
@@ -30,6 +30,13 @@ func TestTablePrinter_WithCSVReader(t *testing.T) {
 	p2.Srender()
 }
 
+func TestTablePrinter_WithBoxed(t *testing.T) {
+	_, err := DefaultTable.WithBoxed().Srender()
+	if err != nil {
+		t.Error(err)
+	}
+}
+
 func TestTablePrinter_WithData(t *testing.T) {
 	proxyToDevNull()
 	d := TableData{
Repository: PyCQA/pyflakes (python)

Issue:
Odd edge-case regression in type annotated `__all__`
I'm not quite sure how to approach fixing this -- it regressed as part of #535 -- CC @srittau 

Here's a simplified example, this is boiled down from numpy's `numpy/typing/__init__.py`

```python
from typing import TYPE_CHECKING, List

from y import z

if not TYPE_CHECKING:
    __all__ = ("z",)
else:
    __all__: List[str]
```

After #535, the type annotation clobbers the `__all__` "`ExportBinding`" which causes it to no longer mark the imports as used

I *think* we can make `Annotated` a `setdefault` on the latest namespace to prevent this?

Pull request:
Fix annotation clobbering __all__
Resolves #605

Patch:
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 38f8f73..215bd31 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1140,7 +1140,10 @@ class Checker(object):
             # then assume the rebound name is used as a global or within a loop
             value.used = self.scope[value.name].used
 
-        self.scope[value.name] = value
+        # don't treat annotations as assignments if there is an existing value
+        # in scope
+        if value.name not in self.scope or not isinstance(value, Annotation):
+            self.scope[value.name] = value
 
     def _unknown_handler(self, node):
         # this environment variable configures whether to error on unknown


Test patch:
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 409238b..835d8d9 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -335,6 +335,19 @@ class TestTypeAnnotations(TestCase):
         def g(t: 'T'): pass
         ''')
 
+    @skipIf(version_info < (3, 6), 'new in Python 3.6')
+    def test_type_annotation_clobbers_all(self):
+        self.flakes('''\
+        from typing import TYPE_CHECKING, List
+
+        from y import z
+
+        if not TYPE_CHECKING:
+            __all__ = ("z",)
+        else:
+            __all__: List[str]
+        ''')
+
     def test_typeCommentsMarkImportsAsUsed(self):
         self.flakes("""
         from mod import A, B, C, D, E, F, G
Repository: kyeotic/raviger (ts)

Issue:
Base path matcher regexp is not case insensitive
Hi @kyeotic 👋 

We had a bug ticket in production where our silly users decided to access our single page app by changing some part of the base path URL to be lowercase (silly I know).

Unfortunately that is something that we used to support before so we had to write a temporary fix on our side.

The issue is here: https://github.com/kyeotic/raviger/blob/ea4a3f5a345268bd56af9f0716b7e49bc936d32a/src/path.js#L78-L80

If the line was changed to make the RegExp case insensitive, our problem would be solved:
```js
return new RegExp('^' + basePath, 'i')
```

Would it be possible to either make it case insensitive, or have an option to do so?

Thanks in advance!

Pull request:
fix case insensitive matching for basePath
fixes #58 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fb62c0..5cbd457 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [1.4.4] - 2020-06-26
+### Fixed
+- `basePath` matches not using case-insensitive like route paths
+
 ## [1.4.3] - 2020-05-12
 ### Fixed
 - `useQueryParam` using a `?` when no query is set
diff --git a/src/path.js b/src/path.js
index c01f006..b40dd29 100644
--- a/src/path.js
+++ b/src/path.js
@@ -76,5 +76,5 @@ function isPredicateActive(predicate) {
 }
 
 function basePathMatcher(basePath) {
-  return new RegExp('^' + basePath)
+  return new RegExp('^' + basePath, 'i')
 }


Test patch:
diff --git a/test/router.spec.js b/test/router.spec.js
index 614ad4e..078c2b0 100644
--- a/test/router.spec.js
+++ b/test/router.spec.js
@@ -79,6 +79,12 @@ describe('useRoutes', () => {
     act(() => navigate('/users/1'))
     expect(getByTestId('label')).toHaveTextContent('User 1')
   })
+  test('matches case insensitive rout', async () => {
+    const { getByTestId } = render(<Harness routes={routes} />)
+
+    act(() => navigate('/About'))
+    expect(getByTestId('label')).toHaveTextContent('about')
+  })
   test('works with lazy routes', async () => {
     let loader = new Promise(resolve => {
       setTimeout(() => resolve({ default: Route }), 50)
@@ -196,6 +202,8 @@ describe('useBasePath', () => {
     expect(getByTestId('basePath')).toHaveTextContent('none')
     act(() => navigate('/nested'))
     expect(getByTestId('basePath')).toHaveTextContent('nested')
+    act(() => navigate('/Nested'))
+    expect(getByTestId('basePath')).toHaveTextContent('nested')
   })
   test('returns empty string outside', async () => {
     const { getByTestId } = render(<Route />)
Repository: mattn/go-sqlite3 (c)

Issue:
Dead code in SQLiteRows.Next
Hello,
The following test (line 502 of sqlite.go) is useless:

```
                    switch dest[i].(type) {
                    case sql.RawBytes:
                            dest[i] = (*[1 << 30]byte)(unsafe.Pointer(p))[0:n]
                    default:
```

Just take a look at the caller:
http://golang.org/src/pkg/database/sql/sql.go?s=38519:38546#L1492

```
if rs.lastcols == nil {
    rs.lastcols = make([]driver.Value, len(rs.rowsi.Columns()))
}
rs.lasterr = rs.rowsi.Next(rs.lastcols)
```

The final/target type is not known when driver.Rows.Next is called...

Regards.


Pull request:
fix/118
* Added TestMultiBlobs
* Removed dead code

Fixes #118

Patch:
diff --git a/sqlite3.go b/sqlite3.go
index 17291dc..d8fe4b0 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -1937,8 +1937,6 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
 			}
 			n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
 			switch dest[i].(type) {
-			case sql.RawBytes:
-				dest[i] = (*[1 << 30]byte)(p)[0:n]
 			default:
 				slice := make([]byte, n)
 				copy(slice[:], (*[1 << 30]byte)(p)[0:n])


Test patch:
diff --git a/sqlite3_test.go b/sqlite3_test.go
index eadcf4a..186a2dd 100644
--- a/sqlite3_test.go
+++ b/sqlite3_test.go
@@ -1679,6 +1679,7 @@ var testTables = []string{"foo", "bar", "t", "bench"}
 var tests = []testing.InternalTest{
 	{Name: "TestResult", F: testResult},
 	{Name: "TestBlobs", F: testBlobs},
+	{Name: "TestMultiBlobs", F: testMultiBlobs},
 	{Name: "TestManyQueryRow", F: testManyQueryRow},
 	{Name: "TestTxQuery", F: testTxQuery},
 	{Name: "TestPreparedStmt", F: testPreparedStmt},
@@ -1834,6 +1835,56 @@ func testBlobs(t *testing.T) {
 	}
 }
 
+func testMultiBlobs(t *testing.T) {
+	db.tearDown()
+	db.mustExec("create table foo (id integer primary key, bar " + db.blobType(16) + ")")
+	var blob0 = []byte{0, 1, 2, 3, 4, 5, 6, 7}
+	db.mustExec(db.q("insert into foo (id, bar) values(?,?)"), 0, blob0)
+	var blob1 = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
+	db.mustExec(db.q("insert into foo (id, bar) values(?,?)"), 1, blob1)
+
+	r, err := db.Query(db.q("select bar from foo order by id"))
+	if err != nil {
+		t.Fatal(err)
+	}
+	defer r.Close()
+	if !r.Next() {
+		if r.Err() != nil {
+			t.Fatal(err)
+		}
+		t.Fatal("expected one rows")
+	}
+
+	want0 := fmt.Sprintf("%x", blob0)
+	b0 := make([]byte, 8)
+	err = r.Scan(&b0)
+	if err != nil {
+		t.Fatal(err)
+	}
+	got0 := fmt.Sprintf("%x", b0)
+
+	if !r.Next() {
+		if r.Err() != nil {
+			t.Fatal(err)
+		}
+		t.Fatal("expected one rows")
+	}
+
+	want1 := fmt.Sprintf("%x", blob1)
+	b1 := make([]byte, 16)
+	err = r.Scan(&b1)
+	if err != nil {
+		t.Fatal(err)
+	}
+	got1 := fmt.Sprintf("%x", b1)
+	if got0 != want0 {
+		t.Errorf("for []byte, got %q; want %q", got0, want0)
+	}
+	if got1 != want1 {
+		t.Errorf("for []byte, got %q; want %q", got1, want1)
+	}
+}
+
 // testManyQueryRow is test for many query row
 func testManyQueryRow(t *testing.T) {
 	if testing.Short() {
Repository: miragejs/miragejs (js)

Issue:
Shorthand route fails if it has a trailing slash
In our app we had a shorthand route set up as `this.get('/notifications/');` which broke our tests when upgrading from ember-cli-mirage 1.1.3 to 1.1.4 with the following error:

`"Mirage: The route handler for http://localhost:4200/ghost/api/v3/admin/notifications/ is trying to access the  model, but that model doesn't exist."`

![](https://cdn.discordapp.com/attachments/486704963167191042/638395725964902401/Screenshot_2019-10-28_at_15.15.51.png)

Digging in, it appears that `getModelClassFromPath()` is failing when the path has a trailing slash:

<img width="332" alt="Screenshot 2019-10-28 at 15 35 27" src="https://user-images.githubusercontent.com/415/67693342-7208c280-f999-11e9-90de-ceb446dfb35f.png">


Pull request:
fix: fix trailing slash regression during url model extraction
fixes #180

Patch:
diff --git a/lib/route-handlers/base.js b/lib/route-handlers/base.js
index 5771191..ed22479 100644
--- a/lib/route-handlers/base.js
+++ b/lib/route-handlers/base.js
@@ -19,7 +19,7 @@ export default class BaseRouteHandler {
 
       for (let i = path.length - 1; i >= 0; i--) {
         const segment = path[i];
-        if (segment[0] !== ":") {
+        if (segment.length && segment[0] !== ":") {
           lastPath = segment;
           break;
         }


Test patch:
diff --git a/__tests__/internal/unit/route-handlers/shorthands/base-test.js b/__tests__/internal/unit/route-handlers/shorthands/base-test.js
index e68c672..a999dea 100644
--- a/__tests__/internal/unit/route-handlers/shorthands/base-test.js
+++ b/__tests__/internal/unit/route-handlers/shorthands/base-test.js
@@ -31,11 +31,15 @@ describe("Unit | Route handlers | Shorthands | BaseShorthandRouteHandler", funct
   test("getModelClassFromPath works with various named route path variable", () => {
     let urlWithSlash = "/api/fancy-users";
     let urlWithIdAndSlash = "/api/fancy-users/:id";
+    let urlWithTrailingSlash = "/api/fancy-users/";
 
     expect(handler.getModelClassFromPath(urlWithSlash)).toEqual("fancy-user");
     expect(handler.getModelClassFromPath(urlWithIdAndSlash, true)).toEqual(
       "fancy-user"
     );
+    expect(handler.getModelClassFromPath(urlWithTrailingSlash)).toEqual(
+      "fancy-user"
+    );
 
     urlWithSlash = "/api/exquisite-users";
     urlWithIdAndSlash = "/api/exquisite-users/:objectId";
Repository: pypa/setuptools (python)

Issue:
40.1.0 breaks version detection on some packages
Hello;

I tried updating setuptools to 40.1.0 in the BuildRoot project, only to find a few packages such as
python-cryptography no longer seem to think setuptools is a version high enough to work.
Another package that has the same issue is python-funcsigs as well.

Downgrading to 40.0.0 fixes the issue.  Any idea as to what could be going on?

Thanks!

Pull request:
setuptools: fix regression with `egg_info` command
Ensure version is tagged only once. Fix #1462.

Patch:
diff --git a/changelog.d/1465.change.rst b/changelog.d/1465.change.rst
new file mode 100644
index 000000000..93e3e2e24
--- /dev/null
+++ b/changelog.d/1465.change.rst
@@ -0,0 +1,1 @@
+Fix regression with `egg_info` command when tagging is used.
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 5fd6c8880..74350cbd1 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -160,7 +160,9 @@ class egg_info(InfoCommon, Command):
 
     def initialize_options(self):
         self.egg_base = None
+        self.egg_name = None
         self.egg_info = None
+        self.egg_version = None
         self.broken_egg_info = False
 
     ####################################
@@ -188,15 +190,13 @@ class egg_info(InfoCommon, Command):
         egg_info['tag_date'] = 0
         edit_config(filename, dict(egg_info=egg_info))
 
-    @property
-    def egg_name(self):
-        return self.name
-
-    @property
-    def egg_version(self):
-        return self.tagged_version()
-
     def finalize_options(self):
+        # Note: we need to capture the current value returned
+        # by `self.tagged_version()`, so we can later update
+        # `self.distribution.metadata.version` without
+        # repercussions.
+        self.egg_name = self.name
+        self.egg_version = self.tagged_version()
         parsed_version = parse_version(self.egg_version)
 
         try:


Test patch:
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 1a100266e..17d40fb89 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -570,3 +570,19 @@ class TestEggInfo:
             raise AssertionError(data)
         if output:
             assert output in data
+
+    def test_egg_info_tag_only_once(self, tmpdir_cwd, env):
+        self._create_project()
+        build_files({
+            'setup.cfg': DALS("""
+                              [egg_info]
+                              tag_build = dev
+                              tag_date = 0
+                              tag_svn_revision = 0
+                              """),
+        })
+        self._run_egg_info_command(tmpdir_cwd, env)
+        egg_info_dir = os.path.join('.', 'foo.egg-info')
+        with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
+            pkg_info_lines = pkginfo_file.read().split('\n')
+        assert 'Version: 0.0.0.dev0' in pkg_info_lines
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 83
Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

Invert a binary tree.

For example, given the following tree:
```
    a
   / \
  b   c
 / \  /
d   e f
```
should become:
```
  a
 / \
 c  b
 \  / \
  f e  d
```

Pull request:
Day83
Resolves #175. 

Patch:
diff --git a/README.md b/README.md
index c4d864c..31366ee 100644
--- a/README.md
+++ b/README.md
@@ -92,3 +92,4 @@ problems from
 * [Day 80](https://github.com/vaskoz/dailycodingproblem-go/issues/168)
 * [Day 81](https://github.com/vaskoz/dailycodingproblem-go/issues/171)
 * [Day 82](https://github.com/vaskoz/dailycodingproblem-go/issues/173)
+* [Day 83](https://github.com/vaskoz/dailycodingproblem-go/issues/175)
diff --git a/day83/problem.go b/day83/problem.go
new file mode 100644
index 0000000..c8040e7
--- /dev/null
+++ b/day83/problem.go
@@ -0,0 +1,17 @@
+package day83
+
+// BinaryTree is a binary tree with string Values.
+type BinaryTree struct {
+	Value       string
+	Left, Right *BinaryTree
+}
+
+// InvertBinaryTree works in-place on the given tree.
+func InvertBinaryTree(tree *BinaryTree) {
+	if tree == nil {
+		return
+	}
+	InvertBinaryTree(tree.Left)
+	InvertBinaryTree(tree.Right)
+	tree.Left, tree.Right = tree.Right, tree.Left
+}


Test patch:
diff --git a/day83/problem_test.go b/day83/problem_test.go
new file mode 100644
index 0000000..006a89d
--- /dev/null
+++ b/day83/problem_test.go
@@ -0,0 +1,42 @@
+package day83
+
+import "testing"
+
+func TestInvertBinaryTree(t *testing.T) {
+	t.Parallel()
+	input := &BinaryTree{"a",
+		&BinaryTree{"b", &BinaryTree{"d", nil, nil}, &BinaryTree{"e", nil, nil}},
+		&BinaryTree{"c", &BinaryTree{"f", nil, nil}, nil}}
+	original := &BinaryTree{"a",
+		&BinaryTree{"b", &BinaryTree{"d", nil, nil}, &BinaryTree{"e", nil, nil}},
+		&BinaryTree{"c", &BinaryTree{"f", nil, nil}, nil}}
+	inverted := &BinaryTree{"a",
+		&BinaryTree{"c", nil, &BinaryTree{"f", nil, nil}},
+		&BinaryTree{"b", &BinaryTree{"e", nil, nil}, &BinaryTree{"d", nil, nil}}}
+	InvertBinaryTree(input)
+	if !equalTrees(input, inverted) {
+		t.Errorf("Expected it to equal the inverted tree")
+	}
+	InvertBinaryTree(input)
+	if !equalTrees(input, original) {
+		t.Errorf("Invert an invert should match the original")
+	}
+}
+
+func BenchmarkInvertBinaryTree(b *testing.B) {
+	input := &BinaryTree{"a",
+		&BinaryTree{"b", &BinaryTree{"d", nil, nil}, &BinaryTree{"e", nil, nil}},
+		&BinaryTree{"c", &BinaryTree{"f", nil, nil}, nil}}
+	for i := 0; i < b.N; i++ {
+		InvertBinaryTree(input)
+	}
+}
+
+func equalTrees(one, two *BinaryTree) bool {
+	if one == nil && two == nil {
+		return true
+	} else if (one == nil && two != nil) || (one != nil && two == nil) || (one.Value != two.Value) {
+		return false
+	}
+	return equalTrees(one.Left, two.Left) || equalTrees(one.Right, two.Right)
+}
Repository: Textualize/rich (python)

Issue:
[BUG] Style.clear_meta_and_links should reset hash
The hash of a `Style` instance depends on `_meta` and `_link`:

https://github.com/Textualize/rich/blob/6d30ad0f30028210124c149811cbbe2b183711f9/rich/style.py#L432-L445

So, when the link and meta are cleared with the method `Style.clear_meta_and_links`, the cached hash should be cleared:

https://github.com/Textualize/rich/blob/6d30ad0f30028210124c149811cbbe2b183711f9/rich/style.py#L664-L668

Pull request:
Clear hashed cache when clearing meta.
This fixes #2942.

## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e47aa39a..6911c40c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fix pretty repr for `collections.deque` https://github.com/Textualize/rich/pull/2864
 - Thread used in progress.track will exit if an exception occurs in a generator https://github.com/Textualize/rich/pull/3402
 - Progress track thread is now a daemon thread https://github.com/Textualize/rich/pull/3402
+- Fixed cached hash preservation upon clearing meta and links https://github.com/Textualize/rich/issues/2942
 
 ### Changed
 
diff --git a/rich/style.py b/rich/style.py
index 313c8894..262fd6ec 100644
--- a/rich/style.py
+++ b/rich/style.py
@@ -663,7 +663,7 @@ class Style:
         style._set_attributes = self._set_attributes
         style._link = None
         style._link_id = ""
-        style._hash = self._hash
+        style._hash = None
         style._null = False
         style._meta = None
         return style


Test patch:
diff --git a/tests/test_style.py b/tests/test_style.py
index b5c01729..84a65a67 100644
--- a/tests/test_style.py
+++ b/tests/test_style.py
@@ -251,3 +251,17 @@ def test_clear_meta_and_links():
     assert clear_style.bgcolor == Color.parse("black")
     assert clear_style.bold
     assert not clear_style.italic
+
+
+def test_clear_meta_and_links_clears_hash():
+    """Regression test for https://github.com/Textualize/rich/issues/2942."""
+
+    style = Style.parse("bold red on black link https://example.org") + Style.on(
+        click="CLICK"
+    )
+    hash(style)  # Force hash caching.
+
+    assert style._hash is not None
+
+    clear_style = style.clear_meta_and_links()
+    assert clear_style._hash is None