Hello community,

here is the log from the commit of package python-retry_decorator for 
openSUSE:Leap:15.2 checked in at 2020-04-23 18:16:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-retry_decorator (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-retry_decorator.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-retry_decorator"

Thu Apr 23 18:16:46 2020 rev:12 rq:794668 version:1.1.1

Changes:
--------
--- 
/work/SRC/openSUSE:Leap:15.2/python-retry_decorator/python-retry_decorator.changes
  2020-03-02 13:22:18.238272696 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.python-retry_decorator.new.2738/python-retry_decorator.changes
        2020-04-23 18:16:47.154519517 +0200
@@ -1,0 +2,6 @@
+Thu Mar 19 08:07:07 UTC 2020 - pgaj...@suse.com
+
+- version update to 1.1.1
+  * This is the last release which will include support for py2 and py3.
+
+-------------------------------------------------------------------

Old:
----
  v1.0.0.tar.gz

New:
----
  v1.1.1.tar.gz

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

Other differences:
------------------
++++++ python-retry_decorator.spec ++++++
--- /var/tmp/diff_new_pack.3gOAkK/_old  2020-04-23 18:16:47.630520428 +0200
+++ /var/tmp/diff_new_pack.3gOAkK/_new  2020-04-23 18:16:47.634520436 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-retry_decorator
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,20 +18,20 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-retry_decorator
-Version:        1.0.0
+Version:        1.1.1
 Release:        0
 Summary:        Retry Decorator
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/pnpnpn/retry-decorator
+URL:            https://github.com/pnpnpn/retry-decorator
 # https://github.com/pnpnpn/retry-decorator/issues/15
 Source:         
https://github.com/pnpnpn/retry-decorator/archive/v%{version}.tar.gz
 BuildRequires:  %{python_module devel}
+BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -53,6 +53,6 @@
 %{python_sitelib}/*
 
 %check
-%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python 
tests/test_retry.py
+%pytest
 
 %changelog

++++++ v1.0.0.tar.gz -> v1.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/.travis.yml 
new/retry-decorator-1.1.1/.travis.yml
--- old/retry-decorator-1.0.0/.travis.yml       1970-01-01 01:00:00.000000000 
+0100
+++ new/retry-decorator-1.1.1/.travis.yml       2020-03-11 00:54:45.000000000 
+0100
@@ -0,0 +1,22 @@
+language: python
+sudo: false
+python:
+- '2.7'
+- '3.5'
+- '3.6'
+- '3.7'
+- '3.8'
+install:
+- pip install python-coveralls tox tox-travis
+script: tox --recreate
+after_success:
+- pip install -e .
+- py.test --cov=retry_decorator --cov-report=term-missing tests
+- coveralls
+deploy:
+  provider: pypi
+  user: png
+  password:
+    secure: 
"m6n470zn8+lLDoB0W/goO3ovoMScb7sVWRQcXtm7V99YtxgBzqDT+xy4nPfEeRj/0FHSL2/k9xJHV4Q8l+UfjGFR6fszXPKkSgeL4KfE0r5GuVDNIRu853f5Pa7DM8l4GNn6/NP9Lv+jVD79j8Edb4nJgTWvxOnj9PvDZJnxqjk="
+  on:
+    python: 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/MANIFEST.in 
new/retry-decorator-1.1.1/MANIFEST.in
--- old/retry-decorator-1.0.0/MANIFEST.in       2013-11-22 06:35:36.000000000 
+0100
+++ new/retry-decorator-1.1.1/MANIFEST.in       2020-03-11 00:54:45.000000000 
+0100
@@ -1,3 +1,5 @@
 include *.txt
 include *.rst
 recursive-include docs *
+include CHANGES.txt
+recursive-include tests *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/README.rst 
new/retry-decorator-1.1.1/README.rst
--- old/retry-decorator-1.0.0/README.rst        2013-11-22 06:35:36.000000000 
+0100
+++ new/retry-decorator-1.1.1/README.rst        2020-03-11 00:54:45.000000000 
+0100
@@ -1,4 +1,9 @@
+.. image:: https://badge.fury.io/py/retry_decorator.svg
+    :target: https://badge.fury.io/py/retry_decorator
 
+.. image:: https://travis-ci.org/pnpnpn/retry-decorator.svg?branch=master
+    :target: https://travis-ci.org/pnpnpn/retry-decorator
+    
 Usage
 -----
 
@@ -22,3 +27,8 @@
             test_retry()
         except Exception as e:
             print('Received the last exception')
+
+
+Contribute
+---------------
+I would love for you to fork and send me pull request for this project. Please 
contribute.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/retry_decorator/__init__.py 
new/retry-decorator-1.1.1/retry_decorator/__init__.py
--- old/retry-decorator-1.0.0/retry_decorator/__init__.py       2013-11-22 
06:35:36.000000000 +0100
+++ new/retry-decorator-1.1.1/retry_decorator/__init__.py       2020-03-11 
00:54:45.000000000 +0100
@@ -1,6 +1,11 @@
 # -*- coding: utf-8 -*-
 
+#
+# License: MIT
+# Copyright: Patrick Ng - 2012
+#
+
 from .retry_decorator import *
 
 __title__ = 'retry_decorator'
-__version__ = "1.0.0"
+__version__ = "1.1.1"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/retry-decorator-1.0.0/retry_decorator/retry_decorator.py 
new/retry-decorator-1.1.1/retry_decorator/retry_decorator.py
--- old/retry-decorator-1.0.0/retry_decorator/retry_decorator.py        
2013-11-22 06:35:36.000000000 +0100
+++ new/retry-decorator-1.1.1/retry_decorator/retry_decorator.py        
2020-03-11 00:54:45.000000000 +0100
@@ -1,4 +1,7 @@
-#!/usr/bin/env python
+#
+# License: MIT
+# Copyright: Patrick Ng - 2012
+#
 
 from __future__ import print_function
 
@@ -8,19 +11,36 @@
 import random
 import sys
 
-def retry(ExceptionToCheck, tries=10, timeout_secs=1.0, logger=None):
+
+def retry(ExceptionToCheck, tries=10, timeout_secs=1.0, logger=None, 
callback_by_exception=None):
     """
     Retry calling the decorated function using an exponential backoff.
+    :param callback_by_exception: callback/method invocation on certain 
exceptions
+    :type callback_by_exception: None or dict
     """
     def deco_retry(f):
         def f_retry(*args, **kwargs):
             mtries, mdelay = tries, timeout_secs
+            run_one_last_time = True
             while mtries > 1:
                 try:
                     return f(*args, **kwargs)
                 except ExceptionToCheck as e:
-                    #traceback.print_exc()
-                    half_interval = mdelay * 0.10 #interval size
+                    # check if this exception is something the caller wants 
special handling for
+                    callback_errors = callback_by_exception or {}
+                    for error_type in callback_errors:
+                        if isinstance(e, error_type):
+                            callback_logic = callback_by_exception[error_type]
+                            should_break_out = run_one_last_time = False
+                            if isinstance(callback_logic, (list, tuple)):
+                                callback_logic, should_break_out = 
callback_logic
+                                if isinstance(should_break_out, (list, tuple)):
+                                    should_break_out, run_one_last_time = 
should_break_out
+                            callback_logic()
+                            if should_break_out:  # caller requests we stop 
handling this exception
+                                break
+                    # traceback.print_exc()
+                    half_interval = mdelay * 0.10  # interval size
                     actual_delay = random.uniform(mdelay - half_interval, 
mdelay + half_interval)
                     msg = "Retrying in %.2f seconds ..." % actual_delay
                     if logger is None:
@@ -30,8 +50,7 @@
                     time.sleep(actual_delay)
                     mtries -= 1
                     mdelay *= 2
-            return f(*args, **kwargs)
+            if run_one_last_time:  # one exception may be all the caller 
wanted in certain cases
+                return f(*args, **kwargs)
         return f_retry  # true decorator
     return deco_retry
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/setup.cfg 
new/retry-decorator-1.1.1/setup.cfg
--- old/retry-decorator-1.0.0/setup.cfg 1970-01-01 01:00:00.000000000 +0100
+++ new/retry-decorator-1.1.1/setup.cfg 2020-03-11 00:54:45.000000000 +0100
@@ -0,0 +1,2 @@
+[bdist_wheel]
+universal = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/setup.py 
new/retry-decorator-1.1.1/setup.py
--- old/retry-decorator-1.0.0/setup.py  2013-11-22 06:35:36.000000000 +0100
+++ new/retry-decorator-1.1.1/setup.py  2020-03-11 00:54:45.000000000 +0100
@@ -5,7 +5,7 @@
 
 from retry_decorator import __version__
 
-setup( 
+setup(
         name='retry_decorator',
         version=__version__,
         author='Patrick Ng',
@@ -16,8 +16,9 @@
         packages=find_packages(),
         description='Retry Decorator',
         long_description=open('README.rst').read() if exists("README.rst") 
else "",
-        install_requires=[
-        
-            ],
+        install_requires=[],
+        classifiers=[
+            'Programming Language :: Python :: 2',
+            'Programming Language :: Python :: 3',
+        ]
 )
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/tests/test_callback.py 
new/retry-decorator-1.1.1/tests/test_callback.py
--- old/retry-decorator-1.0.0/tests/test_callback.py    1970-01-01 
01:00:00.000000000 +0100
+++ new/retry-decorator-1.1.1/tests/test_callback.py    2020-03-11 
00:54:45.000000000 +0100
@@ -0,0 +1,51 @@
+import unittest
+import functools
+
+import retry_decorator
+
+
+class ClassForTesting(object):
+    hello = None
+
+
+class_for_testing = ClassForTesting()
+
+
+class MyTestCase(unittest.TestCase):
+    def test_something(self):
+        try:
+            my_test_func()
+        except Exception:  # for the dangling exception (the "final" function 
execution)
+            pass
+        self.assertIn(class_for_testing.hello, ('world', 'fish', ))
+
+    def test_two_exceptions_to_check_use_one(self):
+        try:
+            my_test_func_2()
+        except Exception:
+            pass
+        self.assertIn(class_for_testing.hello, ('world', 'fish', ))
+
+
+def callback_logic(instance, attr_to_set, value_to_set):
+    print('Callback called for {}, {}, {}'.format(instance, attr_to_set, 
value_to_set))
+    setattr(instance, attr_to_set, value_to_set)
+
+
+class TestError(Exception):
+    pass
+
+
+@retry_decorator.retry(ExceptionToCheck=TestError, tries=2, 
callback_by_exception={
+    TestError: functools.partial(callback_logic, class_for_testing, 'hello', 
'world')})
+def my_test_func():
+    raise TestError('oh noes.')
+
+
+@retry_decorator.retry(ExceptionToCheck=(TestError, AttributeError), tries=2, 
callback_by_exception={
+    AttributeError: functools.partial(callback_logic, class_for_testing, 
'hello', 'fish')})
+def my_test_func_2():
+    raise AttributeError('attribute oh noes.')
+
+if __name__ == '__main__':
+    unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/tests/test_retry.py 
new/retry-decorator-1.1.1/tests/test_retry.py
--- old/retry-decorator-1.0.0/tests/test_retry.py       2013-11-22 
06:35:36.000000000 +0100
+++ new/retry-decorator-1.1.1/tests/test_retry.py       2020-03-11 
00:54:45.000000000 +0100
@@ -1,20 +1,22 @@
 #!/usr/bin/env python
 
+#
+# License: MIT
+# Copyright: Patrick Ng - 2012
+#
+
 from __future__ import print_function
 from retry_decorator import *
 
 
-@retry(Exception, tries = 3, timeout_secs = 0.1)
-def test_retry():
+@retry(Exception, tries=3, timeout_secs=0.1)
+def retry_test():
     import sys
-    print('hello', file = sys.stderr)
+    print('hello', file=sys.stderr)
     raise Exception('Testing retry')
 
 if __name__ == '__main__':
     try:
-        test_retry()
+        retry_test()
     except Exception as e:
         print('Received the last exception')
-
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/retry-decorator-1.0.0/tox.ini 
new/retry-decorator-1.1.1/tox.ini
--- old/retry-decorator-1.0.0/tox.ini   1970-01-01 01:00:00.000000000 +0100
+++ new/retry-decorator-1.1.1/tox.ini   2020-03-11 00:54:45.000000000 +0100
@@ -0,0 +1,17 @@
+[tox]
+distshare={homedir}/.tox/distshare
+envlist=py{27,34,35,36}
+skip_missing_interpreters=true
+indexserver=
+    pypi = https://pypi.python.org/simple
+
+[testenv]
+commands=
+    py.test retry_decorator tests --pep8
+deps =
+    pytest>=3.0
+    pytest-pep8==1.0.6
+
+[pytest]
+addopts = -vvl
+pep8maxlinelength=120


Reply via email to