[Python-modules-commits] [python-aiohttp] 01/03: Import python-aiohttp_2.2.3.orig.tar.gz

Piotr Ożarowski piotr at moszumanska.debian.org
Sun Jul 9 21:00:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

piotr pushed a commit to branch master
in repository python-aiohttp.

commit b971cd1d2a6efd8cfe3e4116408818427b6e5389
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sun Jul 9 22:52:48 2017 +0200

    Import python-aiohttp_2.2.3.orig.tar.gz
---
 CHANGES.rst                   | 17 +++++++++++
 PKG-INFO                      | 19 ++++++++++++-
 aiohttp.egg-info/PKG-INFO     | 19 ++++++++++++-
 aiohttp.egg-info/requires.txt |  2 +-
 aiohttp/__init__.py           |  2 +-
 aiohttp/client.py             | 54 ++++-------------------------------
 aiohttp/helpers.py            | 65 ++++++++++++++++++++++++++++++++++++++++---
 docs/client_reference.rst     |  4 +--
 docs/migration.rst            |  1 -
 docs/spelling_wordlist.txt    |  1 +
 setup.py                      |  2 +-
 tests/test_client_session.py  |  5 ++++
 12 files changed, 130 insertions(+), 61 deletions(-)

diff --git a/CHANGES.rst b/CHANGES.rst
index 97a0279..d8e2cb7 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,23 @@
 Changes
 =======
 
+2.2.3 (2017-07-04)
+==================
+
+- Fix `_CoroGuard` for python 3.4
+
+2.2.2 (2017-07-03)
+------------------
+
+- Allow `await session.close()` along with `yield from session.close()`
+
+2.2.1 (2017-07-02)
+------------------
+
+- Relax `yarl` requirement to 0.11+
+
+- Backport #2026: `session.close` *is* a coroutine (#2029)
+
 2.2.0 (2017-06-20)
 ------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index b363a94..35b0c36 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aiohttp
-Version: 2.2.0
+Version: 2.2.3
 Summary: Async http client/server framework (asyncio)
 Home-page: https://github.com/aio-libs/aiohttp/
 Author: Nikolay Kim <fafhrd91 at gmail.com>, Andrew Svetlov <andrew.svetlov at gmail.com>
@@ -188,6 +188,23 @@ Description: Async http client/server framework
         Changes
         =======
         
+        2.2.3 (2017-07-04)
+        ==================
+        
+        - Fix `_CoroGuard` for python 3.4
+        
+        2.2.2 (2017-07-03)
+        ------------------
+        
+        - Allow `await session.close()` along with `yield from session.close()`
+        
+        2.2.1 (2017-07-02)
+        ------------------
+        
+        - Relax `yarl` requirement to 0.11+
+        
+        - Backport #2026: `session.close` *is* a coroutine (#2029)
+        
         2.2.0 (2017-06-20)
         ------------------
         
diff --git a/aiohttp.egg-info/PKG-INFO b/aiohttp.egg-info/PKG-INFO
index b363a94..35b0c36 100644
--- a/aiohttp.egg-info/PKG-INFO
+++ b/aiohttp.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: aiohttp
-Version: 2.2.0
+Version: 2.2.3
 Summary: Async http client/server framework (asyncio)
 Home-page: https://github.com/aio-libs/aiohttp/
 Author: Nikolay Kim <fafhrd91 at gmail.com>, Andrew Svetlov <andrew.svetlov at gmail.com>
@@ -188,6 +188,23 @@ Description: Async http client/server framework
         Changes
         =======
         
+        2.2.3 (2017-07-04)
+        ==================
+        
+        - Fix `_CoroGuard` for python 3.4
+        
+        2.2.2 (2017-07-03)
+        ------------------
+        
+        - Allow `await session.close()` along with `yield from session.close()`
+        
+        2.2.1 (2017-07-02)
+        ------------------
+        
+        - Relax `yarl` requirement to 0.11+
+        
+        - Backport #2026: `session.close` *is* a coroutine (#2029)
+        
         2.2.0 (2017-06-20)
         ------------------
         
