Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-nilearn for openSUSE:Factory 
checked in at 2023-08-10 15:34:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nilearn (Old)
 and      /work/SRC/openSUSE:Factory/.python-nilearn.new.11712 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-nilearn"

Thu Aug 10 15:34:51 2023 rev:3 rq:1103307 version:0.10.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nilearn/python-nilearn.changes    
2023-06-28 21:33:48.882021222 +0200
+++ /work/SRC/openSUSE:Factory/.python-nilearn.new.11712/python-nilearn.changes 
2023-08-10 15:35:07.116619607 +0200
@@ -1,0 +2,6 @@
+Thu Aug 10 09:12:46 UTC 2023 - Daniel Garcia <daniel.gar...@suse.com>
+
+- Add numpy-1.25.patch, upstream patch gh#nilearn/nilearn#3746
+- Add warning-based-sklearn-version.patch, upstream patch 
gh#nilearn/nilearn#3763
+
+-------------------------------------------------------------------

New:
----
  numpy-1.25.patch
  warning-based-sklearn-version.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-nilearn.spec ++++++
--- /var/tmp/diff_new_pack.Omha8z/_old  2023-08-10 15:35:07.864624271 +0200
+++ /var/tmp/diff_new_pack.Omha8z/_new  2023-08-10 15:35:07.868624297 +0200
@@ -24,6 +24,10 @@
 Group:          Development/Languages/Python
 URL:            https://github.com/nilearn/nilearn
 Source:         
https://files.pythonhosted.org/packages/source/n/nilearn/nilearn-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM numpy-1.25.patch gh#nilearn/nilearn#3746
+Patch0:         numpy-1.25.patch
+# PATCH-FIX-UPSTREAM warning-based-sklearn-version.patch 
gh#nilearn/nilearn#3763
+Patch1:         warning-based-sklearn-version.patch
 BuildRequires:  %{python_module base >= 3.7}
 BuildRequires:  %{python_module hatch_vcs}
 BuildRequires:  %{python_module hatchling}
@@ -59,7 +63,7 @@
 NeuroImaging data.
 
 %prep
-%setup -n nilearn-%{version}
+%autosetup -p1 -n nilearn-%{version}
 chmod -x nilearn/datasets/tests/data/localizer_index.json
 sed -i '1{/env python/d}' nilearn/glm/tests/test_utils.py 
nilearn/plotting/glass_brain_files/plot_align_svg.py
 

++++++ numpy-1.25.patch ++++++
diff --git a/nilearn/image/resampling.py b/nilearn/image/resampling.py
index da34963a7d..778740c08c 100644
--- a/nilearn/image/resampling.py
+++ b/nilearn/image/resampling.py
@@ -686,8 +686,8 @@ def resample_img(
         # preventing ringing artefact
         # We need to add zero as a value considered for clipping, as it
         # appears in padding images.
-        vmin = min(data.min(), 0)
-        vmax = max(data.max(), 0)
+        vmin = min(np.nanmin(data), 0)
+        vmax = max(np.nanmax(data), 0)
         resampled_data.clip(vmin, vmax, out=resampled_data)
 
     return new_img_like(img, resampled_data, target_affine)
diff --git a/nilearn/image/tests/test_resampling.py 
b/nilearn/image/tests/test_resampling.py
index 483aec9f99..3e63a9a016 100644
--- a/nilearn/image/tests/test_resampling.py
+++ b/nilearn/image/tests/test_resampling.py
@@ -586,8 +586,7 @@ def test_resampling_nan(affine, core_shape):
 
     # check 3x3 transformation matrix
     target_affine = np.eye(3)[axis_permutation]
-    with pytest.warns(Warning, match=r"(\bnan\b|invalid value)"):
-        resampled_img = resample_img(source_img, target_affine=target_affine)
+    resampled_img = resample_img(source_img, target_affine=target_affine)
 
     resampled_data = get_data(resampled_img)
     if full_data.ndim == 4:
diff --git a/nilearn/maskers/nifti_maps_masker.py 
b/nilearn/maskers/nifti_maps_masker.py
index b0cbaf386e..13cf1a2d26 100644
--- a/nilearn/maskers/nifti_maps_masker.py
+++ b/nilearn/maskers/nifti_maps_masker.py
@@ -228,10 +228,17 @@ def generate_report(self, displayed_maps=10):
         """
         from nilearn.reporting.html_report import generate_report
 
-        if (
-            displayed_maps != "all"
-            and not isinstance(displayed_maps, (list, np.ndarray, int))
-        ):
+        incorrect_type = not isinstance(
+            displayed_maps, (list, np.ndarray, int, str)
+        )
+        incorrect_string = (
+            isinstance(displayed_maps, str) and displayed_maps != "all"
+        )
+        not_integer = (
+            not isinstance(displayed_maps, str)
+            and np.array(displayed_maps).dtype != int
+        )
+        if incorrect_type or incorrect_string or not_integer:
             raise TypeError(
                 "Parameter ``displayed_maps`` of "
                 "``generate_report()`` should be either 'all' or "

++++++ warning-based-sklearn-version.patch ++++++
Index: nilearn-0.10.1/nilearn/decoding/tests/test_decoder.py
===================================================================
--- nilearn-0.10.1.orig/nilearn/decoding/tests/test_decoder.py
+++ nilearn-0.10.1/nilearn/decoding/tests/test_decoder.py
@@ -22,6 +22,7 @@ import warnings
 
 import numpy as np
 import pytest
+import sklearn
 from nilearn._utils.param_validation import check_feature_screening
 from nilearn.decoding.decoder import (
     Decoder,
@@ -36,6 +37,7 @@ from nilearn.decoding.decoder import (
 )
 from nilearn.decoding.tests.test_same_api import to_niimgs
 from nilearn.maskers import NiftiMasker
+from nilearn._utils import _compare_version
 from numpy.testing import assert_array_almost_equal
 from sklearn.datasets import load_iris, make_classification, make_regression
 from sklearn.dummy import DummyClassifier, DummyRegressor
@@ -626,8 +628,18 @@ def test_decoder_error_unknown_scoring_m
 
     model = Decoder(estimator=dummy_classifier, mask=mask, scoring="foo")
 
-    with pytest.raises(ValueError, match="'foo' is not a valid scoring value"):
-        model.fit(X, y)
+    if _compare_version(sklearn.__version__, ">", "1.2.2"):
+        with pytest.raises(
+            ValueError,
+            match="The 'scoring' parameter of check_scoring "
+            "must be a str among",
+        ):
+            model.fit(X, y)
+    else:
+        with pytest.raises(
+            ValueError, match="'foo' is not a valid scoring value"
+        ):
+            model.fit(X, y)
 
 
 def test_decoder_dummy_classifier_default_scoring():

Reply via email to