PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: frictionlessdata/datapackage-py (python)
Issue: Package(schema='tabular') raises an Exception
To reproduce:

```python
import datapackage
dp = datapackage.Package(schema='tabular')
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
#   File "/home/vitor/Projetos/okfn/frictionlessdata/goodtables-py/env/lib/python3.6/site-packages/datapackage-1.1.4-py3.6.egg/datapackage/package.py", line 52, in __init__
#     descriptor['profile'] = schema
# TypeError: 'NoneType' object does not support item assignment
```
Pull request description: Fix legacy `tabular` schema Package initiation without a descriptor
- fixes #197 


Patch:
diff --git a/datapackage/package.py b/datapackage/package.py
index 45f3ac0..9f0d558 100644
--- a/datapackage/package.py
+++ b/datapackage/package.py
@@ -63,6 +63,8 @@ class Package(object):
                     schema = 'tabular-data-package'
                 elif schema == 'fiscal':
                     schema = 'fiscal-data-package'
+                if descriptor is None:
+                    descriptor = {}
                 descriptor['profile'] = schema
 
         # Handle deprecated default_base_path argument


Test patch:
diff --git a/tests/test_package.py b/tests/test_package.py
index cdf56b2..334222b 100644
--- a/tests/test_package.py
+++ b/tests/test_package.py
@@ -1337,6 +1337,11 @@ def test_package_save_slugify_fk_resource_name_issue_181():
         {'fields': 'lang', 'reference': {'resource': 'my_langs', 'fields': 'lang'}}
     ]
 
+
+def test_package_legacy_schema_tabular_issue_197():
+    package = Package(None, schema='tabular')
+
+
 # Fixtures
 
 @pytest.fixture
Repository: vaskoz/dailycodingproblem-go (go)
Issue: Day 108
Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

Given two strings A and B, return whether or not A can be shifted some number of times to get B.

For example, if A is `abcde` and B is `cdeab`, return `true`. If A is `abc` and B is `acb`, return false.
Pull request description: Day108
Resolves #227.

