Hello community,
here is the log from the commit of package python-uncertainties for openSUSE:Factory checked in at 2019-08-05 10:37:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-uncertainties (Old)
and /work/SRC/openSUSE:Factory/.python-uncertainties.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-uncertainties"
Mon Aug 5 10:37:46 2019 rev:6 rq:720231 version:3.1.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-uncertainties/python-uncertainties.changes 2019-06-03 18:57:36.296379125 +0200
+++ /work/SRC/openSUSE:Factory/.python-uncertainties.new.4126/python-uncertainties.changes 2019-08-05 10:38:16.971320804 +0200
@@ -1,0 +2,10 @@
+Wed Jul 31 21:12:28 UTC 2019 - Todd R
From 8f301bfa55479eca824b3294d610f9c1240ec19c Mon Sep 17 00:00:00 2001 From: Paul Romano
Date: Tue, 30 Jul 2019 21:39:38 -0500 Subject: [PATCH] Workaround for getting numpy.linalg.pinv argument default with numpy 1.17
--- uncertainties/unumpy/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uncertainties/unumpy/core.py b/uncertainties/unumpy/core.py index 6896ba8..91d0c5b 100644 --- a/uncertainties/unumpy/core.py +++ b/uncertainties/unumpy/core.py @@ -532,7 +532,13 @@ def pinv_with_derivatives(arr, input_type, derivatives, rcond): yield term1+term2+term3 # Default rcond argument for the generalization of numpy.linalg.pinv: -pinv_default = numpy.linalg.pinv.__defaults__[0] # Python 1, 2.6+: +try: + pinv_default = numpy.linalg.pinv.__defaults__[0] # Python 1, 2.6+: +except TypeError: + # In numpy 1.17+, pinv is wrapped using a decorator which unfortunately + # results in the metadata (argument defaults) being lost. However, we can + # still get at the original function using the __wrapped__ attribute. + pinv_default = numpy.linalg.pinv.__wrapped__.__defaults__[0] pinv_with_uncert = func_with_deriv_to_uncert_func(pinv_with_derivatives)
From 293a027c8510c0994b2ad095d444c4318b0fe7a4 Mon Sep 17 00:00:00 2001 From: Paul Romano
Date: Wed, 31 Jul 2019 21:30:59 -0500 Subject: [PATCH] Fix unumpy test to account for new behavior of numpy 1.17
--- uncertainties/unumpy/test_unumpy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uncertainties/unumpy/test_unumpy.py b/uncertainties/unumpy/test_unumpy.py index cacb3d9..5923dfd 100644 --- a/uncertainties/unumpy/test_unumpy.py +++ b/uncertainties/unumpy/test_unumpy.py @@ -62,8 +62,11 @@ def test_numpy(): # Equivalent with an array of AffineScalarFunc objects: try: numpy.exp(arr + ufloat(0, 0)) - except AttributeError: - pass # ! This is usual (but could be avoided) + except (AttributeError, TypeError): + # In numpy<1.17, an AttributeError is raised in this situation. This was + # considered a bug however, and in numpy 1.17 it was changed to a + # TypeError (see PR #12700 in numpy repository) + pass else: raise Exception("numpy.exp unexpectedly worked") ++++++ fix_raw_strings.patch ++++++
From be00513d2e5a333b128eb670ded8bc82635f0f18 Mon Sep 17 00:00:00 2001 From: Oliver Papst
Date: Sat, 22 Jun 2019 18:10:10 +0200 Subject: [PATCH] Use raw strings for strings with backslashes
Python currently ignores unrecognized escape sequences such as '\m'.
Since Python3.6, unrecognized escape sequences produce a
DeprecationWarning. In some future version of Python they will be a
SyntaxError (see the Docs, section 2.4.1). This commit fixes this by
using raw strings instead. This also applies to docstrings (see
PEP0257).
---
uncertainties/core.py | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/uncertainties/core.py b/uncertainties/core.py
index 58e60d4..cfba907 100644
--- a/uncertainties/core.py
+++ b/uncertainties/core.py
@@ -1019,13 +1019,13 @@ def from_superscript(number_str):
# parentheses. This has the side effect of making the part between
# the parentheses non-breakable (the text inside parentheses in a
# LaTeX math expression $...$ can be broken).
- 'latex': ('\left(', r'\right)'),
+ 'latex': (r'\left(', r'\right)'),
'default': ('(', ')') # Basic text mode
}
def format_num(nom_val_main, error_main, common_exp,
fmt_parts, prec, main_pres_type, options):
- '''
+ r'''
Return a formatted number with uncertainty.
Null errors (error_main) are displayed as the integer 0, with
@@ -1166,10 +1166,10 @@ def format_num(nom_val_main, error_main, common_exp,
elif isnan(error_main):
uncert_str = robust_format(error_main, main_pres_type)
if 'L' in options:
- uncert_str = '\mathrm{%s}' % uncert_str
+ uncert_str = r'\mathrm{%s}' % uncert_str
elif isinf(error_main):
if 'L' in options:
- uncert_str = '\infty'
+ uncert_str = r'\infty'
else:
uncert_str = robust_format(error_main, main_pres_type)
else: # Error with a meaningful first digit (not 0, and real number)
@@ -1239,13 +1239,13 @@ def format_num(nom_val_main, error_main, common_exp,
if 'L' in options:
if isnan(nom_val_main):
- nom_val_str = '\mathrm{%s}' % nom_val_str
+ nom_val_str = r'\mathrm{%s}' % nom_val_str
elif isinf(nom_val_main):
# !! It is wasteful, in this case, to replace
# nom_val_str: could this be avoided while avoiding to
# duplicate the formula for nom_val_str for the common
# case (robust_format(...))?
- nom_val_str = '%s\infty' % ('-' if nom_val_main < 0 else '')
+ nom_val_str = r'%s\infty' % ('-' if nom_val_main < 0 else '')
value_str = nom_val_str+value_end
@@ -1364,14 +1364,14 @@ def format_num(nom_val_main, error_main, common_exp,
if 'L' in options:
if isnan(nom_val_main):
- nom_val_str = '\mathrm{%s}' % nom_val_str
+ nom_val_str = r'\mathrm{%s}' % nom_val_str
elif isinf(nom_val_main):
- nom_val_str = '%s\infty' % ('-' if nom_val_main < 0 else '')
+ nom_val_str = r'%s\infty' % ('-' if nom_val_main < 0 else '')
if isnan(error_main):
- error_str = '\mathrm{%s}' % error_str
+ error_str = r'\mathrm{%s}' % error_str
elif isinf(error_main):
- error_str = '\infty'
+ error_str = r'\infty'
if nom_has_exp:
nom_val_str += exp_str
@@ -1405,7 +1405,7 @@ def format_num(nom_val_main, error_main, common_exp,
# Unicode-compatible LaTeX source can use ±:
pm_symbol = u'±'
elif 'L' in options:
- pm_symbol = ' \pm '
+ pm_symbol = r' \pm '
else:
pm_symbol = '+/-'
@@ -1954,7 +1954,7 @@ def __format__(self, format_spec):
# Format specification parsing:
- match = re.match('''
+ match = re.match(r'''
(?P<fill>[^{}]??)(?P<align>[<>=^]?) # fill cannot be { or }
(?P<sign>[-+ ]?)
(?P<zero>0?)
@@ -2923,7 +2923,7 @@ def correlation_matrix(nums_with_uncert):
# Regexp for a number with uncertainty (e.g., "-1.234(2)e-6"), where
# the uncertainty is optional (in which case the uncertainty is
# implicit). The uncertainty can also be nan or NAN:
-NUMBER_WITH_UNCERT_RE_STR = u'''
+NUMBER_WITH_UNCERT_RE_STR = ur'''
([+-])? # Sign
%s # Main number
(?:\(%s\))? # Optional uncertainty
@@ -2940,7 +2940,7 @@ def correlation_matrix(nums_with_uncert):
# Number with uncertainty with a factored exponent (e.g., of the form
# (... +/- ...)e10): this is a loose matching, so as to accommodate
# for multiple formats:
-NUMBER_WITH_UNCERT_GLOBAL_EXP_RE_MATCH = re.compile(u'''
+NUMBER_WITH_UNCERT_GLOBAL_EXP_RE_MATCH = re.compile(ur'''
\(
(?P