nebius/SWE-bench-extra huggingface dataset:
Repository: mathLab/EZyRB

Issue:
LOO error is an absolute error
loo_error in reducedordermodel.py is an absolute error.

Comments:

Patch:
diff --git a/ezyrb/reducedordermodel.py b/ezyrb/reducedordermodel.py
index 8f654ab..cdcb228 100644
--- a/ezyrb/reducedordermodel.py
+++ b/ezyrb/reducedordermodel.py
@@ -217,15 +217,16 @@ class ReducedOrderModel():
         db_range = list(range(len(self.database)))
 
         for j in db_range:
-            remaining_index = db_range[:]
-            remaining_index.remove(j)
-            new_db = self.database[remaining_index]
+            indeces = np.array([True] * len(self.database))
+            indeces[j] = False
+
+            new_db = self.database[indeces]
+            test_db = self.database[~indeces]
             rom = type(self)(new_db, copy.deepcopy(self.reduction),
                              copy.deepcopy(self.approximation)).fit(
                                  *args, **kwargs)
 
-            error[j] = norm(self.database.snapshots[j] -
-                            rom.predict(self.database.parameters[j]))
+            error[j] = rom.test_error(test_db)
 
         return error
 


Test patch:
diff --git a/tests/test_reducedordermodel.py b/tests/test_reducedordermodel.py
index 788bae6..7a94432 100644
--- a/tests/test_reducedordermodel.py
+++ b/tests/test_reducedordermodel.py
@@ -177,7 +177,7 @@ class TestReducedOrderModel(TestCase):
         err = rom.loo_error()
         np.testing.assert_allclose(
             err,
-            np.array([421.299091, 344.571787,  48.711501, 300.490491]),
+            np.array([0.540029, 1.211744, 0.271776, 0.919509]),
             rtol=1e-4)
 
     def test_loo_error_02(self):
@@ -188,7 +188,7 @@ class TestReducedOrderModel(TestCase):
         err = rom.loo_error(normalizer=False)
         np.testing.assert_allclose(
             err[0],
-            np.array(498.703803),
+            np.array(0.639247),
             rtol=1e-3)
 
     def test_loo_error_singular_values(self):
@@ -206,5 +206,5 @@ class TestReducedOrderModel(TestCase):
         db = Database(param, snapshots.T)
         rom = ROM(db, pod, rbf).fit()
         opt_mu = rom.optimal_mu()
