Control: tags -1 + patch

Hi Maintainer

While asserting that no warnings are raised is a useful test for the
upstream developers, I don't think it makes sense for downstreams.

I propose to disable the assertion as follows:

--- a/tests/test_minimizers.py
+++ b/tests/test_minimizers.py
@@ -117,7 +117,7 @@
     # Should no longer raise warnings, because internally we practice
     # what we preach.
     fit_custom = BFGS(chi_squared, [a, b])
-    assert len(recwarn) == 0
+#    assert len(recwarn) == 0

     fit_custom_result = fit_custom.execute()

Please let me know if you are happy with a team upload and I will proceed.
As a bonus, I attach a patch that fixes several SyntaxWarnings that
occur with Python 3.12.

Regards
Graham
Description: Fix several SyntaxWarnings
 Use raw strings to avoid invalid escape sequence
Author: Graham Inggs <gin...@debian.org>
Last-Update: 2024-04-06

--- a/symfit/core/operators.py
+++ b/symfit/core/operators.py
@@ -45,7 +45,7 @@
 #         return orig_ne(self.__class__, other)
 
 def call(self, *values, **named_values):
-    """
+    r"""
     Call an expression to evaluate it at the given point.
 
     Future improvements: I would like if func and signature could be buffered after the
--- a/symfit/core/support.py
+++ b/symfit/core/support.py
@@ -293,7 +293,7 @@
     return jac
 
 def key2str(target):
-    """
+    r"""
     In ``symfit`` there are many dicts with symbol: value pairs.
     These can not be used immediately as \*\*kwargs, even though this would make
     a lot of sense from the context.
@@ -321,4 +321,4 @@
         base_str += 'd{}{}'.format(var,  count if count > 1 else '')
     return base_str
 
-sympy.Derivative.name = property(name)
\ No newline at end of file
+sympy.Derivative.name = property(name)
--- a/symfit/core/fit.py
+++ b/symfit/core/fit.py
@@ -29,7 +29,7 @@
     from the model.
     """
     def __init__(self, model, *ordered_data, absolute_sigma=None, **named_data):
-        """
+        r"""
         :param model: (dict of) sympy expression or ``Model`` object.
         :param bool absolute_sigma: True by default. If the sigma is only used
             for relative weights in your problem, you could consider setting it to
--- a/symfit/core/minimizers.py
+++ b/symfit/core/minimizers.py
@@ -208,7 +208,7 @@
     :class:`~symfit.core.minimizers.DifferentialEvolution`.
     """
     def __init__(self, *args, minimizers=None, **kwargs):
-        '''
+        r'''
         :param minimizers: a :class:`~collections.abc.Sequence` of
             :class:`~symfit.core.minimizers.BaseMinimizer` objects, which need
             to be run in order.
@@ -324,7 +324,7 @@
 
     def execute(self, bounds=None, jacobian=None, hessian=None,
                 constraints=None, *, tol=1e-9, **minimize_options):
-        """
+        r"""
         Calls the wrapped algorithm.
 
         :param bounds: The bounds for the parameters. Usually filled by
@@ -790,7 +790,7 @@
         return lbounds, ubounds
 
     def execute(self, jacobian=None, method='trf', **minpack_options):
-        """
+        r"""
         :param \*\*minpack_options: Any named arguments to be passed to
             :func:`scipy.optimize.least_squares`
         """
--- a/symfit/core/fit_results.py
+++ b/symfit/core/fit_results.py
@@ -26,7 +26,7 @@
     :class:`~symfit.core.models.Model`'s.
     """
     def __init__(self, model, popt, covariance_matrix, minimizer, objective, message, *, constraints=None, **minimizer_output):
-        """
+        r"""
         :param model: :class:`~symfit.core.models.Model` that was fit to.
         :param popt: best fit parameters, same ordering as in model.params.
         :param covariance_matrix: covariance matrix.
@@ -276,4 +276,4 @@
     f_is = [f_is[var] for var in model.dependent_vars]
     SS_res = np.sum([np.sum((y_i - f_i)**2) for y_i, f_i in zip(y_is, f_is) if y_i is not None])
     SS_tot = np.sum([np.sum((y_i - y_bar)**2) for y_i, y_bar in zip(y_is, y_bars) if y_i is not None])
-    return 1 - SS_res/SS_tot
\ No newline at end of file
+    return 1 - SS_res/SS_tot
--- a/symfit/core/objectives.py
+++ b/symfit/core/objectives.py
@@ -386,7 +386,7 @@
 
 
 class HessianObjectiveJacApprox(HessianObjective):
-    """
+    r"""
     This object should only be used as a Mixin for covariance matrix estimation.
     Since the covariance matrix for the least-squares method is proportional to
     the Hessian of :math:`S`, this function attempts to return the Hessian
@@ -552,4 +552,4 @@
             )
             return np.array(evaluated_hess[0])
         else:
-            return None
\ No newline at end of file
+            return None

Reply via email to