Patch:
diff --git a/README.md b/README.md
index 83e53a8..5be6648 100644
--- a/README.md
+++ b/README.md
@@ -117,3 +117,4 @@ problems from
 * [Day 105](https://github.com/vaskoz/dailycodingproblem-go/issues/221)
 * [Day 106](https://github.com/vaskoz/dailycodingproblem-go/issues/223)
 * [Day 107](https://github.com/vaskoz/dailycodingproblem-go/issues/225)
+* [Day 108](https://github.com/vaskoz/dailycodingproblem-go/issues/227)
diff --git a/day108/problem.go b/day108/problem.go
new file mode 100644
index 0000000..e0a64e4
--- /dev/null
+++ b/day108/problem.go
@@ -0,0 +1,40 @@
+package day108
+
+import (
+	"strings"
+)
+
+// EqualWithShifting answers if A can be converted to B
+// by shifting.
+// Runs in O(N) time.
+func EqualWithShifting(A, B string) bool {
+	if len(A) != len(B) {
+		return false
+	}
+	if len(A) == 0 {
+		return true
+	}
+	startLetter := rune(A[0])
+	startPos := strings.IndexRune(B, startLetter)
+	for {
+		if startPos == -1 {
+			return false
+		}
+		matches := 0
+		for pos := startPos; pos < startPos+len(B); pos++ {
+			if A[pos-startPos] != B[pos%len(B)] {
+				newIndex := strings.IndexRune(B[startPos+1:], startLetter)
+				if newIndex == -1 {
+					startPos = -1
+				} else {
+					startPos += (newIndex + 1)
+				}
+				break
+			}
+			matches++
+		}
+		if matches == len(A) {
+			return true
+		}
+	}
+}


Test patch:
diff --git a/day108/problem_test.go b/day108/problem_test.go
new file mode 100644
index 0000000..db58886
--- /dev/null
+++ b/day108/problem_test.go
@@ -0,0 +1,32 @@
+package day108
+
+import "testing"
+
+var testcases = []struct {
+	A, B     string
+	expected bool
+}{
+	{"abcde", "cdeab", true},
+	{"abc", "acb", false},
+	{"abc", "ac", false},
+	{"", "", true},
+	{"abcab", "cabab", true},
+	{"abcab", "acbab", false},
+}
+
+func TestEqualWithShifting(t *testing.T) {
+	t.Parallel()
+	for tcid, tc := range testcases {
+		if result := EqualWithShifting(tc.A, tc.B); result != tc.expected {
+			t.Errorf("For TCID:%d expected %v got %v", tcid, tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkEqualWithShifting(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			EqualWithShifting(tc.A, tc.B)
+		}
+	}
+}
Repository: malloydata/malloy (ts)
Issue: Better error messages for invalid SQL in sql blocks
Since we are wrapping an exception, and have no idea what the error message in the exception looks like, we just preface it with "schema error", but that ends up making it hard to understand what is going on ....

```
Schema error: Syntax error: Unexpected string literal 'bigquery-public-data.san_francisco.`sfpd_incidents
```

and then the sql interpreter gives back a line number, but it is the line in the SQL Query ... I'm thinking

```
SQL Execution Error in SQL block
    Syntax error: Unexpected string literal 'bigquery-public-data.san_francisco.`sfpd_incidents
```
Pull request description: Make understandable sql errors in blocks
`Schema Error: Syntax Error:` is a little confusing. The word schema there is related to an internal detail, that the error occured when requesting the schema for a block.

Decided to drop the `:`, and emphasize that this error is in the SQL, not in the Malloy.

Fixes #967 

```
Invalid SQL, Syntax error: Unexpected string literal 'bigquery-public-data.san_francisco.`sfpd_incidents
```

Or in the case where there are multiple lines in the server error message

```
Invalid SQL, FIRST LINE
  SECOND LINE
  THIRD LINE
```

Patch:
diff --git a/packages/malloy/src/lang/ast/ast-main.ts b/packages/malloy/src/lang/ast/ast-main.ts
index 026814e4..5d79304b 100644
--- a/packages/malloy/src/lang/ast/ast-main.ts
+++ b/packages/malloy/src/lang/ast/ast-main.ts
@@ -2393,7 +2393,8 @@ export class SQLStatement extends MalloyElement implements DocStatement {
     sqlDefEntry.reference(sql.name, this.location);
     const lookup = sqlDefEntry.getEntry(sql.name);
     if (lookup.status == "error") {
-      this.select.log(`'Schema error: ${lookup.message}`);
+      const msgLines = lookup.message.split(/\r?\n/);
+      this.select.log("Invalid SQL, " + msgLines.join("\n    "));
       return undefined;
     }
     if (lookup.status == "present") {


Test patch:
diff --git a/packages/malloy/src/lang/test/parse.spec.ts b/packages/malloy/src/lang/test/parse.spec.ts
index 68967089..7afafe74 100644
--- a/packages/malloy/src/lang/test/parse.spec.ts
+++ b/packages/malloy/src/lang/test/parse.spec.ts
@@ -1583,6 +1583,23 @@ describe("error handling", () => {
       "extraneous input '}%' expecting {<EOF>, EXPLORE, QUERY, SOURCE, SQL, IMPORT, ';'}"
     );
   });
+
+  test("bad sql in sql block", () => {
+    const badModel = new BetaModel(`sql: { select: """)""" }`);
+    expect(badModel).modelParsed();
+    const needSchema = badModel.translate();
+    expect(needSchema.compileSQL).toBeDefined();
+    if (needSchema.compileSQL) {
+      badModel.update({
+        errors: {
+          compileSQL: {
+            [needSchema.compileSQL.name]: "ZZZZ",
+          },
+        },
+      });
+    }
+    expect(badModel).compileToFailWith("Invalid SQL, ZZZZ");
+  });
 });
 
 function getSelectOneStruct(sqlBlock: SQLBlockSource): SQLBlockStructDef {
Repository: ember-cli/eslint-plugin-ember (js)
Issue: Auto-fixing 'no-get' with 'useOptionalChaining' broken with arrays
## Repro steps:
With
```
rules: {
  'ember/no-get': ['error', { useOptionalChaining: true }],
};
```
try to `--fix` the following code:
```
myFunc(myParam) {
  get(myParam, '0.myProperty');
}
```

## Expected results:
Probably something like
```
myParam['0']?.myProperty;
```

## Actual results:
```
myParam.0?.myProperty;
```
which crashes because `0` is not a valid identifier name
Pull request description: Fix autofix for array element access at beginning of path string in `no-get` rule
Fixes #997.

Before:

```js
this.get('0.foo')
```

After (old incorrect autofix):

```js
this.0?.foo
```

After (fixed autofix):

```js
this[0]?.foo
```

CC: @mongoose700

Patch:
diff --git a/lib/rules/no-get.js b/lib/rules/no-get.js
index c1a03c1c..492a5dbd 100644
--- a/lib/rules/no-get.js
+++ b/lib/rules/no-get.js
@@ -63,15 +63,16 @@ function fixGet({
   let replacementPath = isInLeftSideOfAssignmentExpression ? path : path.replace(/\./g, '?.');
 
   // Replace any array element access (foo.1 => foo[1] or foo?.[1]).
-  replacementPath = replacementPath.replace(
-    /\.(\d+)/g,
-    isInLeftSideOfAssignmentExpression ? '[$1]' : '.[$1]'
-  );
+  replacementPath = replacementPath
+    .replace(/\.(\d+)/g, isInLeftSideOfAssignmentExpression ? '[$1]' : '.[$1]') // Usages in middle of path.
+    .replace(/^(\d+)\?\./, isInLeftSideOfAssignmentExpression ? '[$1]' : '[$1]?.'); // Usage at beginning of path.
 
   // Add parenthesis around the object text in case of something like this: get(foo || {}, 'bar')
   const objectTextSafe = isValidJSPath(objectText) ? objectText : `(${objectText})`;
 
-  return fixer.replaceText(node, `${objectTextSafe}.${replacementPath}`);
+  const objectPathSeparator = replacementPath.startsWith('[') ? '' : '.';
+
+  return fixer.replaceText(node, `${objectTextSafe}${objectPathSeparator}${replacementPath}`);
 }
 
 module.exports = {


Test patch:
diff --git a/tests/lib/rules/no-get.js b/tests/lib/rules/no-get.js
index 81ace756..eb25e4c3 100644
--- a/tests/lib/rules/no-get.js
+++ b/tests/lib/rules/no-get.js
@@ -436,6 +436,18 @@ ruleTester.run('no-get', rule, {
         },
       ],
     },
+    {
+      // Handle array element access at beginning of string, with optional chaining.
+      code: "this.get('0.foo')",
+      options: [{ useOptionalChaining: true }],
+      output: 'this[0]?.foo',
+      errors: [
+        {
+          message: ERROR_MESSAGE_GET,
+          type: 'CallExpression',
+        },
+      ],
+    },
     {
       // Handle array element access (left side of an assignment).
       code: "this.get('foo.0.bar')[123] = 'hello world';",
Repository: sql-formatter-org/sql-formatter (ts)
Issue: [FORMATTING] PLSQL incorrect format of "for update" syntax 
Oracle sql text:
```
 select *  from andy.t_test for update;
```

Expect output:
```sql
 select *  
   from andy.t_test for update;
```

output in demo website:
```sql
   select *
     from andy.t_test for
   update;
```

Pull request description: Add FOR UPDATE clause support for PL/SQL
Fixes #340

Patch:
diff --git a/src/languages/plsql/plsql.formatter.ts b/src/languages/plsql/plsql.formatter.ts
index 32a8552b..aeb06484 100644
--- a/src/languages/plsql/plsql.formatter.ts
+++ b/src/languages/plsql/plsql.formatter.ts
@@ -18,6 +18,7 @@ const reservedCommands = expandPhrases([
   'ORDER [SIBLINGS] BY',
   'OFFSET',
   'FETCH {FIRST | NEXT}',
+  'FOR UPDATE',
   // Data manipulation
   // - insert:
   'INSERT [INTO | ALL INTO]',


Test patch:
diff --git a/test/plsql.test.ts b/test/plsql.test.ts
index b5c3a921..5ea29995 100644
--- a/test/plsql.test.ts
+++ b/test/plsql.test.ts
@@ -142,4 +142,26 @@ describe('PlSqlFormatter', () => {
         id = 1;
     `);
   });
+
+  // regression test for #340
+  it('formats FOR UPDATE clause', () => {
+    const result = format(`
+      SELECT * FROM tbl FOR UPDATE;
+      SELECT * FROM tbl FOR UPDATE OF tbl.salary;
+    `);
+    expect(result).toBe(dedent`
+      SELECT
+        *
+      FROM
+        tbl
+      FOR UPDATE;
+
+      SELECT
+        *
+      FROM
+        tbl
+      FOR UPDATE
+        OF tbl.salary;
+    `);
+  });
 });
Repository: kyeotic/raviger (ts)
Issue: <Link> component does not respect target attribute
Hi there, thanks for the great library!

I am not sure if it's a bug or if working as designed, I'll let you decide that, but the documentation states:

> The preferred method for navigation is the `<Link>` component, which uses all the same properties as the standard `<a>` element, and requires href.

...while in practice, when setting a `target` prop on the `<Link>` component it does not behave as expected (not as an `<a>` tag would).

E.g.: `<Link href="/dashboard" target="_blank" />` for which you would expect the link to open in a new tab.

You could argue that there is no reason to use a `<Link>` component for this use case and just revert to using a simple `<a>` instead, which would be fair.
Pull request description: dont trap Link on target=_blank
closes #24 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c221c7..6b0241a 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).
 
+## [0.5.8] - 2019-10-14
+### Fixed
+- `<Link target="_blank" />` triggering local navigation
+
 ## [0.5.7] - 2019-09-26
 ### Added
 - `<ActiveLink />`
diff --git a/src/Link.js b/src/Link.js
index 4230688..b8c6bf7 100644
--- a/src/Link.js
+++ b/src/Link.js
@@ -13,7 +13,7 @@ export default function Link(props) {
         e.preventDefault()
         throw ex
       }
-      if (shouldTrap(e)) {
+      if (shouldTrap(e, props)) {
         e.preventDefault() // prevent the link from actually navigating
         navigate(e.currentTarget.href)
       }
@@ -38,10 +38,12 @@ function getLinkHref(href, basePath = '') {
   return href.substring(0, 1) === '/' ? basePath + href : href
 }
 
-function shouldTrap(e) {
+function shouldTrap(e, props) {
+  let { target } = props
   return (
     !e.defaultPrevented && // onClick prevented default
     e.button === 0 && // ignore everything but left clicks
+    !(target || target === '_self') && // dont trap target === blank
     !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
   )
 }


Test patch:
diff --git a/test/Link.spec.js b/test/Link.spec.js
index 4858d5d..1586317 100644
--- a/test/Link.spec.js
+++ b/test/Link.spec.js
@@ -40,6 +40,16 @@ describe('Link', () => {
     act(() => void fireEvent.click(getByTestId('link')))
     expect(document.location.pathname).toEqual('/foo')
   })
+  test('doesnt navigate for target=blank', async () => {
+    act(() => navigate('/'))
+    const { getByTestId } = render(
+      <Link href="/foo" className="base" target="_blank" data-testid="link">
+        go to foo
+      </Link>
+    )
+    act(() => void fireEvent.click(getByTestId('link')))
+    expect(document.location.pathname).toEqual('/')
+  })
 })
 describe('ActiveLink', () => {
   test('adds active class when active', async () => {