diff --git a/aiohttp.egg-info/requires.txt b/aiohttp.egg-info/requires.txt
index 215a975..bbb881f 100644
--- a/aiohttp.egg-info/requires.txt
+++ b/aiohttp.egg-info/requires.txt
@@ -1,4 +1,4 @@
 chardet
 multidict>=2.1.4
 async_timeout>=1.2.0
-yarl>=0.10.0,<0.11
+yarl>=0.11
diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py
index 3443e79..5f69110 100644
--- a/aiohttp/__init__.py
+++ b/aiohttp/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '2.2.0'
+__version__ = '2.2.3'
 
 # This relies on each of the submodules having an __all__ variable.
 
diff --git a/aiohttp/client.py b/aiohttp/client.py
index 031602a..f49f39d 100644
--- a/aiohttp/client.py
+++ b/aiohttp/client.py
@@ -23,8 +23,8 @@ from .client_ws import ClientWebSocketResponse
 from .connector import *  # noqa
 from .connector import TCPConnector
 from .cookiejar import CookieJar
-from .helpers import (PY_35, CeilTimeout, TimeoutHandle, deprecated_noop,
-                      sentinel)
+from .helpers import (PY_35, CeilTimeout, TimeoutHandle, _BaseCoroMixin,
+                      deprecated_noop, sentinel)
 from .http import WS_KEY, WebSocketReader, WebSocketWriter
 from .streams import FlowControlDataQueue
 
@@ -535,7 +535,7 @@ class ClientSession:
                 self._connector.close()
             self._connector = None
 
-        return deprecated_noop('ClientSession.close() is not coroutine')
+        return deprecated_noop('ClientSession.close() is a coroutine')
 
     @property
     def closed(self):
@@ -589,63 +589,21 @@ class ClientSession:
             self.close()
 
 
-if PY_35:
-    from collections.abc import Coroutine
-    base = Coroutine
-else:
-    base = object
+class _BaseRequestContextManager(_BaseCoroMixin):
 
-
-class _BaseRequestContextManager(base):
-
-    __slots__ = ('_coro', '_resp', 'send', 'throw', 'close')
+    __slots__ = ('_resp',)
 
     def __init__(self, coro):
+        super().__init__(coro)
         self._coro = coro
-        self._resp = None
-        self.send = coro.send
-        self.throw = coro.throw
-        self.close = coro.close
-
-    @property
-    def gi_frame(self):
-        return self._coro.gi_frame
-
-    @property
-    def gi_running(self):
-        return self._coro.gi_running
-
-    @property
-    def gi_code(self):
-        return self._coro.gi_code
-
-    def __next__(self):
-        return self.send(None)
-
-    @asyncio.coroutine
-    def __iter__(self):
-        resp = yield from self._coro
-        return resp
 
     if PY_35:
-        def __await__(self):
-            resp = yield from self._coro
-            return resp
-
         @asyncio.coroutine
         def __aenter__(self):
             self._resp = yield from self._coro
             return self._resp
 
 
-if not PY_35:
-    try:
-        from asyncio import coroutines
-        coroutines._COROUTINE_TYPES += (_BaseRequestContextManager,)
-    except:  # pragma: no cover
-        pass  # Python 3.4.2 and 3.4.3 has no coroutines._COROUTINE_TYPES
-
-
 class _RequestContextManager(_BaseRequestContextManager):
     if PY_35:
         @asyncio.coroutine
diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py
index 4f1f7df..109343a 100644
--- a/aiohttp/helpers.py
+++ b/aiohttp/helpers.py
@@ -54,17 +54,74 @@ SEPARATORS = {'(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']',
 TOKEN = CHAR ^ CTL ^ SEPARATORS
 
 
-class _CoroGuard:
-    __slots__ = ('_coro', '_msg', '_awaited')
+if PY_35:
+    from collections.abc import Coroutine
+    base = Coroutine
+else:
+    base = object
 
-    def __init__(self, coro, msg):
+
+class _BaseCoroMixin(base):
+
+    __slots__ = ('_coro', 'send', 'throw', 'close')
+
+    def __init__(self, coro):
         self._coro = coro
