PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: CS-SI/eodag (python)
Issue: Impossible to download data with providers using api plugin in REST mode
In REST mode, when a provider does not get the download plugin, data download fails with the following error :
`AttributeError: 'ProviderConfig' object has no attribute 'download'`

Pull request description: fix: server-mode download for ext api providers
Fixes #733

In server mode, products download with python external api providers works once again by removing the set up of `extract` attribute of the plugin `download` because this plugin is not theirs by their nature. 

It does not have an impact on extraction process because `extraction` is directly set in `download` method call parameters and it takes priority on providers configuration.

Patch:
diff --git a/eodag/rest/utils.py b/eodag/rest/utils.py
index de5d168a..e9955275 100644
--- a/eodag/rest/utils.py
+++ b/eodag/rest/utils.py
@@ -589,8 +589,6 @@ def download_stac_item_by_id(catalogs, item_id, provider=None):
 
     product = search_product_by_id(item_id, product_type=catalogs[0])[0]
 
-    eodag_api.providers_config[product.provider].download.extract = False
-
     product_path = eodag_api.download(product, extract=False)
 
     if os.path.isdir(product_path):


Test patch:
diff --git a/tests/units/test_http_server.py b/tests/units/test_http_server.py
index 72f97057..f302ef06 100644
--- a/tests/units/test_http_server.py
+++ b/tests/units/test_http_server.py
@@ -627,7 +627,7 @@ class RequestTestCase(unittest.TestCase):
         "eodag.rest.utils.eodag_api.download",
         autospec=True,
     )
-    def test_download_item_from_collection(self, mock_download):
+    def test_download_item_from_collection_api_plugin(self, mock_download):
         """Download through eodag server catalog should return a valid response"""
         # download returns a file that must be returned as is
         tmp_dl_dir = TemporaryDirectory()
@@ -635,6 +635,11 @@ class RequestTestCase(unittest.TestCase):
         Path(expected_file).touch()
         mock_download.return_value = expected_file
 
+        # use an external python API provider for this test
+        self._request_valid_raw.patchings[0].kwargs["return_value"][0][
+            0
+        ].provider = "cop_cds"
+
         response = self._request_valid_raw(
             f"collections/{self.tested_product_type}/items/foo/download"
         )
Repository: bytedance/sonic (go)
Issue: 能否添加一个MarshalIndent在根方法那里？
现在的标准库有 `json.MarshalIndent` 这个方法，sonic要通过设定一个config才能使用`sonic.ConfigStd.MarshalIndent`，能否与标准包的方法保持一致？


Pull request description: chore: export MarshalIndent api in root
Fix #665 

Patch:
diff --git a/api.go b/api.go
index 0933291..ef9f8ef 100644
--- a/api.go
+++ b/api.go
@@ -157,6 +157,13 @@ func Marshal(val interface{}) ([]byte, error) {
     return ConfigDefault.Marshal(val)
 }
 
+// MarshalIndent is like Marshal but applies Indent to format the output.
+// Each JSON element in the output will begin on a new line beginning with prefix
+// followed by one or more copies of indent according to the indentation nesting.
+func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
+    return ConfigDefault.MarshalIndent(v, prefix, indent)
+}
+
 // MarshalString returns the JSON encoding string of v.
 func MarshalString(val interface{}) (string, error) {
     return ConfigDefault.MarshalToString(val)


Test patch:
diff --git a/api_test.go b/api_test.go
index 04ec727..ee81632 100644
--- a/api_test.go
+++ b/api_test.go
@@ -49,3 +49,21 @@ func TestValid(t *testing.T) {
         require.Equal(t, tc.expected, Valid([]byte(tc.data)), tc.data)
     }
 }
+
+
+func TestIdent(t *testing.T) {
+    foo := struct {
+        Name string
+        Age  int
+    }{
+        Name: "sonic",
+        Age:  20,
+    }
+
+    out, err := MarshalIndent(&foo, "", "  ")
+    require.Nil(t, err)
+    require.Equal(t, `{
+  "Name": "sonic",
+  "Age": 20
+}`, string(out))
+}
Repository: go-openapi/strfmt (go)
Issue: Parse negative special durations as negative durations
Simply put, if you parse `strfmt.ParseDuration("-1h")`, you will correctly get minus 1 hour. However, when using the "enhanced" durations like `d`/`w`, you will not get a negative duration, but a positive one. So `strfmt.ParseDuration("-1d")` will result in a _positive_ day duration.
Pull request description: Fix negative duration parsing
Only the one the negative one that could be parsed with strconv.ParseDuration were working.
Now all negative durations are working.

Fixes #143

Patch:
diff --git a/duration.go b/duration.go
index 0d85140..7b14a69 100644
--- a/duration.go
+++ b/duration.go
@@ -60,7 +60,7 @@ var (
 		"w":  hoursInDay * daysInWeek * time.Hour,
 	}
 
-	durationMatcher = regexp.MustCompile(`((\d+)\s*([A-Za-zµ]+))`)
+	durationMatcher = regexp.MustCompile(`(((?:-\s?)?\d+)\s*([A-Za-zµ]+))`)
 )
 
 // IsDuration returns true if the provided string is a valid duration
@@ -102,10 +102,19 @@ func ParseDuration(cand string) (time.Duration, error) {
 	ok := false
 	for _, match := range durationMatcher.FindAllStringSubmatch(cand, -1) {
 
-		factor, err := strconv.Atoi(match[2]) // converts string to int
+		// remove possible leading - and spaces
+		value, negative := strings.CutPrefix(match[2], "-")
+
+		// if the string is a valid duration, parse it
+		factor, err := strconv.Atoi(strings.TrimSpace(value)) // converts string to int
 		if err != nil {
 			return 0, err
 		}
+
+		if negative {
+			factor = -factor
+		}
+
 		unit := strings.ToLower(strings.TrimSpace(match[3]))
 
 		for _, variants := range timeUnits {


Test patch:
diff --git a/duration_test.go b/duration_test.go
index 75562d2..cfee1bc 100644
--- a/duration_test.go
+++ b/duration_test.go
@@ -123,7 +123,6 @@ func TestDurationScanner_Nil(t *testing.T) {
 
 func TestDurationParser(t *testing.T) {
 	testcases := map[string]time.Duration{
-
 		// parse the short forms without spaces
 		"1ns": 1 * time.Nanosecond,
 		"1us": 1 * time.Microsecond,
@@ -182,10 +181,18 @@ func TestDurationParser(t *testing.T) {
 	}
 
 	for str, dur := range testcases {
-		testDurationParser(t, str, dur)
-		testDurationSQLScanner(t, dur)
+		t.Run(str, func(t *testing.T) {
+			testDurationParser(t, str, dur)
+
+			// negative duration
+			testDurationParser(t, "-"+str, -dur)
+			testDurationParser(t, "- "+str, -dur)
+
+			testDurationSQLScanner(t, dur)
+		})
 	}
 }
+
 func TestIsDuration_Caveats(t *testing.T) {
 	// This works too
 	e := IsDuration("45 weeks")
@@ -206,7 +213,6 @@ func TestIsDuration_Caveats(t *testing.T) {
 	// This does not work
 	e = IsDuration("12 phours")
 	assert.False(t, e)
-
 }
 
 func TestDeepCopyDuration(t *testing.T) {