Hello community,

here is the log from the commit of package python-async-timeout for 
openSUSE:Factory checked in at 2017-09-13 22:36:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-async-timeout (Old)
 and      /work/SRC/openSUSE:Factory/.python-async-timeout.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-async-timeout"

Wed Sep 13 22:36:33 2017 rev:2 rq:523755 version:1.4.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-async-timeout/python-async-timeout.changes    
    2017-09-11 16:18:19.322358583 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-async-timeout.new/python-async-timeout.changes
   2017-09-13 22:36:55.667919258 +0200
@@ -1,0 +2,10 @@
+Tue Sep 12 11:49:40 UTC 2017 - aloi...@gmx.com
+
+- Update to version 1.4.0
+  * Implement `remaining` property (#20)
+    + If timeout is not started yet or started unconstrained:
+      `remaining` is `None`
+    + If timeout is expired: `remaining` is `0.0`
+    + All others: roughly amount of time before `TimeoutError` is triggered
+
+-------------------------------------------------------------------

Old:
----
  async-timeout-1.3.0.tar.gz

New:
----
  async-timeout-1.4.0.tar.gz

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

Other differences:
------------------
++++++ python-async-timeout.spec ++++++
--- /var/tmp/diff_new_pack.NDd8E8/_old  2017-09-13 22:36:56.115856190 +0200
+++ /var/tmp/diff_new_pack.NDd8E8/_new  2017-09-13 22:36:56.119855626 +0200
@@ -13,6 +13,7 @@
 # published by the Open Source Initiative.
 
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
@@ -20,18 +21,17 @@
 %define         skip_python2 1
 %{!?license:    %global license %doc}
 Name:           python-async-timeout
-Version:        1.3.0
+Version:        1.4.0
 Release:        0
-License:        Apache-2.0
 Summary:        Timeout context manager for asyncio programs
-Url:            https://github.com/aio-libs/async_timeout/
+License:        Apache-2.0
 Group:          Development/Languages/Python
+Url:            https://github.com/aio-libs/async_timeout/
 Source:         
https://files.pythonhosted.org/packages/source/a/async_timeout/async-timeout-%{version}.tar.gz
-BuildRequires:  python-rpm-macros
-BuildRequires:  %{python_module devel >= 3.4}
+BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
-Requires:       python >= 3.4
+BuildRequires:  python-rpm-macros
 BuildArch:      noarch
 Provides:       python-async_timeout
 
@@ -51,8 +51,13 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %files %{python_files}
+%defattr(-,root,root)
 %doc CHANGES.rst README.rst
+%if 0%{?sle_version} > 120200 || 0%{?suse_version} > 1320
 %license LICENSE
+%else
+%doc LICENSE
+%endif
 %{python_sitelib}/*
 
 %changelog

++++++ async-timeout-1.3.0.tar.gz -> async-timeout-1.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/CHANGES.rst 
new/async-timeout-1.4.0/CHANGES.rst
--- old/async-timeout-1.3.0/CHANGES.rst 2017-08-23 10:41:04.000000000 +0200
+++ new/async-timeout-1.4.0/CHANGES.rst 2017-09-09 18:52:08.000000000 +0200
@@ -1,6 +1,16 @@
 CHANGES
 =======
 
+1.4.0 (2017-09-09)
+------------------
+
+* Implement `remaining` property (#20)
+
+  * If timeout is not started yet or started unconstrained:
+    `remaining` is `None`
+  * If timeout is expired: `remaining` is `0.0`
+  * All others: roughly amount of time before `TimeoutError` is triggered
+
 1.3.0 (2017-08-23)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/PKG-INFO 
new/async-timeout-1.4.0/PKG-INFO
--- old/async-timeout-1.3.0/PKG-INFO    2017-08-23 10:41:27.000000000 +0200
+++ new/async-timeout-1.4.0/PKG-INFO    2017-09-09 18:52:33.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: async-timeout
-Version: 1.3.0
+Version: 1.4.0
 Summary: Timeout context manager for asyncio programs
 Home-page: https://github.com/aio-libs/async_timeout/
 Author: Andrew Svetlov
@@ -8,6 +8,15 @@
 License: Apache 2
 Description: async-timeout
         =============
+        .. image:: 
https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
+            :target: https://travis-ci.org/aio-libs/async-timeout
+        .. image:: 
https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
+            :target: https://codecov.io/gh/aio-libs/async-timeout
+        .. image:: https://img.shields.io/pypi/v/async-timeout.svg
+            :target: https://pypi.python.org/pypi/async-timeout
+        .. image:: https://badges.gitter.im/Join%20Chat.svg
+            :target: https://gitter.im/aio-libs/Lobby
+            :alt: Chat on Gitter
         
         asyncio-compatible timeout context manager.
         
@@ -71,6 +80,16 @@
         CHANGES
         =======
         
+        1.4.0 (2017-09-09)
+        ------------------
+        
+        * Implement `remaining` property (#20)
+        
+          * If timeout is not started yet or started unconstrained:
+            `remaining` is `None`
+          * If timeout is expired: `remaining` is `0.0`
+          * All others: roughly amount of time before `TimeoutError` is 
triggered
+        
         1.3.0 (2017-08-23)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/README.rst 
new/async-timeout-1.4.0/README.rst
--- old/async-timeout-1.3.0/README.rst  2017-08-23 10:41:04.000000000 +0200
+++ new/async-timeout-1.4.0/README.rst  2017-09-09 18:52:08.000000000 +0200
@@ -1,5 +1,14 @@
 async-timeout
 =============
+.. image:: https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
+    :target: https://travis-ci.org/aio-libs/async-timeout
+.. image:: 
https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
+    :target: https://codecov.io/gh/aio-libs/async-timeout
+.. image:: https://img.shields.io/pypi/v/async-timeout.svg
+    :target: https://pypi.python.org/pypi/async-timeout
+.. image:: https://badges.gitter.im/Join%20Chat.svg
+    :target: https://gitter.im/aio-libs/Lobby
+    :alt: Chat on Gitter
 
 asyncio-compatible timeout context manager.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/async_timeout/__init__.py 
new/async-timeout-1.4.0/async_timeout/__init__.py
--- old/async-timeout-1.3.0/async_timeout/__init__.py   2017-08-23 
10:41:04.000000000 +0200
+++ new/async-timeout-1.4.0/async_timeout/__init__.py   2017-09-09 
18:52:08.000000000 +0200
@@ -1,7 +1,7 @@
 import asyncio
 
 
-__version__ = '1.3.0'
+__version__ = '1.4.0'
 
 
 class timeout:
@@ -28,6 +28,7 @@
         self._task = None
         self._cancelled = False
         self._cancel_handler = None
+        self._cancel_at = None
 
     def __enter__(self):
         return self._do_enter()
@@ -47,14 +48,21 @@
     def expired(self):
         return self._cancelled
 
+    @property
+    def remaining(self):
+        if self._cancel_at is not None:
+            return max(self._cancel_at - self._loop.time(), 0.0)
+        else:
+            return None
+
     def _do_enter(self):
         if self._timeout is not None:
             self._task = current_task(self._loop)
             if self._task is None:
                 raise RuntimeError('Timeout context manager should be used '
                                    'inside a task')
-            self._cancel_handler = self._loop.call_later(
-                self._timeout, self._cancel_task)
+            self._cancel_at = self._loop.time() + self._timeout
+            self._cancel_handler = self._loop.call_at(self._cancel_at, 
self._cancel_task)
         return self
 
     def _do_exit(self, exc_type):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/async_timeout.egg-info/PKG-INFO 
new/async-timeout-1.4.0/async_timeout.egg-info/PKG-INFO
--- old/async-timeout-1.3.0/async_timeout.egg-info/PKG-INFO     2017-08-23 
10:41:27.000000000 +0200
+++ new/async-timeout-1.4.0/async_timeout.egg-info/PKG-INFO     2017-09-09 
18:52:33.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: async-timeout
-Version: 1.3.0
+Version: 1.4.0
 Summary: Timeout context manager for asyncio programs
 Home-page: https://github.com/aio-libs/async_timeout/
 Author: Andrew Svetlov
@@ -8,6 +8,15 @@
 License: Apache 2
 Description: async-timeout
         =============
+        .. image:: 
https://travis-ci.org/aio-libs/async-timeout.svg?branch=master
+            :target: https://travis-ci.org/aio-libs/async-timeout
+        .. image:: 
https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
+            :target: https://codecov.io/gh/aio-libs/async-timeout
+        .. image:: https://img.shields.io/pypi/v/async-timeout.svg
+            :target: https://pypi.python.org/pypi/async-timeout
+        .. image:: https://badges.gitter.im/Join%20Chat.svg
+            :target: https://gitter.im/aio-libs/Lobby
+            :alt: Chat on Gitter
         
         asyncio-compatible timeout context manager.
         
@@ -71,6 +80,16 @@
         CHANGES
         =======
         
+        1.4.0 (2017-09-09)
+        ------------------
+        
+        * Implement `remaining` property (#20)
+        
+          * If timeout is not started yet or started unconstrained:
+            `remaining` is `None`
+          * If timeout is expired: `remaining` is `0.0`
+          * All others: roughly amount of time before `TimeoutError` is 
triggered
+        
         1.3.0 (2017-08-23)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/setup.cfg 
new/async-timeout-1.4.0/setup.cfg
--- old/async-timeout-1.3.0/setup.cfg   2017-08-23 10:41:27.000000000 +0200
+++ new/async-timeout-1.4.0/setup.cfg   2017-09-09 18:52:33.000000000 +0200
@@ -1,5 +1,5 @@
 [tool:pytest]
-addopts = --cov=async_timeout --cov-report=term --cov-report=html
+addopts = --cov=async_timeout --cov-report=term --cov-report=html --cov-branch
 
 [egg_info]
 tag_build = 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/async-timeout-1.3.0/tests/test_timeout.py 
new/async-timeout-1.4.0/tests/test_timeout.py
--- old/async-timeout-1.3.0/tests/test_timeout.py       2017-08-23 
10:41:04.000000000 +0200
+++ new/async-timeout-1.4.0/tests/test_timeout.py       2017-09-09 
18:52:08.000000000 +0200
@@ -227,3 +227,21 @@
         with timeout(0.01, loop=loop) as cm:
             raise RuntimeError
     assert not cm.expired
+
+@asyncio.coroutine
+def test_timeout_remaining(loop):
+    with timeout(None, loop=loop) as cm:
+        assert cm.remaining is None
+
+    t = timeout(1.0, loop=loop)
+    assert t.remaining is None
+
+    with timeout(1.0, loop=loop) as cm:
+        yield from asyncio.sleep(0.1, loop=loop)
+        assert cm.remaining < 1.0
+
+    with pytest.raises(asyncio.TimeoutError):
+        with timeout(0.1, loop=loop) as cm:
+            yield from asyncio.sleep(0.5, loop=loop)
+
+    assert cm.remaining == 0.0


Reply via email to