-        np.testing.assert_allclose(opt_mu, [[-0.17687147, -0.21820951]],
+        np.testing.assert_allclose(opt_mu, [[-0.046381, -0.15578 ]],
             rtol=1e-4)
Repository: mathandy/svgpathtools

Issue:
Document does not add path to empty group
When the passed group element has no children, `Document.add_path` incorrectly adds the path to the root element.

Example:
```python
doc = Document()
empty = doc.add_group(group_attribs={"id": "empty"})
doc.add_path("M 0,0 L 1,1", group=empty)
print(doc)
```
Output:
```svg
<svg xmlns:svg="http://www.w3.org/2000/svg"><svg:g id="empty" /><path d="M 0,0 L 1,1" /></svg>
```

Expected Output:
```svg
<svg xmlns:svg="http://www.w3.org/2000/svg"><svg:g id="empty"><path d="M 0,0 L 1,1" /></svg:g></svg>
```

Comments:

Patch:
diff --git a/svgpathtools/document.py b/svgpathtools/document.py
index f88f5ba..1dd9077 100644
--- a/svgpathtools/document.py
+++ b/svgpathtools/document.py
@@ -289,7 +289,7 @@ class Document:
 
         # If given a list of strings (one or more), assume it represents
         # a sequence of nested group names
-        elif all(isinstance(elem, str) for elem in group):
+        elif len(group) > 0 and all(isinstance(elem, str) for elem in group):
             group = self.get_or_add_group(group)
 
         elif not isinstance(group, Element):


Test patch:
diff --git a/test/test_groups.py b/test/test_groups.py
index 44b6cb9..aeb3393 100644
--- a/test/test_groups.py
+++ b/test/test_groups.py
@@ -235,4 +235,11 @@ class TestGroups(unittest.TestCase):
 
         path = parse_path(path_d)
         svg_path = doc.add_path(path, group=new_leaf)
-        self.assertEqual(path_d, svg_path.get('d'))
\ No newline at end of file
+        self.assertEqual(path_d, svg_path.get('d'))
+
+        # Test that paths are added to the correct group
+        new_sibling = doc.get_or_add_group(
+            ['base_group', 'new_parent', 'new_sibling'])
+        doc.add_path(path, group=new_sibling)
+        self.assertEqual(len(new_sibling), 1)
+        self.assertEqual(path_d, new_sibling[0].get('d'))
Repository: mathause/mplotutils

Issue:
aspect ratio requires draw for cartopy maps
The following leads to a wrong figure size:

```
f, axs = plt.subplots(2, 1, subplot_kw=dict(projection=ccrs.Robinson()))
f.subplots_adjust(hspace=0, wspace=0, top=1, bottom=0, left=0, right=1)
mpu.set_map_layout(axs, width=17)  # width is in cm
print("Size (w x h):  ", np.round(f.get_size_inches() * 2.54, 2))
```

cartopy maps seem to require a `f.canvas.draw()` command




Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 023cb81..3afab67 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
 
 ### Bug fixes
 
+- Fixed a bug in `set_map_layout`: the data ratio of a cartopy `GeoAxesSubplot` requires
+  a `draw` to be correct ([#61](https://github.com/mathause/mplotutils/pull/61)).
 - Fix a regression introduced in [#33](https://github.com/mathause/mplotutils/pull/33):
   `cyclic_dataarray` now correctly extrapolates the coordinates
   ([#58](https://github.com/mathause/mplotutils/pull/58)).
diff --git a/mplotutils/map_layout.py b/mplotutils/map_layout.py
index 33ce41b..ab620a0 100644
--- a/mplotutils/map_layout.py
+++ b/mplotutils/map_layout.py
@@ -40,6 +40,9 @@ def set_map_layout(axes, width=17.0, *, nrow=None, ncol=None):
     # read figure data
     f = ax.get_figure()
 
+    # getting the correct data ratio of geoaxes requires draw
+    f.canvas.draw()
+
     bottom = f.subplotpars.bottom
     top = f.subplotpars.top
     left = f.subplotpars.left


Test patch:
diff --git a/mplotutils/tests/test_set_map_layout.py b/mplotutils/tests/test_set_map_layout.py
index 83aba3c..0ff4e10 100644
--- a/mplotutils/tests/test_set_map_layout.py
+++ b/mplotutils/tests/test_set_map_layout.py
@@ -195,3 +195,20 @@ def test_set_map_layout_nrow_ncol_only_one_raises():
 
     with pytest.raises(ValueError, match="Must set none or both of 'nrow' and 'ncol'"):
         set_map_layout(None, width=17.0, nrow=None, ncol=1)
+
+
+def test_set_map_layout_cartopy_2_2():
+
+    import cartopy.crs as ccrs
+
+    subplot_kw = {"projection": ccrs.PlateCarree()}
+    with subplots_context(2, 2, subplot_kw=subplot_kw) as (f, axs):
+
+        f.subplots_adjust(hspace=0, wspace=0, top=1, bottom=0, left=0, right=1)
+
+        set_map_layout(axs, width=17)  # width is in cm
+
+        result = f.get_size_inches() * 2.54
+        expected = (17, 8.5)
+
+        np.testing.assert_allclose(result, expected)
Repository: matheuscas/pycpfcnpj

Issue:
Generates numbers with punctuation marks
After the release 1.1, that handles input numbers with punctuation marks, it would be also nice generate numbers with correct punctuation marks to each type of number, CPF and CNPJ. 

Comments:

Patch:
diff --git a/README.md b/README.md
index 2bb5252..9bbf26f 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,19 @@ Expected output:
 >>> 49384063495
 >>> 20788274885880
 ```
+
+And you also can generate CPF or CǸPJ with punctuation marks. :)
+
+```python
+from pycpfcnpj import gen
+gen.cpf_with_punctuation()
+gen.cnpj_with_punctuation()
+
+Expected output:
+>>> 048.891.866-97
+>>> 63.212.638/0361-35
+```
+
 Have fun!
 
 In portuguese:
@@ -108,6 +121,19 @@ Expected output:
 >>> 20788274885880
 ```
 
+E você também pode gerar CPF ou CNPJ com pontuação :)
+
+```python
+from pycpfcnpj import gen
+gen.cpf_with_punctuation()
+gen.cnpj_with_punctuation()
+
+Expected output:
+>>> 048.891.866-97
+>>> 63.212.638/0361-35
+```
+
+
 Divirta-se!
 
 Changelog
@@ -118,3 +144,6 @@ Changelog
 
 1.2
 - Use `sys` rather than `six` to check python's version and keeps this project 100% free of dependencies.
+
+1.3
+- Generate CPF and CNPJ numbers with punctuation marks.
\ No newline at end of file
diff --git a/pycpfcnpj/gen.py b/pycpfcnpj/gen.py
index 4f86ffa..2b47d44 100644
--- a/pycpfcnpj/gen.py
+++ b/pycpfcnpj/gen.py
@@ -16,3 +16,13 @@ def cnpj():
     while not cnpj_module.validate(cnpj_ramdom):
         cnpj_ramdom = ''.join(random.choice(string.digits) for i in range(14))
     return cnpj_ramdom
+
+
+def cpf_with_punctuation():
+	cpf_ramdom = cpf()
+	return '{}.{}.{}-{}'.format(cpf_ramdom[:3], cpf_ramdom[3:6], cpf_ramdom[6:9], cpf_ramdom[9:])
+
+
+def cnpj_with_punctuation():
+	cnpj_ramdom = cnpj()
+	return '{}.{}.{}/{}-{}'.format(cnpj_ramdom[:2], cnpj_ramdom[2:5], cnpj_ramdom[5:8], cnpj_ramdom[8:12], cnpj_ramdom[12:])
\ No newline at end of file


Test patch:
diff --git a/tests/gen_test.py b/tests/gen_test.py
new file mode 100644
index 0000000..a2933a9
--- /dev/null
+++ b/tests/gen_test.py
@@ -0,0 +1,27 @@
+import unittest
+from pycpfcnpj import gen, cpf, cnpj
+
+class GenerateCPFTest(unittest.TestCase):
+	"""docstring for GenerateCPFTest"""
+	def setUp(self):
+		self.masked_valid_cpf = gen.cpf_with_punctuation()
+
+	def test_validate_masked_cnpj_true(self):
+		self.assertTrue(cpf.validate(self.masked_valid_cpf))
+
+	def test_valif_cpf_without_mask_true(self):
+		cpf_result =(self.masked_valid_cpf.replace(".","")).replace("-","")
+		self.assertTrue(cpf.validate(cpf_result))
+
+
+class GenerateCNPJTest(unittest.TestCase):
+	"""docstring for GenerateCNPJTest"""
+	def setUp(self):
+		self.masked_valid_cnpj = gen.cnpj_with_punctuation()
+
+	def test_validate_masked_cnpj_true(self):
+		self.assertTrue(cnpj.validate(self.masked_valid_cnpj))
+
+	def test_valid_cnpj_without_mask_true(self):
+		cnpj_result =(self.masked_valid_cnpj.replace(".","")).replace("-","")
+		self.assertTrue(cnpj.validate(cnpj_result))
\ No newline at end of file