Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-intervals for
openSUSE:Factory checked in at 2022-05-23 15:51:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-intervals (Old)
and /work/SRC/openSUSE:Factory/.python-intervals.new.2254 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-intervals"
Mon May 23 15:51:48 2022 rev:6 rq:978586 version:0.9.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-intervals/python-intervals.changes
2020-11-17 21:26:33.957454021 +0100
+++
/work/SRC/openSUSE:Factory/.python-intervals.new.2254/python-intervals.changes
2022-05-23 15:51:52.770653949 +0200
@@ -1,0 +2,8 @@
+Sun May 22 12:44:49 UTC 2022 - Ferdinand Thiessen <[email protected]>
+
+- Update to 0.9.2
+ * Make invalid value coercions throw ValueCoercionException
+- Update to 0.9.1
+ * Fixed discrete interval length
+
+-------------------------------------------------------------------
Old:
----
intervals-0.9.0.tar.gz
New:
----
intervals-0.9.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-intervals.spec ++++++
--- /var/tmp/diff_new_pack.0WGGa7/_old 2022-05-23 15:51:53.230654383 +0200
+++ /var/tmp/diff_new_pack.0WGGa7/_new 2022-05-23 15:51:53.234654387 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-intervals
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-intervals
-Version: 0.9.0
+Version: 0.9.2
Release: 0
Summary: Python tools for handling intervals
License: BSD-3-Clause
++++++ intervals-0.9.0.tar.gz -> intervals-0.9.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/CHANGES.rst
new/intervals-0.9.2/CHANGES.rst
--- old/intervals-0.9.0/CHANGES.rst 2020-07-16 13:39:52.000000000 +0200
+++ new/intervals-0.9.2/CHANGES.rst 2021-07-02 12:06:39.000000000 +0200
@@ -4,6 +4,18 @@
Here you can see the full list of changes between each intervals release.
+0.9.2 (2021-06-02)
+^^^^^^^^^^^^^^^^^^
+
+- Make invalid value coercions throw ValueCoercionException
+
+
+0.9.1 (2020-12-31)
+^^^^^^^^^^^^^^^^^^
+
+- Fixed discrete interval length (#53)
+
+
0.9.0 (2020-07-16)
^^^^^^^^^^^^^^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/PKG-INFO new/intervals-0.9.2/PKG-INFO
--- old/intervals-0.9.0/PKG-INFO 2020-07-16 13:40:12.000000000 +0200
+++ new/intervals-0.9.2/PKG-INFO 2021-07-02 12:09:09.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: intervals
-Version: 0.9.0
+Version: 0.9.2
Summary: Python tools for handling intervals (ranges of comparable objects).
Home-page: https://github.com/kvesteri/intervals
Author: Konsta Vesterinen
@@ -22,6 +22,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/intervals/__init__.py
new/intervals-0.9.2/intervals/__init__.py
--- old/intervals-0.9.0/intervals/__init__.py 2020-07-16 13:39:52.000000000
+0200
+++ new/intervals-0.9.2/intervals/__init__.py 2021-07-02 12:06:49.000000000
+0200
@@ -32,4 +32,4 @@
)
-__version__ = '0.9.0'
+__version__ = '0.9.2'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/intervals/exc.py
new/intervals-0.9.2/intervals/exc.py
--- old/intervals-0.9.0/intervals/exc.py 2016-07-10 20:12:18.000000000
+0200
+++ new/intervals-0.9.2/intervals/exc.py 2021-07-02 11:58:13.000000000
+0200
@@ -15,3 +15,10 @@
class IllegalArgument(IntervalException):
def __init__(self, message):
super(IntervalException, self).__init__(message)
+
+
+class ValueCoercionException(IntervalException):
+ def __init__(self, message=None):
+ if message is None:
+ message = 'Could not coerce value.'
+ super(IntervalException, self).__init__(message)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/intervals/interval.py
new/intervals-0.9.2/intervals/interval.py
--- old/intervals-0.9.0/intervals/interval.py 2020-07-16 13:39:52.000000000
+0200
+++ new/intervals-0.9.2/intervals/interval.py 2021-07-02 12:05:22.000000000
+0200
@@ -9,19 +9,19 @@
# -*- coding: utf-8 -*-
import operator
from datetime import date, datetime, timedelta
-from decimal import Decimal
+from decimal import Decimal, InvalidOperation
from math import ceil, floor
from infinity import inf, is_infinite
-from .exc import IllegalArgument, IntervalException, RangeBoundsException
+from .exc import (
+ IllegalArgument,
+ IntervalException,
+ RangeBoundsException,
+ ValueCoercionException
+)
from .parser import IntervalParser, IntervalStringParser
-try:
- string_types = basestring, # Python 2
-except NameError:
- string_types = str, # Python 3
-
def is_number(number):
return isinstance(number, (float, int, Decimal))
@@ -171,7 +171,7 @@
30
"""
- if isinstance(bounds, string_types):
+ if isinstance(bounds, str):
raise TypeError(
'First argument should be a list or tuple. If you wish to '
'initialize an interval from string, use from_string factory '
@@ -301,16 +301,22 @@
return value
elif isinstance(value, self.type):
return value
- elif isinstance(value, string_types):
+ elif isinstance(value, str):
return self.coerce_string(value)
else:
return self.coerce_obj(value)
def coerce_string(self, value):
- return self.type(value)
+ try:
+ return self.type(value)
+ except (ValueError, TypeError):
+ raise ValueCoercionException()
def coerce_obj(self, obj):
- return self.type(obj)
+ try:
+ return self.type(obj)
+ except (ValueError, TypeError):
+ raise ValueCoercionException()
@property
def lower(self):
@@ -456,6 +462,11 @@
@property
def length(self):
+ if self.discrete:
+ if not self:
+ return 0
+ if not self.lower_inc or not self.upper_inc:
+ return canonicalize(self, lower_inc=True,
upper_inc=True).length
return abs(self.upper - self.lower)
@property
@@ -701,14 +712,12 @@
type = int
def coerce_obj(self, obj):
- if isinstance(obj, float) or isinstance(obj, Decimal):
- if str(int(obj)) != str(obj):
- raise IntervalException(
- 'Could not coerce %s to int. Decimal places would '
- 'be lost.'
- )
- return int(obj)
- return obj
+ if isinstance(obj, (float, Decimal)) and str(int(obj)) != str(obj):
+ raise IntervalException(
+ 'Could not coerce %s to int. Decimal places would '
+ 'be lost.'
+ )
+ super().coerce_obj(obj)
def __int__(self):
if self.empty:
@@ -746,13 +755,19 @@
))
return value
+ def coerce_string(self, value):
+ try:
+ return self.type(value)
+ except (InvalidOperation, TypeError):
+ raise ValueCoercionException('Could not coerce given value to
decimal.')
+
class CharacterInterval(AbstractInterval):
type = str
def coerce_obj(self, obj):
if not isinstance(obj, str):
- raise IntervalException('Type %s is not a string.')
+ raise ValueCoercionException('Type %s is not a string.')
return obj
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/intervals/parser.py
new/intervals-0.9.2/intervals/parser.py
--- old/intervals-0.9.0/intervals/parser.py 2016-01-28 17:13:51.000000000
+0100
+++ new/intervals-0.9.2/intervals/parser.py 2021-07-02 11:48:57.000000000
+0200
@@ -1,11 +1,5 @@
from .exc import IntervalException
-try:
- string_types = basestring, # Python 2
-except NameError:
- string_types = str, # Python 3
-
-
strip = lambda a: a.strip()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/intervals.egg-info/PKG-INFO
new/intervals-0.9.2/intervals.egg-info/PKG-INFO
--- old/intervals-0.9.0/intervals.egg-info/PKG-INFO 2020-07-16
13:40:12.000000000 +0200
+++ new/intervals-0.9.2/intervals.egg-info/PKG-INFO 2021-07-02
12:09:09.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: intervals
-Version: 0.9.0
+Version: 0.9.2
Summary: Python tools for handling intervals (ranges of comparable objects).
Home-page: https://github.com/kvesteri/intervals
Author: Konsta Vesterinen
@@ -22,6 +22,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/setup.py new/intervals-0.9.2/setup.py
--- old/intervals-0.9.0/setup.py 2020-07-16 13:39:52.000000000 +0200
+++ new/intervals-0.9.2/setup.py 2021-07-02 11:46:47.000000000 +0200
@@ -61,6 +61,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/intervals-0.9.0/tests/interval/test_initialization.py
new/intervals-0.9.2/tests/interval/test_initialization.py
--- old/intervals-0.9.0/tests/interval/test_initialization.py 2016-07-10
20:14:03.000000000 +0200
+++ new/intervals-0.9.2/tests/interval/test_initialization.py 2021-07-02
11:59:40.000000000 +0200
@@ -10,6 +10,7 @@
FloatInterval,
IllegalArgument,
Interval,
+ IntervalException,
IntInterval,
RangeBoundsException
)
@@ -47,6 +48,28 @@
assert not interval.lower_inc
assert not interval.upper_inc
+ @mark.parametrize('value',
+ (
+ 'bogus',
+ {},
+ []
+ )
+ )
+ def test_invalid_decimals(self, value):
+ with raises(IntervalException):
+ interval = DecimalInterval((value, '1'))
+
+ @mark.parametrize('value',
+ (
+ 'bogus',
+ {},
+ []
+ )
+ )
+ def test_invalid_integers(self, value):
+ with raises(IntervalException):
+ interval = IntInterval((value, '1'))
+
def test_support_range_object(self):
interval = IntInterval(IntInterval((1, 3)))
assert interval.lower == 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/intervals-0.9.0/tests/interval/test_properties.py
new/intervals-0.9.2/tests/interval/test_properties.py
--- old/intervals-0.9.0/tests/interval/test_properties.py 2016-07-10
19:16:15.000000000 +0200
+++ new/intervals-0.9.2/tests/interval/test_properties.py 2021-07-02
11:45:53.000000000 +0200
@@ -15,16 +15,20 @@
class TestIntervalProperties(object):
@mark.parametrize(
- ('number_range', 'length'),
+ ('interval', 'length'),
(
- ([1, 4], 3),
- ([-1, 1], 2),
- ((-inf, inf), inf),
- ((1, inf), inf),
+ (IntInterval([1, 4]), 3),
+ (IntInterval([-1, 1]), 2),
+ (IntInterval([-inf, inf]), inf),
+ (IntInterval([1, inf]), inf),
+ (IntInterval.from_string('(0, 3)'), 1),
+ (IntInterval.from_string('[0, 3)'), 2),
+ (IntInterval.from_string('(0, 2)'), 0),
+ (IntInterval.from_string('(0, 1)'), 0)
)
)
- def test_length(self, number_range, length):
- assert IntInterval(number_range).length == length
+ def test_length(self, interval, length):
+ assert interval.length == length
@mark.parametrize(
('number_range', 'radius'),