diff --git a/CHANGES.rst b/CHANGES.rst index 42c5846b3c1..36ee700c5b6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,5 +18,8 @@ CHANGES - Dropped: `aiohttp.web.WebSocketResponse.receive_msg()` #1605 -- Dropped: `ServerHttpProtocol.keep_alive_timeout` attr and - `keep-alive`, `keep_alive_on`, `timeout`, `log` ctor parameters #1606 +- Dropped: `ServerHttpProtocol.keep_alive_timeout` "attr"" and + `keep-alive`, `keep_alive_on`, `timeout`, `log` "ctor"" parameters #1606 + +- Dropped: `TCPConnector's`` `.resolve`, `.resolved_hosts`, `.clear_resolved_hosts()` "attrs"" + and `resolve` "ctor" parameter #1607 diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 7cd17f6e988..609621c6bc8 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -481,8 +481,7 @@ def __init__(self, *, verify_ssl=True, fingerprint=None, resolve=sentinel, use_dns_cache=sentinel, family=0, ssl_context=None, local_addr=None, resolver=None, conn_timeout=None, keepalive_timeout=sentinel, - force_close=False, limit=20, - loop=None): + force_close=False, limit=20, loop=None): super().__init__(conn_timeout=conn_timeout, keepalive_timeout=keepalive_timeout, force_close=force_close, limit=limit, loop=loop) @@ -507,19 +506,8 @@ def __init__(self, *, verify_ssl=True, fingerprint=None, self._hashfunc = hashfunc self._fingerprint = fingerprint - if resolve is not sentinel: - warnings.warn(("resolve parameter is deprecated, " - "use use_dns_cache instead"), - DeprecationWarning, stacklevel=2) - - if use_dns_cache is not sentinel and resolve is not sentinel: - if use_dns_cache != resolve: - raise ValueError("use_dns_cache must agree with resolve") - _use_dns_cache = use_dns_cache - elif use_dns_cache is not sentinel: + if use_dns_cache is not sentinel: _use_dns_cache = use_dns_cache - elif resolve is not sentinel: - _use_dns_cache = resolve else: _use_dns_cache = True @@ -586,32 +574,6 @@ def clear_dns_cache(self, host=None, port=None): else: self._cached_hosts.clear() - @property - def resolve(self): - """Do DNS lookup for host name?""" - warnings.warn((".resolve property is deprecated, " - "use .dns_cache instead"), - DeprecationWarning, stacklevel=2) - return self.use_dns_cache - - @property - def resolved_hosts(self): - """The dict of (host, port) -> (ipaddr, port) pairs.""" - warnings.warn((".resolved_hosts property is deprecated, " - "use .cached_hosts instead"), - DeprecationWarning, stacklevel=2) - return self.cached_hosts - - def clear_resolved_hosts(self, host=None, port=None): - """Remove specified host/port or clear all resolve cache.""" - warnings.warn((".clear_resolved_hosts() is deprecated, " - "use .clear_dns_cache() instead"), - DeprecationWarning, stacklevel=2) - if host is not None and port is not None: - self.clear_dns_cache(host, port) - else: - self.clear_dns_cache() - @asyncio.coroutine def _resolve_host(self, host, port): if is_ip_address(host): diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index e2520c22c03..36bb5b89d4f 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -12,7 +12,6 @@ import re import sys import time -import warnings from collections import MutableSequence, namedtuple from functools import total_ordering from pathlib import Path @@ -534,17 +533,6 @@ def is_ip_address(host): .format(host, type(host))) -def _get_kwarg(kwargs, old, new, value): - val = kwargs.pop(old, sentinel) - if val is not sentinel: - warnings.warn("{} is deprecated, use {} instead".format(old, new), - DeprecationWarning, - stacklevel=3) - return val - else: - return value - - @total_ordering class FrozenList(MutableSequence): diff --git a/docs/client_reference.rst b/docs/client_reference.rst index 4cdff472155..1d1c04c8ed2 100644 --- a/docs/client_reference.rst +++ b/docs/client_reference.rst @@ -691,8 +691,7 @@ TCPConnector family=0, \ ssl_context=None, conn_timeout=None, \ keepalive_timeout=30, limit=None, \ - force_close=False, loop=None, local_addr=None, - resolver=None) + force_close=False, loop=None, local_addr=None) Connector for working with *HTTP* and *HTTPS* via *TCP* sockets. @@ -744,10 +743,6 @@ TCPConnector The resolver is ``aiohttp.AsyncResolver`` now if :term:`aiodns` is installed. - :param bool resolve: alias for *use_dns_cache* parameter. - - .. deprecated:: 0.17 - :param int family: TCP socket family, both IPv4 and IPv6 by default. For *IPv4* only use :const:`socket.AF_INET`, for *IPv6* only -- :const:`socket.AF_INET6`. @@ -795,12 +790,6 @@ TCPConnector .. versionadded:: 0.17 - .. attribute:: resolve - - Alias for :attr:`dns_cache`. - - .. deprecated:: 0.17 - .. attribute:: cached_hosts The cache of resolved hosts if :attr:`dns_cache` is enabled. @@ -809,12 +798,6 @@ TCPConnector .. versionadded:: 0.17 - .. attribute:: resolved_hosts - - Alias for :attr:`cached_hosts` - - .. deprecated:: 0.17 - .. attribute:: fingerprint MD5, SHA1, or SHA256 hash of the expected certificate in DER @@ -834,14 +817,6 @@ TCPConnector .. versionadded:: 0.17 - .. method:: clear_resolved_hosts(self, host=None, port=None) - - Alias for :meth:`clear_dns_cache`. - - .. deprecated:: 0.17 - - - ProxyConnector ^^^^^^^^^^^^^^ diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py index 1c1849caab0..435bf0c2efa 100644 --- a/tests/test_client_functional.py +++ b/tests/test_client_functional.py @@ -736,7 +736,7 @@ def handler(request): conn = aiohttp.TCPConnector( conn_timeout=0.2, resolve=True, loop=loop) - conn.clear_resolved_hosts() + conn.clear_dns_cache() app = web.Application(loop=loop) for meth in ('get', 'post', 'put', 'delete', 'head'): diff --git a/tests/test_connector.py b/tests/test_connector.py index 3ec7556f240..5ea198dcb55 100644 --- a/tests/test_connector.py +++ b/tests/test_connector.py @@ -604,15 +604,9 @@ def test_tcp_connector_ctor(loop): assert conn.verify_ssl assert conn.fingerprint is None - with pytest.warns(DeprecationWarning): - assert conn.resolve assert conn.use_dns_cache - assert conn.family == 0 - - with pytest.warns(DeprecationWarning): - assert conn.resolved_hosts == {} - assert conn.resolved_hosts == {} + assert conn.cached_hosts == {} def test_tcp_connector_ctor_fingerprint_valid(loop): @@ -627,20 +621,6 @@ def test_tcp_connector_fingerprint_invalid(loop): aiohttp.TCPConnector(loop=loop, fingerprint=invalid) -def test_tcp_connector_clear_resolved_hosts(loop): - conn = aiohttp.TCPConnector(loop=loop) - info = object() - conn._cached_hosts[('localhost', 123)] = info - conn._cached_hosts[('localhost', 124)] = info - conn.clear_dns_cache('localhost', 123) - assert conn.cached_hosts == {('localhost', 124): info} - conn.clear_dns_cache('localhost', 123) - assert conn.cached_hosts == {('localhost', 124): info} - with pytest.warns(DeprecationWarning): - conn.clear_resolved_hosts() - assert conn.cached_hosts == {} - - def test_tcp_connector_clear_dns_cache(loop): conn = aiohttp.TCPConnector(loop=loop) info = object() @@ -968,28 +948,6 @@ def handler(request): assert r.status == 200 -def test_ambiguous_ctor_params(loop): - with pytest.raises(ValueError): - aiohttp.TCPConnector(resolve=True, use_dns_cache=False, - loop=loop) - - -def test_both_resolve_and_use_dns_cache(loop): - conn = aiohttp.TCPConnector(resolve=True, use_dns_cache=True, - loop=loop) - assert conn.use_dns_cache - with pytest.warns(DeprecationWarning): - assert conn.resolve - - -def test_both_use_dns_cache_only(loop): - conn = aiohttp.TCPConnector(use_dns_cache=True, - loop=loop) - assert conn.use_dns_cache - with pytest.warns(DeprecationWarning): - assert conn.resolve - - def test_default_use_dns_cache(loop): conn = aiohttp.TCPConnector(loop=loop) assert conn.use_dns_cache