+        self.send = coro.send
+        self.throw = coro.throw
+        self.close = coro.close
+
+    @property
+    def gi_frame(self):
+        return self._coro.gi_frame
+
+    @property
+    def gi_running(self):
+        return self._coro.gi_running
+
+    @property
+    def gi_code(self):
+        return self._coro.gi_code
+
+    def __next__(self):
+        return self.send(None)
+
+    @asyncio.coroutine
+    def __iter__(self):
+        ret = yield from self._coro
+        return ret
+
+    if PY_35:
+        def __await__(self):
+            ret = yield from self._coro
+            return ret
+
+
+if not PY_35:
+    try:
+        from asyncio import coroutines
+        coroutines._COROUTINE_TYPES += (_BaseCoroMixin,)
+    except:  # pragma: no cover
+        pass  # Python 3.4.2 and 3.4.3 has no coroutines._COROUTINE_TYPES
+
+
+class _CoroGuard(_BaseCoroMixin):
+    __slots__ = ('_msg', '_awaited')
+
+    def __init__(self, coro, msg):
+        super().__init__(coro)
         self._msg = msg
         self._awaited = False
 
+    @asyncio.coroutine
     def __iter__(self):
         self._awaited = True
-        return self._coro.__iter__()
+        return super().__iter__()
+
+    if PY_35:
+        def __await__(self):
+            self._awaited = True
+            return super().__await__()
 
     def __del__(self):
         self._coro = None
diff --git a/docs/client_reference.rst b/docs/client_reference.rst
index 4244e30..4efbcaa 100644
--- a/docs/client_reference.rst
+++ b/docs/client_reference.rst
@@ -474,14 +474,12 @@ The client session supports the context manager protocol for self closing.
 
          URLs may be either :class:`str` or :class:`~yarl.URL`
 
-   .. method:: close()
+   .. comethod:: close()
 
       Close underlying connector.
 
       Release all acquired resources.
 
-      .. versionchanged:: 2.0
-
    .. method:: detach()
 
       Detach connector from session without closing the former.
diff --git a/docs/migration.rst b/docs/migration.rst
index a2b17d3..6684c10 100644
--- a/docs/migration.rst
+++ b/docs/migration.rst
@@ -140,7 +140,6 @@ Various
    does not match, it raises :exc:`aiohttp.ClientResponseError` exception.
    To disable content type check you can pass ``None`` as `content_type` parameter.
 
-7. `ClientSession.close()` is a regular function returning None, not a coroutine.
 
 
 
diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt
index 965027e..9b09414 100644
--- a/docs/spelling_wordlist.txt
+++ b/docs/spelling_wordlist.txt
@@ -16,6 +16,7 @@ autodetection
 autogenerates
 autogeneration
 awaitable
+Backport
 BaseEventLoop
 backend
 backends
diff --git a/setup.py b/setup.py
index 9dc9ebf..c8757af 100644
--- a/setup.py
+++ b/setup.py
@@ -60,7 +60,7 @@ with codecs.open(os.path.join(os.path.abspath(os.path.dirname(
 
 
 install_requires = ['chardet', 'multidict>=2.1.4',
-                    'async_timeout>=1.2.0', 'yarl>=0.10.0,<0.11']
+                    'async_timeout>=1.2.0', 'yarl>=0.11']
 
 if sys.version_info < (3, 4, 2):
     raise RuntimeError("aiohttp requires Python 3.4.2+")
diff --git a/tests/test_client_session.py b/tests/test_client_session.py
index cd7b8ad..d758dbd 100644
--- a/tests/test_client_session.py
+++ b/tests/test_client_session.py
@@ -55,6 +55,11 @@ def params():
         read_until_eof=False)
 
 
+def test_close_coro(create_session, loop):
+    session = create_session()
+    loop.run_until_complete(session.close())
+
+
 @asyncio.coroutine
 def test_close_deprecated(create_session):
     session = create_session()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-aiohttp.git



More information about the Python-modules-commits mailing list