From 53d8a7f5d20e7d53e44ba018aef6c1ed6dbe58cd Mon Sep 17 00:00:00 2001 From: Thanos L Date: Fri, 28 Dec 2018 13:59:49 +0200 Subject: [PATCH 1/6] Remove wildcard imports --- CHANGES/3468.bugfix | 1 + aiohttp/__init__.py | 92 ++++++++++++++++++++++++++++++++----- aiohttp/client.py | 18 ++++++-- aiohttp/web.py | 107 +++++++++++++++++++++++++++++++++++++++----- 4 files changed, 192 insertions(+), 26 deletions(-) create mode 100644 CHANGES/3468.bugfix diff --git a/CHANGES/3468.bugfix b/CHANGES/3468.bugfix new file mode 100644 index 00000000000..1c73d676d20 --- /dev/null +++ b/CHANGES/3468.bugfix @@ -0,0 +1 @@ +Remove wildcard imports. diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py index 20f1580ae7e..5fba772dec0 100644 --- a/aiohttp/__init__.py +++ b/aiohttp/__init__.py @@ -3,20 +3,88 @@ # This relies on each of the submodules having an __all__ variable. from . import hdrs # noqa -from .client import * # noqa -from .client import ClientSession, ServerFingerprintMismatch # noqa -from .cookiejar import * # noqa -from .formdata import * # noqa -from .helpers import * # noqa +from .client import BaseConnector # noqa +from .client import ClientConnectionError # noqa +from .client import ClientConnectorCertificateError # noqa +from .client import ClientConnectorError # noqa +from .client import ClientConnectorSSLError # noqa +from .client import ClientError # noqa +from .client import ClientHttpProxyError # noqa +from .client import ClientOSError # noqa +from .client import ClientPayloadError # noqa +from .client import ClientProxyConnectionError # noqa +from .client import ClientRequest # noqa +from .client import ClientResponse # noqa +from .client import ClientResponseError # noqa +from .client import ClientSSLError # noqa +from .client import ClientSession # noqa +from .client import ClientTimeout # noqa +from .client import ClientWebSocketResponse # noqa +from .client import ContentTypeError # noqa +from .client import Fingerprint # noqa +from .client import InvalidURL # noqa +from .client import RequestInfo # noqa +from .client import ServerConnectionError # noqa +from .client import ServerDisconnectedError # noqa +from .client import ServerFingerprintMismatch # noqa +from .client import ServerTimeoutError # noqa +from .client import TCPConnector # noqa +from .client import UnixConnector # noqa +from .client import WSServerHandshakeError # noqa +from .client import request # noqa +from .cookiejar import CookieJar # noqa +from .cookiejar import DummyCookieJar # noqa +from .formdata import FormData # noqa +from .helpers import BasicAuth # noqa +from .helpers import ChainMapProxy # noqa from .http import (HttpVersion, HttpVersion10, HttpVersion11, # noqa WSMsgType, WSCloseCode, WSMessage, WebSocketError) # noqa -from .multipart import * # noqa -from .payload import * # noqa -from .payload_streamer import * # noqa -from .resolver import * # noqa -from .signals import * # noqa -from .streams import * # noqa -from .tracing import * # noqa +from .multipart import BadContentDispositionHeader # noqa +from .multipart import BadContentDispositionParam # noqa +from .multipart import BodyPartReader # noqa +from .multipart import MultipartReader # noqa +from .multipart import MultipartWriter # noqa +from .multipart import content_disposition_filename # noqa +from .multipart import parse_content_disposition # noqa +from .payload import AsyncIterablePayload # noqa +from .payload import BufferedReaderPayload # noqa +from .payload import BytesIOPayload # noqa +from .payload import BytesPayload # noqa +from .payload import IOBasePayload # noqa +from .payload import JsonPayload # noqa +from .payload import PAYLOAD_REGISTRY # noqa +from .payload import Payload # noqa +from .payload import StringIOPayload # noqa +from .payload import StringPayload # noqa +from .payload import TextIOPayload # noqa +from .payload import get_payload # noqa +from .payload import payload_type # noqa +from .payload_streamer import streamer # noqa +from .resolver import AsyncResolver # noqa +from .resolver import DefaultResolver # noqa +from .resolver import ThreadedResolver # noqa +from .signals import Signal # noqa +from .streams import DataQueue # noqa +from .streams import EMPTY_PAYLOAD # noqa +from .streams import EofStream # noqa +from .streams import FlowControlDataQueue # noqa +from .streams import StreamReader # noqa +from .tracing import TraceConfig # noqa +from .tracing import TraceConnectionCreateEndParams # noqa +from .tracing import TraceConnectionCreateStartParams # noqa +from .tracing import TraceConnectionQueuedEndParams # noqa +from .tracing import TraceConnectionQueuedStartParams # noqa +from .tracing import TraceConnectionReuseconnParams # noqa +from .tracing import TraceDnsCacheHitParams # noqa +from .tracing import TraceDnsCacheMissParams # noqa +from .tracing import TraceDnsResolveHostEndParams # noqa +from .tracing import TraceDnsResolveHostStartParams # noqa +from .tracing import TraceRequestChunkSentParams # noqa +from .tracing import TraceRequestEndParams # noqa +from .tracing import TraceRequestExceptionParams # noqa +from .tracing import TraceRequestRedirectParams # noqa +from .tracing import TraceRequestStartParams # noqa +from .tracing import TraceResponseChunkReceivedParams # noqa try: from .worker import GunicornWebWorker, GunicornUVLoopWebWorker # noqa diff --git a/aiohttp/client.py b/aiohttp/client.py index 11a9999447f..174dce0d335 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -20,15 +20,27 @@ from . import connector as connector_mod from . import hdrs, http, payload from .abc import AbstractCookieJar -from .client_exceptions import * # noqa +from .client_exceptions import ClientConnectionError # noqa +from .client_exceptions import ClientConnectorCertificateError # noqa +from .client_exceptions import ClientConnectorError # noqa +from .client_exceptions import ClientConnectorSSLError # noqa +from .client_exceptions import ClientHttpProxyError # noqa +from .client_exceptions import ClientPayloadError # noqa +from .client_exceptions import ClientProxyConnectionError # noqa +from .client_exceptions import ClientResponseError # noqa +from .client_exceptions import ClientSSLError # noqa +from .client_exceptions import ContentTypeError # noqa +from .client_exceptions import ServerConnectionError # noqa +from .client_exceptions import ServerDisconnectedError # noqa +from .client_exceptions import ServerFingerprintMismatch # noqa from .client_exceptions import (ClientError, ClientOSError, InvalidURL, ServerTimeoutError, TooManyRedirects, WSServerHandshakeError) -from .client_reqrep import * # noqa +from .client_reqrep import RequestInfo # noqa from .client_reqrep import (ClientRequest, ClientResponse, Fingerprint, _merge_ssl_params) from .client_ws import ClientWebSocketResponse -from .connector import * # noqa +from .connector import UnixConnector # noqa from .connector import BaseConnector, TCPConnector from .cookiejar import CookieJar from .helpers import (PY_36, BasicAuth, CeilTimeout, TimeoutHandle, diff --git a/aiohttp/web.py b/aiohttp/web.py index e2772199054..d73856c4a65 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -13,21 +13,106 @@ from .abc import AbstractAccessLogger from .helpers import all_tasks from .log import access_logger -from .web_app import * # noqa +from .web_app import CleanupError # noqa from .web_app import Application -from .web_exceptions import * # noqa -from .web_fileresponse import * # noqa +from .web_exceptions import HTTPAccepted # noqa +from .web_exceptions import HTTPBadGateway # noqa +from .web_exceptions import HTTPBadRequest # noqa +from .web_exceptions import HTTPClientError # noqa +from .web_exceptions import HTTPConflict # noqa +from .web_exceptions import HTTPCreated # noqa +from .web_exceptions import HTTPError # noqa +from .web_exceptions import HTTPException # noqa +from .web_exceptions import HTTPExpectationFailed # noqa +from .web_exceptions import HTTPFailedDependency # noqa +from .web_exceptions import HTTPForbidden # noqa +from .web_exceptions import HTTPFound # noqa +from .web_exceptions import HTTPGatewayTimeout # noqa +from .web_exceptions import HTTPGone # noqa +from .web_exceptions import HTTPInsufficientStorage # noqa +from .web_exceptions import HTTPInternalServerError # noqa +from .web_exceptions import HTTPLengthRequired # noqa +from .web_exceptions import HTTPMethodNotAllowed # noqa +from .web_exceptions import HTTPMisdirectedRequest # noqa +from .web_exceptions import HTTPMovedPermanently # noqa +from .web_exceptions import HTTPMultipleChoices # noqa +from .web_exceptions import HTTPNetworkAuthenticationRequired # noqa +from .web_exceptions import HTTPNoContent # noqa +from .web_exceptions import HTTPNonAuthoritativeInformation # noqa +from .web_exceptions import HTTPNotAcceptable # noqa +from .web_exceptions import HTTPNotExtended # noqa +from .web_exceptions import HTTPNotFound # noqa +from .web_exceptions import HTTPNotImplemented # noqa +from .web_exceptions import HTTPNotModified # noqa +from .web_exceptions import HTTPOk # noqa +from .web_exceptions import HTTPPartialContent # noqa +from .web_exceptions import HTTPPaymentRequired # noqa +from .web_exceptions import HTTPPermanentRedirect # noqa +from .web_exceptions import HTTPPreconditionFailed # noqa +from .web_exceptions import HTTPPreconditionRequired # noqa +from .web_exceptions import HTTPProxyAuthenticationRequired # noqa +from .web_exceptions import HTTPRedirection # noqa +from .web_exceptions import HTTPRequestEntityTooLarge # noqa +from .web_exceptions import HTTPRequestHeaderFieldsTooLarge # noqa +from .web_exceptions import HTTPRequestRangeNotSatisfiable # noqa +from .web_exceptions import HTTPRequestTimeout # noqa +from .web_exceptions import HTTPRequestURITooLong # noqa +from .web_exceptions import HTTPResetContent # noqa +from .web_exceptions import HTTPSeeOther # noqa +from .web_exceptions import HTTPServerError # noqa +from .web_exceptions import HTTPServiceUnavailable # noqa +from .web_exceptions import HTTPSuccessful # noqa +from .web_exceptions import HTTPTemporaryRedirect # noqa +from .web_exceptions import HTTPTooManyRequests # noqa +from .web_exceptions import HTTPUnauthorized # noqa +from .web_exceptions import HTTPUnavailableForLegalReasons # noqa +from .web_exceptions import HTTPUnprocessableEntity # noqa +from .web_exceptions import HTTPUnsupportedMediaType # noqa +from .web_exceptions import HTTPUpgradeRequired # noqa +from .web_exceptions import HTTPUseProxy # noqa +from .web_exceptions import HTTPVariantAlsoNegotiates # noqa +from .web_exceptions import HTTPVersionNotSupported # noqa +from .web_fileresponse import FileResponse # noqa from .web_log import AccessLogger -from .web_middlewares import * # noqa -from .web_protocol import * # noqa -from .web_request import * # noqa -from .web_response import * # noqa -from .web_routedef import * # noqa +from .web_middlewares import middleware, normalize_path_middleware # noqa +from .web_protocol import PayloadAccessError # noqa +from .web_protocol import RequestHandler # noqa +from .web_protocol import RequestPayloadError # noqa +from .web_request import BaseRequest, FileField, Request # noqa +from .web_response import ContentCoding # noqa +from .web_response import Response # noqa +from .web_response import StreamResponse # noqa +from .web_response import json_response # noqa +from .web_routedef import AbstractRouteDef # noqa +from .web_routedef import RouteDef # noqa +from .web_routedef import RouteTableDef # noqa +from .web_routedef import StaticDef # noqa +from .web_routedef import delete # noqa +from .web_routedef import get # noqa +from .web_routedef import head # noqa +from .web_routedef import options # noqa +from .web_routedef import patch # noqa +from .web_routedef import post # noqa +from .web_routedef import put # noqa +from .web_routedef import route # noqa +from .web_routedef import static # noqa +from .web_routedef import view # noqa from .web_runner import (AppRunner, BaseRunner, BaseSite, GracefulExit, # noqa ServerRunner, SockSite, TCPSite, UnixSite) -from .web_server import * # noqa -from .web_urldispatcher import * # noqa -from .web_ws import * # noqa +from .web_server import Server # noqa +from .web_urldispatcher import AbstractResource # noqa +from .web_urldispatcher import AbstractRoute # noqa +from .web_urldispatcher import DynamicResource # noqa +from .web_urldispatcher import PlainResource # noqa +from .web_urldispatcher import Resource # noqa +from .web_urldispatcher import ResourceRoute # noqa +from .web_urldispatcher import StaticResource # noqa +from .web_urldispatcher import UrlDispatcher # noqa +from .web_urldispatcher import UrlMappingMatchInfo # noqa +from .web_urldispatcher import View # noqa +from .web_ws import WebSocketReady # noqa +from .web_ws import WebSocketResponse # noqa +from .web_ws import WSMsgType # noqa __all__ = (web_protocol.__all__ + From 4f38c4a9cdfde0c5df1de341e3640d3e739bb80a Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 28 Dec 2018 15:23:34 +0200 Subject: [PATCH 2/6] Convert __init__.py --- aiohttp/__init__.py | 311 ++++++++++++++++++++++++++++++-------------- 1 file changed, 210 insertions(+), 101 deletions(-) diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py index 5fba772dec0..16455dc9482 100644 --- a/aiohttp/__init__.py +++ b/aiohttp/__init__.py @@ -2,108 +2,217 @@ # This relies on each of the submodules having an __all__ variable. -from . import hdrs # noqa -from .client import BaseConnector # noqa -from .client import ClientConnectionError # noqa -from .client import ClientConnectorCertificateError # noqa -from .client import ClientConnectorError # noqa -from .client import ClientConnectorSSLError # noqa -from .client import ClientError # noqa -from .client import ClientHttpProxyError # noqa -from .client import ClientOSError # noqa -from .client import ClientPayloadError # noqa -from .client import ClientProxyConnectionError # noqa -from .client import ClientRequest # noqa -from .client import ClientResponse # noqa -from .client import ClientResponseError # noqa -from .client import ClientSSLError # noqa -from .client import ClientSession # noqa -from .client import ClientTimeout # noqa -from .client import ClientWebSocketResponse # noqa -from .client import ContentTypeError # noqa -from .client import Fingerprint # noqa -from .client import InvalidURL # noqa -from .client import RequestInfo # noqa -from .client import ServerConnectionError # noqa -from .client import ServerDisconnectedError # noqa -from .client import ServerFingerprintMismatch # noqa -from .client import ServerTimeoutError # noqa -from .client import TCPConnector # noqa -from .client import UnixConnector # noqa -from .client import WSServerHandshakeError # noqa -from .client import request # noqa -from .cookiejar import CookieJar # noqa -from .cookiejar import DummyCookieJar # noqa -from .formdata import FormData # noqa -from .helpers import BasicAuth # noqa -from .helpers import ChainMapProxy # noqa -from .http import (HttpVersion, HttpVersion10, HttpVersion11, # noqa - WSMsgType, WSCloseCode, WSMessage, WebSocketError) # noqa -from .multipart import BadContentDispositionHeader # noqa -from .multipart import BadContentDispositionParam # noqa -from .multipart import BodyPartReader # noqa -from .multipart import MultipartReader # noqa -from .multipart import MultipartWriter # noqa -from .multipart import content_disposition_filename # noqa -from .multipart import parse_content_disposition # noqa -from .payload import AsyncIterablePayload # noqa -from .payload import BufferedReaderPayload # noqa -from .payload import BytesIOPayload # noqa -from .payload import BytesPayload # noqa -from .payload import IOBasePayload # noqa -from .payload import JsonPayload # noqa -from .payload import PAYLOAD_REGISTRY # noqa -from .payload import Payload # noqa -from .payload import StringIOPayload # noqa -from .payload import StringPayload # noqa -from .payload import TextIOPayload # noqa -from .payload import get_payload # noqa -from .payload import payload_type # noqa -from .payload_streamer import streamer # noqa -from .resolver import AsyncResolver # noqa -from .resolver import DefaultResolver # noqa -from .resolver import ThreadedResolver # noqa -from .signals import Signal # noqa -from .streams import DataQueue # noqa -from .streams import EMPTY_PAYLOAD # noqa -from .streams import EofStream # noqa -from .streams import FlowControlDataQueue # noqa -from .streams import StreamReader # noqa -from .tracing import TraceConfig # noqa -from .tracing import TraceConnectionCreateEndParams # noqa -from .tracing import TraceConnectionCreateStartParams # noqa -from .tracing import TraceConnectionQueuedEndParams # noqa -from .tracing import TraceConnectionQueuedStartParams # noqa -from .tracing import TraceConnectionReuseconnParams # noqa -from .tracing import TraceDnsCacheHitParams # noqa -from .tracing import TraceDnsCacheMissParams # noqa -from .tracing import TraceDnsResolveHostEndParams # noqa -from .tracing import TraceDnsResolveHostStartParams # noqa -from .tracing import TraceRequestChunkSentParams # noqa -from .tracing import TraceRequestEndParams # noqa -from .tracing import TraceRequestExceptionParams # noqa -from .tracing import TraceRequestRedirectParams # noqa -from .tracing import TraceRequestStartParams # noqa -from .tracing import TraceResponseChunkReceivedParams # noqa +from typing import Tuple # noqa + +from . import hdrs +from .client import ( + BaseConnector, + ClientConnectionError, + ClientConnectorCertificateError, + ClientConnectorError, + ClientConnectorSSLError, + ClientError, + ClientHttpProxyError, + ClientOSError, + ClientPayloadError, + ClientProxyConnectionError, + ClientResponse, + ClientRequest, + ClientResponseError, + ClientSSLError, + ClientSession, + ClientTimeout, + ClientWebSocketResponse, + ContentTypeError, + Fingerprint, + InvalidURL, + RequestInfo, + ServerConnectionError, + ServerDisconnectedError, + ServerFingerprintMismatch, + ServerTimeoutError, + TCPConnector, + UnixConnector, + WSServerHandshakeError, + request +) + +from .cookiejar import CookieJar, DummyCookieJar +from .formdata import FormData +from .helpers import BasicAuth, ChainMapProxy +from .http import ( + HttpVersion, + HttpVersion10, + HttpVersion11, + WSMsgType, + WSCloseCode, + WSMessage, + WebSocketError +) + +from .multipart import ( + BadContentDispositionHeader, + BadContentDispositionParam, + BodyPartReader, + MultipartReader, + MultipartWriter, + content_disposition_filename, + parse_content_disposition +) + +from .payload import ( + AsyncIterablePayload, + BufferedReaderPayload, + BytesIOPayload, + BytesPayload, + IOBasePayload, + JsonPayload, + PAYLOAD_REGISTRY, + Payload, + StringIOPayload, + StringPayload, + TextIOPayload, + get_payload, + payload_type +) + +from .payload_streamer import streamer + +from .resolver import AsyncResolver, DefaultResolver, ThreadedResolver + +from .signals import Signal + +from .streams import ( + DataQueue, + EMPTY_PAYLOAD, + EofStream, + FlowControlDataQueue, + StreamReader +) + +from .tracing import ( + TraceConfig, + TraceConnectionCreateEndParams, + TraceConnectionCreateStartParams, + TraceConnectionQueuedEndParams, + TraceConnectionQueuedStartParams, + TraceConnectionReuseconnParams, + TraceDnsCacheHitParams, + TraceDnsCacheMissParams, + TraceDnsResolveHostEndParams, + TraceDnsResolveHostStartParams, + TraceRequestChunkSentParams, + TraceRequestEndParams, + TraceRequestExceptionParams, + TraceRequestRedirectParams, + TraceRequestStartParams, + TraceResponseChunkReceivedParams +) + +__all__ = ( + 'hdrs', + # client + 'BaseConnector', + 'ClientConnectionError', + 'ClientConnectorCertificateError', + 'ClientConnectorError', + 'ClientConnectorSSLError', + 'ClientError', + 'ClientHttpProxyError', + 'ClientOSError', + 'ClientPayloadError', + 'ClientProxyConnectionError', + 'ClientResponse', + 'ClientRequest', + 'ClientResponseError', + 'ClientSSLError', + 'ClientSession', + 'ClientTimeout', + 'ClientWebSocketResponse', + 'ContentTypeError', + 'Fingerprint', + 'InvalidURL', + 'RequestInfo', + 'ServerConnectionError', + 'ServerDisconnectedError', + 'ServerFingerprintMismatch', + 'ServerTimeoutError', + 'TCPConnector', + 'UnixConnector', + 'WSServerHandshakeError', + 'request', + # cookiejar + 'CookieJar', + 'DummyCookieJar', + # formdata + 'FormData', + # helpers + 'BasicAuth', + 'ChainMapProxy', + # http + 'HttpVersion', + 'HttpVersion10', + 'HttpVersion11', + 'WSMsgType', + 'WSCloseCode', + 'WSMessage', + 'WebSocketError', + # multipart + 'BadContentDispositionHeader', + 'BadContentDispositionParam', + 'BodyPartReader', + 'MultipartReader', + 'MultipartWriter', + 'content_disposition_filename', + 'parse_content_disposition', + # payload + 'AsyncIterablePayload', + 'BufferedReaderPayload', + 'BytesIOPayload', + 'BytesPayload', + 'IOBasePayload', + 'JsonPayload', + 'PAYLOAD_REGISTRY', + 'Payload', + 'StringIOPayload', + 'StringPayload', + 'TextIOPayload', + 'get_payload', + 'payload_type', + # payload_streamer + 'streamer', + # resolver + 'AsyncResolver', + 'DefaultResolver', + 'ThreadedResolver', + # signals + 'Signal', + 'DataQueue', + 'EMPTY_PAYLOAD', + 'EofStream', + 'FlowControlDataQueue', + 'StreamReader', + # tracing + 'TraceConfig', + 'TraceConnectionCreateEndParams', + 'TraceConnectionCreateStartParams', + 'TraceConnectionQueuedEndParams', + 'TraceConnectionQueuedStartParams', + 'TraceConnectionReuseconnParams', + 'TraceDnsCacheHitParams', + 'TraceDnsCacheMissParams', + 'TraceDnsResolveHostEndParams', + 'TraceDnsResolveHostStartParams', + 'TraceRequestChunkSentParams', + 'TraceRequestEndParams', + 'TraceRequestExceptionParams', + 'TraceRequestRedirectParams', + 'TraceRequestStartParams', + 'TraceResponseChunkReceivedParams', +) # type: Tuple[str, ...] try: from .worker import GunicornWebWorker, GunicornUVLoopWebWorker # noqa - workers = ('GunicornWebWorker', 'GunicornUVLoopWebWorker') + __all__ += ('GunicornWebWorker', 'GunicornUVLoopWebWorker') except ImportError: # pragma: no cover - workers = () # type: ignore - - -__all__ = (client.__all__ + # noqa - cookiejar.__all__ + # noqa - formdata.__all__ + # noqa - helpers.__all__ + # noqa - multipart.__all__ + # noqa - payload.__all__ + # noqa - payload_streamer.__all__ + # noqa - streams.__all__ + # noqa - signals.__all__ + # noqa - tracing.__all__ + # noqa - ('hdrs', 'HttpVersion', 'HttpVersion10', 'HttpVersion11', - 'WSMsgType', 'WSCloseCode', - 'WebSocketError', 'WSMessage', - ) + workers) + pass From 6b1169d85265fdfa964962690c97d4dda6952523 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 28 Dec 2018 16:40:25 +0200 Subject: [PATCH 3/6] Convert web.py --- aiohttp/web.py | 291 +++++++++++++++++++++++++++++-------------------- 1 file changed, 173 insertions(+), 118 deletions(-) diff --git a/aiohttp/web.py b/aiohttp/web.py index d73856c4a65..f3de9ba834c 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -7,129 +7,184 @@ from importlib import import_module from typing import Any, Awaitable, Callable, List, Optional, Type, Union, cast -from . import (web_app, web_exceptions, web_fileresponse, web_middlewares, - web_protocol, web_request, web_response, web_routedef, - web_runner, web_server, web_urldispatcher, web_ws) from .abc import AbstractAccessLogger from .helpers import all_tasks from .log import access_logger -from .web_app import CleanupError # noqa -from .web_app import Application -from .web_exceptions import HTTPAccepted # noqa -from .web_exceptions import HTTPBadGateway # noqa -from .web_exceptions import HTTPBadRequest # noqa -from .web_exceptions import HTTPClientError # noqa -from .web_exceptions import HTTPConflict # noqa -from .web_exceptions import HTTPCreated # noqa -from .web_exceptions import HTTPError # noqa -from .web_exceptions import HTTPException # noqa -from .web_exceptions import HTTPExpectationFailed # noqa -from .web_exceptions import HTTPFailedDependency # noqa -from .web_exceptions import HTTPForbidden # noqa -from .web_exceptions import HTTPFound # noqa -from .web_exceptions import HTTPGatewayTimeout # noqa -from .web_exceptions import HTTPGone # noqa -from .web_exceptions import HTTPInsufficientStorage # noqa -from .web_exceptions import HTTPInternalServerError # noqa -from .web_exceptions import HTTPLengthRequired # noqa -from .web_exceptions import HTTPMethodNotAllowed # noqa -from .web_exceptions import HTTPMisdirectedRequest # noqa -from .web_exceptions import HTTPMovedPermanently # noqa -from .web_exceptions import HTTPMultipleChoices # noqa -from .web_exceptions import HTTPNetworkAuthenticationRequired # noqa -from .web_exceptions import HTTPNoContent # noqa -from .web_exceptions import HTTPNonAuthoritativeInformation # noqa -from .web_exceptions import HTTPNotAcceptable # noqa -from .web_exceptions import HTTPNotExtended # noqa -from .web_exceptions import HTTPNotFound # noqa -from .web_exceptions import HTTPNotImplemented # noqa -from .web_exceptions import HTTPNotModified # noqa -from .web_exceptions import HTTPOk # noqa -from .web_exceptions import HTTPPartialContent # noqa -from .web_exceptions import HTTPPaymentRequired # noqa -from .web_exceptions import HTTPPermanentRedirect # noqa -from .web_exceptions import HTTPPreconditionFailed # noqa -from .web_exceptions import HTTPPreconditionRequired # noqa -from .web_exceptions import HTTPProxyAuthenticationRequired # noqa -from .web_exceptions import HTTPRedirection # noqa -from .web_exceptions import HTTPRequestEntityTooLarge # noqa -from .web_exceptions import HTTPRequestHeaderFieldsTooLarge # noqa -from .web_exceptions import HTTPRequestRangeNotSatisfiable # noqa -from .web_exceptions import HTTPRequestTimeout # noqa -from .web_exceptions import HTTPRequestURITooLong # noqa -from .web_exceptions import HTTPResetContent # noqa -from .web_exceptions import HTTPSeeOther # noqa -from .web_exceptions import HTTPServerError # noqa -from .web_exceptions import HTTPServiceUnavailable # noqa -from .web_exceptions import HTTPSuccessful # noqa -from .web_exceptions import HTTPTemporaryRedirect # noqa -from .web_exceptions import HTTPTooManyRequests # noqa -from .web_exceptions import HTTPUnauthorized # noqa -from .web_exceptions import HTTPUnavailableForLegalReasons # noqa -from .web_exceptions import HTTPUnprocessableEntity # noqa -from .web_exceptions import HTTPUnsupportedMediaType # noqa -from .web_exceptions import HTTPUpgradeRequired # noqa -from .web_exceptions import HTTPUseProxy # noqa -from .web_exceptions import HTTPVariantAlsoNegotiates # noqa -from .web_exceptions import HTTPVersionNotSupported # noqa -from .web_fileresponse import FileResponse # noqa +from .web_app import Application, CleanupError +from .web_exceptions import (HTTPAccepted, HTTPBadGateway, HTTPBadRequest, + HTTPClientError, HTTPConflict, HTTPCreated, + HTTPError, HTTPException, HTTPExpectationFailed, + HTTPFailedDependency, HTTPForbidden, HTTPFound, + HTTPGatewayTimeout, HTTPGone, + HTTPInsufficientStorage, HTTPInternalServerError, + HTTPLengthRequired, HTTPMethodNotAllowed, + HTTPMisdirectedRequest, HTTPMovedPermanently, + HTTPMultipleChoices, + HTTPNetworkAuthenticationRequired, HTTPNoContent, + HTTPNonAuthoritativeInformation, + HTTPNotAcceptable, HTTPNotExtended, HTTPNotFound, + HTTPNotImplemented, HTTPNotModified, HTTPOk, + HTTPPartialContent, HTTPPaymentRequired, + HTTPPermanentRedirect, HTTPPreconditionFailed, + HTTPPreconditionRequired, + HTTPProxyAuthenticationRequired, HTTPRedirection, + HTTPRequestEntityTooLarge, + HTTPRequestHeaderFieldsTooLarge, + HTTPRequestRangeNotSatisfiable, + HTTPRequestTimeout, HTTPRequestURITooLong, + HTTPResetContent, HTTPSeeOther, HTTPServerError, + HTTPServiceUnavailable, HTTPSuccessful, + HTTPTemporaryRedirect, HTTPTooManyRequests, + HTTPUnauthorized, HTTPUnavailableForLegalReasons, + HTTPUnprocessableEntity, HTTPUnsupportedMediaType, + HTTPUpgradeRequired, HTTPUseProxy, + HTTPVariantAlsoNegotiates, + HTTPVersionNotSupported) +from .web_fileresponse import FileResponse from .web_log import AccessLogger -from .web_middlewares import middleware, normalize_path_middleware # noqa -from .web_protocol import PayloadAccessError # noqa -from .web_protocol import RequestHandler # noqa -from .web_protocol import RequestPayloadError # noqa -from .web_request import BaseRequest, FileField, Request # noqa -from .web_response import ContentCoding # noqa -from .web_response import Response # noqa -from .web_response import StreamResponse # noqa -from .web_response import json_response # noqa -from .web_routedef import AbstractRouteDef # noqa -from .web_routedef import RouteDef # noqa -from .web_routedef import RouteTableDef # noqa -from .web_routedef import StaticDef # noqa -from .web_routedef import delete # noqa -from .web_routedef import get # noqa -from .web_routedef import head # noqa -from .web_routedef import options # noqa -from .web_routedef import patch # noqa -from .web_routedef import post # noqa -from .web_routedef import put # noqa -from .web_routedef import route # noqa -from .web_routedef import static # noqa -from .web_routedef import view # noqa -from .web_runner import (AppRunner, BaseRunner, BaseSite, GracefulExit, # noqa +from .web_middlewares import middleware, normalize_path_middleware +from .web_protocol import (PayloadAccessError, RequestHandler, + RequestPayloadError) +from .web_request import BaseRequest, FileField, Request +from .web_response import (ContentCoding, Response, StreamResponse, + json_response) +from .web_routedef import (AbstractRouteDef, RouteDef, RouteTableDef, + StaticDef, delete, get, head, options, patch, post, + put, route, static, view) +from .web_runner import (AppRunner, BaseRunner, BaseSite, GracefulExit, ServerRunner, SockSite, TCPSite, UnixSite) -from .web_server import Server # noqa -from .web_urldispatcher import AbstractResource # noqa -from .web_urldispatcher import AbstractRoute # noqa -from .web_urldispatcher import DynamicResource # noqa -from .web_urldispatcher import PlainResource # noqa -from .web_urldispatcher import Resource # noqa -from .web_urldispatcher import ResourceRoute # noqa -from .web_urldispatcher import StaticResource # noqa -from .web_urldispatcher import UrlDispatcher # noqa -from .web_urldispatcher import UrlMappingMatchInfo # noqa -from .web_urldispatcher import View # noqa -from .web_ws import WebSocketReady # noqa -from .web_ws import WebSocketResponse # noqa -from .web_ws import WSMsgType # noqa - - -__all__ = (web_protocol.__all__ + - web_app.__all__ + - web_fileresponse.__all__ + - web_request.__all__ + - web_response.__all__ + - web_routedef.__all__ + - web_exceptions.__all__ + - web_urldispatcher.__all__ + - web_ws.__all__ + - web_server.__all__ + - web_runner.__all__ + - web_middlewares.__all__ + - ('run_app', 'BaseSite', 'TCPSite', 'UnixSite', - 'SockSite', 'BaseRunner', - 'AppRunner', 'ServerRunner', 'GracefulExit')) +from .web_server import Server +from .web_urldispatcher import (AbstractResource, AbstractRoute, + DynamicResource, PlainResource, Resource, + ResourceRoute, StaticResource, UrlDispatcher, + UrlMappingMatchInfo, View) +from .web_ws import WebSocketReady, WebSocketResponse, WSMsgType + + +__all__ = ( + # web_app + 'Application', + 'CleanupError', + # web_exceptions + 'HTTPAccepted', + 'HTTPBadGateway', + 'HTTPBadRequest', + 'HTTPClientError', + 'HTTPConflict', + 'HTTPCreated', + 'HTTPError', + 'HTTPException', + 'HTTPExpectationFailed', + 'HTTPFailedDependency', + 'HTTPForbidden', + 'HTTPFound', + 'HTTPGatewayTimeout', + 'HTTPGone', + 'HTTPInsufficientStorage', + 'HTTPInternalServerError', + 'HTTPLengthRequired', + 'HTTPMethodNotAllowed', + 'HTTPMisdirectedRequest', + 'HTTPMovedPermanently', + 'HTTPMultipleChoices', + 'HTTPNetworkAuthenticationRequired', + 'HTTPNoContent', + 'HTTPNonAuthoritativeInformation', + 'HTTPNotAcceptable', + 'HTTPNotExtended', + 'HTTPNotFound', + 'HTTPNotImplemented', + 'HTTPNotModified', + 'HTTPOk', + 'HTTPPartialContent', + 'HTTPPaymentRequired', + 'HTTPPermanentRedirect', + 'HTTPPreconditionFailed', + 'HTTPPreconditionRequired', + 'HTTPProxyAuthenticationRequired', + 'HTTPRedirection', + 'HTTPRequestEntityTooLarge', + 'HTTPRequestHeaderFieldsTooLarge', + 'HTTPRequestRangeNotSatisfiable', + 'HTTPRequestTimeout', + 'HTTPRequestURITooLong', + 'HTTPResetContent', + 'HTTPSeeOther', + 'HTTPServerError', + 'HTTPServiceUnavailable', + 'HTTPSuccessful', + 'HTTPTemporaryRedirect', + 'HTTPTooManyRequests', + 'HTTPUnauthorized', + 'HTTPUnavailableForLegalReasons', + 'HTTPUnprocessableEntity', + 'HTTPUnsupportedMediaType', + 'HTTPUpgradeRequired', + 'HTTPUseProxy', + 'HTTPVariantAlsoNegotiates', + 'HTTPVersionNotSupported', + # web_fileresponse + 'FileResponse', + # web_middlewares + 'middleware', + 'normalize_path_middleware', + # web_protocol + 'PayloadAccessError', + 'RequestHandler', + 'RequestPayloadError', + # web_request + 'BaseRequest', + 'FileField', + 'Request', + # web_response + 'ContentCoding', + 'Response', + 'StreamResponse', + 'json_response', + # web_routedef + 'AbstractRouteDef', + 'RouteDef', + 'RouteTableDef', + 'StaticDef', + 'delete', + 'get', + 'head', + 'options', + 'patch', + 'post', + 'put', + 'route', + 'static', + 'view', + # web_runner + 'AppRunner', + 'BaseRunner', + 'BaseSite', + 'GracefulExit', + 'ServerRunner', + 'SockSite', + 'TCPSite', + 'UnixSite', + # web_server + 'Server', + # web_urldispatcher + 'AbstractResource', + 'AbstractRoute', + 'DynamicResource', + 'PlainResource', + 'Resource', + 'ResourceRoute', + 'StaticResource', + 'UrlDispatcher', + 'UrlMappingMatchInfo', + 'View', + # web_ws + 'WebSocketReady', + 'WebSocketResponse', + 'WSMsgType', + # web + 'run_app', +) try: From 6262649b1645e988061a587c37f65662c99dbf0e Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 28 Dec 2018 16:48:48 +0200 Subject: [PATCH 4/6] Drop incorrect comment --- aiohttp/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py index 16455dc9482..0d5eb40281a 100644 --- a/aiohttp/__init__.py +++ b/aiohttp/__init__.py @@ -1,7 +1,5 @@ __version__ = '4.0.0a0' -# This relies on each of the submodules having an __all__ variable. - from typing import Tuple # noqa from . import hdrs From 5490e1bbdf8313b24a9a9d0b7f1b782cf94c8c78 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 28 Dec 2018 16:53:32 +0200 Subject: [PATCH 5/6] Change isort settings --- aiohttp/abc.py | 15 ++- aiohttp/client.py | 58 +++++++--- aiohttp/client_exceptions.py | 1 - aiohttp/client_proto.py | 8 +- aiohttp/client_reqrep.py | 48 ++++++-- aiohttp/client_ws.py | 17 ++- aiohttp/connector.py | 48 +++++--- aiohttp/cookiejar.py | 15 ++- aiohttp/formdata.py | 1 - aiohttp/hdrs.py | 1 - aiohttp/helpers.py | 21 +++- aiohttp/http.py | 37 ++++-- aiohttp/http_exceptions.py | 1 - aiohttp/http_parser.py | 12 +- aiohttp/http_websocket.py | 1 - aiohttp/http_writer.py | 1 - aiohttp/locks.py | 1 - aiohttp/log.py | 1 - aiohttp/multipart.py | 37 ++++-- aiohttp/payload.py | 28 ++++- aiohttp/payload_streamer.py | 1 - aiohttp/pytest_plugin.py | 12 +- aiohttp/resolver.py | 1 - aiohttp/signals.py | 1 - aiohttp/streams.py | 1 - aiohttp/tcp_helpers.py | 1 - aiohttp/test_utils.py | 32 ++++-- aiohttp/tracing.py | 1 - aiohttp/typedefs.py | 12 +- aiohttp/web.py | 151 ++++++++++++++++++------- aiohttp/web_app.py | 43 +++++-- aiohttp/web_exceptions.py | 1 - aiohttp/web_fileresponse.py | 24 +++- aiohttp/web_log.py | 1 - aiohttp/web_middlewares.py | 1 - aiohttp/web_protocol.py | 21 +++- aiohttp/web_request.py | 24 +++- aiohttp/web_response.py | 15 ++- aiohttp/web_routedef.py | 16 ++- aiohttp/web_runner.py | 1 - aiohttp/web_server.py | 1 - aiohttp/web_urldispatcher.py | 32 +++++- aiohttp/web_ws.py | 16 ++- aiohttp/worker.py | 1 - examples/legacy/srv.py | 1 - examples/legacy/tcp_protocol_parser.py | 1 - examples/static_files.py | 1 - examples/web_cookies.py | 1 - examples/web_srv_route_deco.py | 1 - examples/web_ws.py | 1 - setup.cfg | 6 +- tests/conftest.py | 1 - tests/test_client_fingerprint.py | 1 - tests/test_client_request.py | 8 +- tests/test_helpers.py | 1 - tests/test_http_parser.py | 9 +- tests/test_multipart.py | 9 +- tests/test_pytest_plugin.py | 1 - tests/test_resolver.py | 1 - tests/test_run_app.py | 1 - tests/test_streams.py | 1 - tests/test_tcp_helpers.py | 1 - tests/test_test_utils.py | 8 +- tests/test_tracing.py | 34 +++--- tests/test_urldispatch.py | 18 ++- tests/test_web_functional.py | 11 +- tests/test_web_log.py | 1 - tests/test_web_sendfile_functional.py | 1 - tests/test_websocket_parser.py | 12 +- tests/test_worker.py | 1 - 70 files changed, 643 insertions(+), 251 deletions(-) diff --git a/aiohttp/abc.py b/aiohttp/abc.py index 2c9034d6c4e..58817c0840c 100644 --- a/aiohttp/abc.py +++ b/aiohttp/abc.py @@ -3,8 +3,18 @@ from abc import ABC, abstractmethod from collections.abc import Sized from http.cookies import BaseCookie, Morsel # noqa -from typing import (TYPE_CHECKING, Any, Awaitable, Callable, Dict, Generator, - Iterable, List, Optional, Tuple) +from typing import ( + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Dict, + Generator, + Iterable, + List, + Optional, + Tuple, +) from multidict import CIMultiDict # noqa from yarl import URL @@ -12,7 +22,6 @@ from .helpers import get_running_loop from .typedefs import LooseCookies - if TYPE_CHECKING: # pragma: no cover from .web_request import BaseRequest, Request from .web_response import StreamResponse diff --git a/aiohttp/client.py b/aiohttp/client.py index 174dce0d335..c0a1437bab2 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -9,8 +9,21 @@ import traceback import warnings from types import SimpleNamespace, TracebackType -from typing import (Any, Coroutine, Generator, Generic, Iterable, List, # noqa - Mapping, Optional, Set, Tuple, Type, TypeVar, Union) +from typing import ( # noqa + Any, + Coroutine, + Generator, + Generic, + Iterable, + List, + Mapping, + Optional, + Set, + Tuple, + Type, + TypeVar, + Union, +) import attr from multidict import CIMultiDict, MultiDict, MultiDictProxy, istr @@ -33,27 +46,46 @@ from .client_exceptions import ServerConnectionError # noqa from .client_exceptions import ServerDisconnectedError # noqa from .client_exceptions import ServerFingerprintMismatch # noqa -from .client_exceptions import (ClientError, ClientOSError, InvalidURL, - ServerTimeoutError, TooManyRedirects, - WSServerHandshakeError) +from .client_exceptions import ( + ClientError, + ClientOSError, + InvalidURL, + ServerTimeoutError, + TooManyRedirects, + WSServerHandshakeError, +) from .client_reqrep import RequestInfo # noqa -from .client_reqrep import (ClientRequest, ClientResponse, Fingerprint, - _merge_ssl_params) +from .client_reqrep import ( + ClientRequest, + ClientResponse, + Fingerprint, + _merge_ssl_params, +) from .client_ws import ClientWebSocketResponse from .connector import UnixConnector # noqa from .connector import BaseConnector, TCPConnector from .cookiejar import CookieJar -from .helpers import (PY_36, BasicAuth, CeilTimeout, TimeoutHandle, - get_running_loop, proxies_from_env, sentinel, - strip_auth_from_url) +from .helpers import ( + PY_36, + BasicAuth, + CeilTimeout, + TimeoutHandle, + get_running_loop, + proxies_from_env, + sentinel, + strip_auth_from_url, +) from .http import WS_KEY, HttpVersion, WebSocketReader, WebSocketWriter -from .http_websocket import (WSHandshakeError, WSMessage, ws_ext_gen, # noqa - ws_ext_parse) +from .http_websocket import ( # noqa + WSHandshakeError, + WSMessage, + ws_ext_gen, + ws_ext_parse, +) from .streams import FlowControlDataQueue from .tracing import Trace, TraceConfig from .typedefs import JSONEncoder, LooseCookies, LooseHeaders, StrOrURL - __all__ = (client_exceptions.__all__ + # noqa client_reqrep.__all__ + # noqa connector_mod.__all__ + # noqa diff --git a/aiohttp/client_exceptions.py b/aiohttp/client_exceptions.py index a23ff9688a2..e06077ac668 100644 --- a/aiohttp/client_exceptions.py +++ b/aiohttp/client_exceptions.py @@ -6,7 +6,6 @@ from .typedefs import _CIMultiDict - try: import ssl SSLContext = ssl.SSLContext diff --git a/aiohttp/client_proto.py b/aiohttp/client_proto.py index 9e8047a947f..87db71a0e6e 100644 --- a/aiohttp/client_proto.py +++ b/aiohttp/client_proto.py @@ -3,8 +3,12 @@ from typing import Any, Optional, Tuple from .base_protocol import BaseProtocol -from .client_exceptions import (ClientOSError, ClientPayloadError, - ServerDisconnectedError, ServerTimeoutError) +from .client_exceptions import ( + ClientOSError, + ClientPayloadError, + ServerDisconnectedError, + ServerTimeoutError, +) from .helpers import BaseTimerContext from .http import HttpResponseParser, RawResponseMessage from .streams import EMPTY_PAYLOAD, DataQueue, StreamReader diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py index 6a7fe810e0f..5ef133bf325 100644 --- a/aiohttp/client_reqrep.py +++ b/aiohttp/client_reqrep.py @@ -8,8 +8,19 @@ from hashlib import md5, sha1, sha256 from http.cookies import CookieError, Morsel, SimpleCookie from types import MappingProxyType, TracebackType -from typing import (TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, # noqa - Optional, Tuple, Type, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Dict, + Iterable, + List, + Mapping, + Optional, + Tuple, + Type, + Union, + cast, +) import attr from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy @@ -17,18 +28,35 @@ from . import hdrs, helpers, http, multipart, payload from .abc import AbstractStreamWriter -from .client_exceptions import (ClientConnectionError, ClientOSError, - ClientResponseError, ContentTypeError, - InvalidURL, ServerFingerprintMismatch) +from .client_exceptions import ( + ClientConnectionError, + ClientOSError, + ClientResponseError, + ContentTypeError, + InvalidURL, + ServerFingerprintMismatch, +) from .formdata import FormData -from .helpers import (PY_36, BaseTimerContext, BasicAuth, HeadersMixin, # noqa - TimerNoop, noop, reify, set_result) +from .helpers import ( # noqa + PY_36, + BaseTimerContext, + BasicAuth, + HeadersMixin, + TimerNoop, + noop, + reify, + set_result, +) from .http import SERVER_SOFTWARE, HttpVersion10, HttpVersion11, StreamWriter from .log import client_logger from .streams import StreamReader # noqa -from .typedefs import (DEFAULT_JSON_DECODER, JSONDecoder, LooseCookies, - LooseHeaders, RawHeaders) - +from .typedefs import ( + DEFAULT_JSON_DECODER, + JSONDecoder, + LooseCookies, + LooseHeaders, + RawHeaders, +) try: import ssl diff --git a/aiohttp/client_ws.py b/aiohttp/client_ws.py index e5e5fbdc913..e5fd126a5ab 100644 --- a/aiohttp/client_ws.py +++ b/aiohttp/client_ws.py @@ -8,12 +8,21 @@ from .client_exceptions import ClientError from .client_reqrep import ClientResponse from .helpers import call_later, set_result -from .http import (WS_CLOSED_MESSAGE, WS_CLOSING_MESSAGE, WebSocketError, - WSMessage, WSMsgType) +from .http import ( + WS_CLOSED_MESSAGE, + WS_CLOSING_MESSAGE, + WebSocketError, + WSMessage, + WSMsgType, +) from .http_websocket import WebSocketWriter # WSMessage from .streams import EofStream, FlowControlDataQueue # noqa -from .typedefs import (DEFAULT_JSON_DECODER, DEFAULT_JSON_ENCODER, JSONDecoder, - JSONEncoder) +from .typedefs import ( + DEFAULT_JSON_DECODER, + DEFAULT_JSON_ENCODER, + JSONDecoder, + JSONEncoder, +) class ClientWebSocketResponse: diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 01edd0c1e56..dc33879ed09 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -10,30 +10,52 @@ from itertools import cycle, islice from time import monotonic from types import TracebackType -from typing import (TYPE_CHECKING, Any, Awaitable, Callable, # noqa - DefaultDict, Dict, Iterator, List, Optional, Set, Tuple, - Type, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Awaitable, + Callable, + DefaultDict, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Type, + Union, + cast, +) import attr from . import hdrs, helpers from .abc import AbstractResolver -from .client_exceptions import (ClientConnectionError, - ClientConnectorCertificateError, - ClientConnectorError, ClientConnectorSSLError, - ClientHttpProxyError, - ClientProxyConnectionError, - ServerFingerprintMismatch, cert_errors, - ssl_errors) +from .client_exceptions import ( + ClientConnectionError, + ClientConnectorCertificateError, + ClientConnectorError, + ClientConnectorSSLError, + ClientHttpProxyError, + ClientProxyConnectionError, + ServerFingerprintMismatch, + cert_errors, + ssl_errors, +) from .client_proto import ResponseHandler from .client_reqrep import ClientRequest, Fingerprint, _merge_ssl_params -from .helpers import (PY_36, CeilTimeout, get_running_loop, is_ip_address, - noop2, sentinel) +from .helpers import ( + PY_36, + CeilTimeout, + get_running_loop, + is_ip_address, + noop2, + sentinel, +) from .http import RESPONSES from .locks import EventResultOrError from .resolver import DefaultResolver - try: import ssl SSLContext = ssl.SSLContext diff --git a/aiohttp/cookiejar.py b/aiohttp/cookiejar.py index e5f9bf91cb1..a78e88d33f6 100644 --- a/aiohttp/cookiejar.py +++ b/aiohttp/cookiejar.py @@ -7,8 +7,18 @@ from collections import defaultdict from http.cookies import BaseCookie, Morsel, SimpleCookie # noqa from math import ceil -from typing import (DefaultDict, Dict, Iterable, Iterator, Mapping, # noqa - Optional, Set, Tuple, Union, cast) +from typing import ( # noqa + DefaultDict, + Dict, + Iterable, + Iterator, + Mapping, + Optional, + Set, + Tuple, + Union, + cast, +) from yarl import URL @@ -16,7 +26,6 @@ from .helpers import is_ip_address from .typedefs import LooseCookies, PathLike - __all__ = ('CookieJar', 'DummyCookieJar') diff --git a/aiohttp/formdata.py b/aiohttp/formdata.py index 72cd325a4e7..b4ffa048f37 100644 --- a/aiohttp/formdata.py +++ b/aiohttp/formdata.py @@ -8,7 +8,6 @@ from .helpers import guess_filename from .payload import Payload - __all__ = ('FormData',) diff --git a/aiohttp/hdrs.py b/aiohttp/hdrs.py index a2b4490e35c..c11a9d30d6e 100644 --- a/aiohttp/hdrs.py +++ b/aiohttp/hdrs.py @@ -5,7 +5,6 @@ from multidict import istr - METH_ANY = '*' METH_CONNECT = 'CONNECT' METH_HEAD = 'HEAD' diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 9795f870f56..a44a407fea2 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -19,9 +19,23 @@ from math import ceil from pathlib import Path from types import TracebackType -from typing import (Any, Callable, Dict, Iterable, Iterator, List, # noqa - Mapping, Optional, Pattern, Set, Tuple, Type, TypeVar, - Union, cast) +from typing import ( # noqa + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Pattern, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, +) from urllib.parse import quote from urllib.request import getproxies @@ -34,7 +48,6 @@ from .log import client_logger, internal_logger from .typedefs import PathLike # noqa - __all__ = ('BasicAuth', 'ChainMapProxy') PY_36 = sys.version_info >= (3, 6) diff --git a/aiohttp/http.py b/aiohttp/http.py index a072d274470..75362162ee4 100644 --- a/aiohttp/http.py +++ b/aiohttp/http.py @@ -4,16 +4,33 @@ from . import __version__ from .http_exceptions import HttpProcessingError -from .http_parser import (HeadersParser, HttpParser, HttpRequestParser, - HttpResponseParser, RawRequestMessage, - RawResponseMessage) -from .http_websocket import (WS_CLOSED_MESSAGE, WS_CLOSING_MESSAGE, WS_KEY, - WebSocketError, WebSocketReader, WebSocketWriter, - WSCloseCode, WSMessage, WSMsgType, ws_ext_gen, - ws_ext_parse) -from .http_writer import (HttpVersion, HttpVersion10, HttpVersion11, - StreamWriter) - +from .http_parser import ( + HeadersParser, + HttpParser, + HttpRequestParser, + HttpResponseParser, + RawRequestMessage, + RawResponseMessage, +) +from .http_websocket import ( + WS_CLOSED_MESSAGE, + WS_CLOSING_MESSAGE, + WS_KEY, + WebSocketError, + WebSocketReader, + WebSocketWriter, + WSCloseCode, + WSMessage, + WSMsgType, + ws_ext_gen, + ws_ext_parse, +) +from .http_writer import ( + HttpVersion, + HttpVersion10, + HttpVersion11, + StreamWriter, +) __all__ = ( 'HttpProcessingError', 'RESPONSES', 'SERVER_SOFTWARE', diff --git a/aiohttp/http_exceptions.py b/aiohttp/http_exceptions.py index 54dcaad46fe..d45bd7789b1 100644 --- a/aiohttp/http_exceptions.py +++ b/aiohttp/http_exceptions.py @@ -5,7 +5,6 @@ from .typedefs import _CIMultiDict - __all__ = ('HttpProcessingError',) diff --git a/aiohttp/http_parser.py b/aiohttp/http_parser.py index a738a9689f2..9e22d10263a 100644 --- a/aiohttp/http_parser.py +++ b/aiohttp/http_parser.py @@ -13,15 +13,19 @@ from . import hdrs from .base_protocol import BaseProtocol from .helpers import NO_EXTENSIONS, BaseTimerContext -from .http_exceptions import (BadStatusLine, ContentEncodingError, - ContentLengthError, InvalidHeader, LineTooLong, - TransferEncodingError) +from .http_exceptions import ( + BadStatusLine, + ContentEncodingError, + ContentLengthError, + InvalidHeader, + LineTooLong, + TransferEncodingError, +) from .http_writer import HttpVersion, HttpVersion10 from .log import internal_logger from .streams import EMPTY_PAYLOAD, StreamReader from .typedefs import RawHeaders - try: import brotli HAS_BROTLI = True diff --git a/aiohttp/http_websocket.py b/aiohttp/http_websocket.py index 0be22cbfc2d..d8fc10f4567 100644 --- a/aiohttp/http_websocket.py +++ b/aiohttp/http_websocket.py @@ -16,7 +16,6 @@ from .log import ws_logger from .streams import DataQueue - __all__ = ('WS_CLOSED_MESSAGE', 'WS_CLOSING_MESSAGE', 'WS_KEY', 'WebSocketReader', 'WebSocketWriter', 'WSMessage', 'WebSocketError', 'WSMsgType', 'WSCloseCode') diff --git a/aiohttp/http_writer.py b/aiohttp/http_writer.py index 8c3a9e7c7ce..7e27fbf6a43 100644 --- a/aiohttp/http_writer.py +++ b/aiohttp/http_writer.py @@ -11,7 +11,6 @@ from .base_protocol import BaseProtocol from .helpers import NO_EXTENSIONS - __all__ = ('StreamWriter', 'HttpVersion', 'HttpVersion10', 'HttpVersion11') HttpVersion = collections.namedtuple('HttpVersion', ['major', 'minor']) diff --git a/aiohttp/locks.py b/aiohttp/locks.py index 95329969820..ed41f979589 100644 --- a/aiohttp/locks.py +++ b/aiohttp/locks.py @@ -2,7 +2,6 @@ import collections from typing import Any, Optional - try: from typing import Deque except ImportError: diff --git a/aiohttp/log.py b/aiohttp/log.py index 48400473129..cfda0e5f070 100644 --- a/aiohttp/log.py +++ b/aiohttp/log.py @@ -1,6 +1,5 @@ import logging - access_logger = logging.getLogger('aiohttp.access') client_logger = logging.getLogger('aiohttp.client') internal_logger = logging.getLogger('aiohttp.internal') diff --git a/aiohttp/multipart.py b/aiohttp/multipart.py index c187a1c41fe..7b1efc5b6f1 100644 --- a/aiohttp/multipart.py +++ b/aiohttp/multipart.py @@ -7,21 +7,44 @@ import zlib from collections import deque from types import TracebackType -from typing import (TYPE_CHECKING, Any, Dict, Iterator, List, Mapping, # noqa - Optional, Sequence, Tuple, Type, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Dict, + Iterator, + List, + Mapping, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from urllib.parse import parse_qsl, unquote, urlencode from multidict import CIMultiDict, CIMultiDictProxy, MultiMapping # noqa -from .hdrs import (CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LENGTH, - CONTENT_TRANSFER_ENCODING, CONTENT_TYPE) +from .hdrs import ( + CONTENT_DISPOSITION, + CONTENT_ENCODING, + CONTENT_LENGTH, + CONTENT_TRANSFER_ENCODING, + CONTENT_TYPE, +) from .helpers import CHAR, TOKEN, parse_mimetype, reify from .http import HeadersParser -from .payload import (JsonPayload, LookupError, Order, Payload, StringPayload, - get_payload, payload_type) +from .payload import ( + JsonPayload, + LookupError, + Order, + Payload, + StringPayload, + get_payload, + payload_type, +) from .streams import StreamReader - __all__ = ('MultipartReader', 'MultipartWriter', 'BodyPartReader', 'BadContentDispositionHeader', 'BadContentDispositionParam', 'parse_content_disposition', 'content_disposition_filename') diff --git a/aiohttp/payload.py b/aiohttp/payload.py index e69638b93fa..3e640dd7bc2 100644 --- a/aiohttp/payload.py +++ b/aiohttp/payload.py @@ -6,19 +6,37 @@ import warnings from abc import ABC, abstractmethod from itertools import chain -from typing import (IO, TYPE_CHECKING, Any, ByteString, Callable, Dict, # noqa - Iterable, List, Optional, Text, TextIO, Tuple, Type, Union) +from typing import ( # noqa + IO, + TYPE_CHECKING, + Any, + ByteString, + Callable, + Dict, + Iterable, + List, + Optional, + Text, + TextIO, + Tuple, + Type, + Union, +) from multidict import CIMultiDict from . import hdrs from .abc import AbstractStreamWriter -from .helpers import (PY_36, content_disposition_header, guess_filename, - parse_mimetype, sentinel) +from .helpers import ( + PY_36, + content_disposition_header, + guess_filename, + parse_mimetype, + sentinel, +) from .streams import DEFAULT_LIMIT, StreamReader from .typedefs import JSONEncoder, _CIMultiDict - __all__ = ('PAYLOAD_REGISTRY', 'get_payload', 'payload_type', 'Payload', 'BytesPayload', 'StringPayload', 'IOBasePayload', 'BytesIOPayload', 'BufferedReaderPayload', diff --git a/aiohttp/payload_streamer.py b/aiohttp/payload_streamer.py index 606a719f8ef..e76bf430ae9 100644 --- a/aiohttp/payload_streamer.py +++ b/aiohttp/payload_streamer.py @@ -28,7 +28,6 @@ async def file_sender(writer, file_name=None): from .abc import AbstractStreamWriter from .payload import Payload, payload_type - __all__ = ('streamer',) diff --git a/aiohttp/pytest_plugin.py b/aiohttp/pytest_plugin.py index a2ba2d1cd2c..4658da61dcc 100644 --- a/aiohttp/pytest_plugin.py +++ b/aiohttp/pytest_plugin.py @@ -8,11 +8,17 @@ from aiohttp.helpers import isasyncgenfunction from aiohttp.web import Application -from .test_utils import (BaseTestServer, RawTestServer, TestClient, TestServer, - loop_context, setup_test_loop, teardown_test_loop) +from .test_utils import ( + BaseTestServer, + RawTestServer, + TestClient, + TestServer, + loop_context, + setup_test_loop, + teardown_test_loop, +) from .test_utils import unused_port as _unused_port - try: import uvloop except ImportError: # pragma: no cover diff --git a/aiohttp/resolver.py b/aiohttp/resolver.py index db69f1cc08b..e0b6e130ace 100644 --- a/aiohttp/resolver.py +++ b/aiohttp/resolver.py @@ -5,7 +5,6 @@ from .abc import AbstractResolver from .helpers import get_running_loop - __all__ = ('ThreadedResolver', 'AsyncResolver', 'DefaultResolver') try: diff --git a/aiohttp/signals.py b/aiohttp/signals.py index b87648297e9..dda0dab41f1 100644 --- a/aiohttp/signals.py +++ b/aiohttp/signals.py @@ -1,6 +1,5 @@ from aiohttp.frozenlist import FrozenList - __all__ = ('Signal',) diff --git a/aiohttp/streams.py b/aiohttp/streams.py index 970816b2217..9dd08794fa3 100644 --- a/aiohttp/streams.py +++ b/aiohttp/streams.py @@ -8,7 +8,6 @@ from .helpers import BaseTimerContext, set_exception, set_result from .log import internal_logger - try: # pragma: no cover from typing import Deque # noqa except ImportError: diff --git a/aiohttp/tcp_helpers.py b/aiohttp/tcp_helpers.py index d703dc357a2..440c1167321 100644 --- a/aiohttp/tcp_helpers.py +++ b/aiohttp/tcp_helpers.py @@ -5,7 +5,6 @@ from contextlib import suppress from typing import Optional # noqa - __all__ = ('tcp_keepalive', 'tcp_nodelay', 'tcp_cork') diff --git a/aiohttp/test_utils.py b/aiohttp/test_utils.py index 7bd741689fa..177441a42d7 100644 --- a/aiohttp/test_utils.py +++ b/aiohttp/test_utils.py @@ -9,16 +9,27 @@ import unittest from abc import ABC, abstractmethod from types import TracebackType -from typing import (TYPE_CHECKING, Any, Callable, Iterator, List, # noqa - Optional, Type, Union) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Callable, + Iterator, + List, + Optional, + Type, + Union, +) from unittest import mock from multidict import CIMultiDict, CIMultiDictProxy from yarl import URL import aiohttp -from aiohttp.client import (ClientResponse, _RequestContextManager, - _WSRequestContextManager) +from aiohttp.client import ( + ClientResponse, + _RequestContextManager, + _WSRequestContextManager, +) from . import ClientSession, hdrs from .abc import AbstractCookieJar @@ -27,11 +38,18 @@ from .helpers import sentinel from .http import HttpVersion, RawRequestMessage from .signals import Signal -from .web import (Application, AppRunner, BaseRunner, Request, Server, - ServerRunner, SockSite, UrlMappingMatchInfo) +from .web import ( + Application, + AppRunner, + BaseRunner, + Request, + Server, + ServerRunner, + SockSite, + UrlMappingMatchInfo, +) from .web_protocol import _RequestHandler - if TYPE_CHECKING: # pragma: no cover from ssl import SSLContext else: diff --git a/aiohttp/tracing.py b/aiohttp/tracing.py index bc06c81a011..84c10ed2435 100644 --- a/aiohttp/tracing.py +++ b/aiohttp/tracing.py @@ -8,7 +8,6 @@ from .client_reqrep import ClientResponse from .signals import Signal - if TYPE_CHECKING: # pragma: no cover from .client import ClientSession # noqa diff --git a/aiohttp/typedefs.py b/aiohttp/typedefs.py index 8e173b8db93..d7c97a435dd 100644 --- a/aiohttp/typedefs.py +++ b/aiohttp/typedefs.py @@ -2,13 +2,19 @@ import os # noqa import pathlib # noqa import sys -from typing import (TYPE_CHECKING, Any, Callable, Iterable, Mapping, Tuple, - Union) +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Iterable, + Mapping, + Tuple, + Union, +) from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy from yarl import URL - DEFAULT_JSON_ENCODER = json.dumps DEFAULT_JSON_DECODER = json.loads diff --git a/aiohttp/web.py b/aiohttp/web.py index f3de9ba834c..0c3b6374d0f 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -11,56 +11,121 @@ from .helpers import all_tasks from .log import access_logger from .web_app import Application, CleanupError -from .web_exceptions import (HTTPAccepted, HTTPBadGateway, HTTPBadRequest, - HTTPClientError, HTTPConflict, HTTPCreated, - HTTPError, HTTPException, HTTPExpectationFailed, - HTTPFailedDependency, HTTPForbidden, HTTPFound, - HTTPGatewayTimeout, HTTPGone, - HTTPInsufficientStorage, HTTPInternalServerError, - HTTPLengthRequired, HTTPMethodNotAllowed, - HTTPMisdirectedRequest, HTTPMovedPermanently, - HTTPMultipleChoices, - HTTPNetworkAuthenticationRequired, HTTPNoContent, - HTTPNonAuthoritativeInformation, - HTTPNotAcceptable, HTTPNotExtended, HTTPNotFound, - HTTPNotImplemented, HTTPNotModified, HTTPOk, - HTTPPartialContent, HTTPPaymentRequired, - HTTPPermanentRedirect, HTTPPreconditionFailed, - HTTPPreconditionRequired, - HTTPProxyAuthenticationRequired, HTTPRedirection, - HTTPRequestEntityTooLarge, - HTTPRequestHeaderFieldsTooLarge, - HTTPRequestRangeNotSatisfiable, - HTTPRequestTimeout, HTTPRequestURITooLong, - HTTPResetContent, HTTPSeeOther, HTTPServerError, - HTTPServiceUnavailable, HTTPSuccessful, - HTTPTemporaryRedirect, HTTPTooManyRequests, - HTTPUnauthorized, HTTPUnavailableForLegalReasons, - HTTPUnprocessableEntity, HTTPUnsupportedMediaType, - HTTPUpgradeRequired, HTTPUseProxy, - HTTPVariantAlsoNegotiates, - HTTPVersionNotSupported) +from .web_exceptions import ( + HTTPAccepted, + HTTPBadGateway, + HTTPBadRequest, + HTTPClientError, + HTTPConflict, + HTTPCreated, + HTTPError, + HTTPException, + HTTPExpectationFailed, + HTTPFailedDependency, + HTTPForbidden, + HTTPFound, + HTTPGatewayTimeout, + HTTPGone, + HTTPInsufficientStorage, + HTTPInternalServerError, + HTTPLengthRequired, + HTTPMethodNotAllowed, + HTTPMisdirectedRequest, + HTTPMovedPermanently, + HTTPMultipleChoices, + HTTPNetworkAuthenticationRequired, + HTTPNoContent, + HTTPNonAuthoritativeInformation, + HTTPNotAcceptable, + HTTPNotExtended, + HTTPNotFound, + HTTPNotImplemented, + HTTPNotModified, + HTTPOk, + HTTPPartialContent, + HTTPPaymentRequired, + HTTPPermanentRedirect, + HTTPPreconditionFailed, + HTTPPreconditionRequired, + HTTPProxyAuthenticationRequired, + HTTPRedirection, + HTTPRequestEntityTooLarge, + HTTPRequestHeaderFieldsTooLarge, + HTTPRequestRangeNotSatisfiable, + HTTPRequestTimeout, + HTTPRequestURITooLong, + HTTPResetContent, + HTTPSeeOther, + HTTPServerError, + HTTPServiceUnavailable, + HTTPSuccessful, + HTTPTemporaryRedirect, + HTTPTooManyRequests, + HTTPUnauthorized, + HTTPUnavailableForLegalReasons, + HTTPUnprocessableEntity, + HTTPUnsupportedMediaType, + HTTPUpgradeRequired, + HTTPUseProxy, + HTTPVariantAlsoNegotiates, + HTTPVersionNotSupported, +) from .web_fileresponse import FileResponse from .web_log import AccessLogger from .web_middlewares import middleware, normalize_path_middleware -from .web_protocol import (PayloadAccessError, RequestHandler, - RequestPayloadError) +from .web_protocol import ( + PayloadAccessError, + RequestHandler, + RequestPayloadError, +) from .web_request import BaseRequest, FileField, Request -from .web_response import (ContentCoding, Response, StreamResponse, - json_response) -from .web_routedef import (AbstractRouteDef, RouteDef, RouteTableDef, - StaticDef, delete, get, head, options, patch, post, - put, route, static, view) -from .web_runner import (AppRunner, BaseRunner, BaseSite, GracefulExit, - ServerRunner, SockSite, TCPSite, UnixSite) +from .web_response import ( + ContentCoding, + Response, + StreamResponse, + json_response, +) +from .web_routedef import ( + AbstractRouteDef, + RouteDef, + RouteTableDef, + StaticDef, + delete, + get, + head, + options, + patch, + post, + put, + route, + static, + view, +) +from .web_runner import ( + AppRunner, + BaseRunner, + BaseSite, + GracefulExit, + ServerRunner, + SockSite, + TCPSite, + UnixSite, +) from .web_server import Server -from .web_urldispatcher import (AbstractResource, AbstractRoute, - DynamicResource, PlainResource, Resource, - ResourceRoute, StaticResource, UrlDispatcher, - UrlMappingMatchInfo, View) +from .web_urldispatcher import ( + AbstractResource, + AbstractRoute, + DynamicResource, + PlainResource, + Resource, + ResourceRoute, + StaticResource, + UrlDispatcher, + UrlMappingMatchInfo, + View, +) from .web_ws import WebSocketReady, WebSocketResponse, WSMsgType - __all__ = ( # web_app 'Application', diff --git a/aiohttp/web_app.py b/aiohttp/web_app.py index 1466daca27c..afe53f5e1e4 100644 --- a/aiohttp/web_app.py +++ b/aiohttp/web_app.py @@ -2,14 +2,33 @@ import logging import warnings from functools import partial -from typing import (TYPE_CHECKING, Any, AsyncIterator, Awaitable, # noqa - Callable, Dict, Iterable, Iterator, List, Mapping, - MutableMapping, Optional, Sequence, Tuple, Type, Union, - cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + AsyncIterator, + Awaitable, + Callable, + Dict, + Iterable, + Iterator, + List, + Mapping, + MutableMapping, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from . import hdrs -from .abc import (AbstractAccessLogger, AbstractMatchInfo, AbstractRouter, - AbstractStreamWriter) +from .abc import ( + AbstractAccessLogger, + AbstractMatchInfo, + AbstractRouter, + AbstractStreamWriter, +) from .frozenlist import FrozenList from .helpers import DEBUG from .http_parser import RawRequestMessage @@ -23,10 +42,14 @@ from .web_response import StreamResponse from .web_routedef import AbstractRouteDef from .web_server import Server -from .web_urldispatcher import (AbstractResource, Domain, MaskDomain, - MatchedSubAppResource, PrefixedSubAppResource, - UrlDispatcher) - +from .web_urldispatcher import ( + AbstractResource, + Domain, + MaskDomain, + MatchedSubAppResource, + PrefixedSubAppResource, + UrlDispatcher, +) __all__ = ('Application', 'CleanupError') diff --git a/aiohttp/web_exceptions.py b/aiohttp/web_exceptions.py index d182613d002..9768c4f6407 100644 --- a/aiohttp/web_exceptions.py +++ b/aiohttp/web_exceptions.py @@ -4,7 +4,6 @@ from .typedefs import LooseHeaders, StrOrURL from .web_response import Response - __all__ = ( 'HTTPException', 'HTTPError', diff --git a/aiohttp/web_fileresponse.py b/aiohttp/web_fileresponse.py index d5b1f1f31ba..ffa610ea203 100644 --- a/aiohttp/web_fileresponse.py +++ b/aiohttp/web_fileresponse.py @@ -3,8 +3,17 @@ import os import pathlib from functools import partial -from typing import (IO, TYPE_CHECKING, Any, Awaitable, Callable, List, # noqa - Optional, Union, cast) +from typing import ( # noqa + IO, + TYPE_CHECKING, + Any, + Awaitable, + Callable, + List, + Optional, + Union, + cast, +) from . import hdrs from .abc import AbstractStreamWriter @@ -13,12 +22,15 @@ from .http_writer import StreamWriter from .log import server_logger from .typedefs import LooseHeaders -from .web_exceptions import (HTTPNotModified, HTTPOk, HTTPPartialContent, - HTTPPreconditionFailed, - HTTPRequestRangeNotSatisfiable) +from .web_exceptions import ( + HTTPNotModified, + HTTPOk, + HTTPPartialContent, + HTTPPreconditionFailed, + HTTPRequestRangeNotSatisfiable, +) from .web_response import StreamResponse - __all__ = ('FileResponse',) if TYPE_CHECKING: # pragma: no cover diff --git a/aiohttp/web_log.py b/aiohttp/web_log.py index 1742d2a9fd0..a1a4576b401 100644 --- a/aiohttp/web_log.py +++ b/aiohttp/web_log.py @@ -10,7 +10,6 @@ from .web_request import BaseRequest from .web_response import StreamResponse - KeyMethod = namedtuple('KeyMethod', 'key method') diff --git a/aiohttp/web_middlewares.py b/aiohttp/web_middlewares.py index 39bfab3dc7b..7c2e7a41458 100644 --- a/aiohttp/web_middlewares.py +++ b/aiohttp/web_middlewares.py @@ -6,7 +6,6 @@ from .web_response import StreamResponse from .web_urldispatcher import SystemRoute - __all__ = ( 'middleware', 'normalize_path_middleware', diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py index 0919f86277d..fc72a982b06 100644 --- a/aiohttp/web_protocol.py +++ b/aiohttp/web_protocol.py @@ -6,16 +6,28 @@ from contextlib import suppress from html import escape as html_escape from logging import Logger -from typing import (TYPE_CHECKING, Any, Awaitable, Callable, Optional, Type, - cast) +from typing import ( + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Optional, + Type, + cast, +) import yarl from .abc import AbstractAccessLogger, AbstractStreamWriter from .base_protocol import BaseProtocol from .helpers import CeilTimeout, current_task -from .http import (HttpProcessingError, HttpRequestParser, HttpVersion10, - RawRequestMessage, StreamWriter) +from .http import ( + HttpProcessingError, + HttpRequestParser, + HttpVersion10, + RawRequestMessage, + StreamWriter, +) from .log import access_logger, server_logger from .streams import EMPTY_PAYLOAD, StreamReader from .tcp_helpers import tcp_keepalive @@ -24,7 +36,6 @@ from .web_request import BaseRequest from .web_response import Response, StreamResponse - __all__ = ('RequestHandler', 'RequestPayloadError', 'PayloadAccessError') if TYPE_CHECKING: # pragma: no cover diff --git a/aiohttp/web_request.py b/aiohttp/web_request.py index 150138c07eb..0534f7e265f 100644 --- a/aiohttp/web_request.py +++ b/aiohttp/web_request.py @@ -10,8 +10,18 @@ from email.utils import parsedate from http.cookies import SimpleCookie from types import MappingProxyType -from typing import (TYPE_CHECKING, Any, Dict, Iterator, Mapping, # noqa - MutableMapping, Optional, Tuple, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Dict, + Iterator, + Mapping, + MutableMapping, + Optional, + Tuple, + Union, + cast, +) from urllib.parse import parse_qsl import attr @@ -24,12 +34,16 @@ from .http_parser import RawRequestMessage from .multipart import MultipartReader from .streams import EmptyStreamReader, StreamReader -from .typedefs import (DEFAULT_JSON_DECODER, JSONDecoder, LooseHeaders, - RawHeaders, StrOrURL) +from .typedefs import ( + DEFAULT_JSON_DECODER, + JSONDecoder, + LooseHeaders, + RawHeaders, + StrOrURL, +) from .web_exceptions import HTTPRequestEntityTooLarge from .web_response import StreamResponse - __all__ = ('BaseRequest', 'FileField', 'Request') diff --git a/aiohttp/web_response.py b/aiohttp/web_response.py index 7ff52c6cd8d..ba90d937243 100644 --- a/aiohttp/web_response.py +++ b/aiohttp/web_response.py @@ -10,8 +10,18 @@ from concurrent.futures import Executor from email.utils import parsedate from http.cookies import SimpleCookie -from typing import (TYPE_CHECKING, Any, Dict, Iterator, Mapping, # noqa - MutableMapping, Optional, Tuple, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Dict, + Iterator, + Mapping, + MutableMapping, + Optional, + Tuple, + Union, + cast, +) from multidict import CIMultiDict, istr @@ -22,7 +32,6 @@ from .payload import Payload from .typedefs import JSONEncoder, LooseHeaders - __all__ = ('ContentCoding', 'StreamResponse', 'Response', 'json_response') diff --git a/aiohttp/web_routedef.py b/aiohttp/web_routedef.py index eadf464d43e..ffa8f1b6f55 100644 --- a/aiohttp/web_routedef.py +++ b/aiohttp/web_routedef.py @@ -1,7 +1,18 @@ import abc import os # noqa -from typing import (TYPE_CHECKING, Any, Awaitable, Callable, Dict, Iterator, - List, Optional, Sequence, Union, overload) +from typing import ( + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Dict, + Iterator, + List, + Optional, + Sequence, + Union, + overload, +) import attr @@ -9,7 +20,6 @@ from .abc import AbstractView from .typedefs import PathLike - if TYPE_CHECKING: # pragma: no cover from .web_urldispatcher import UrlDispatcher from .web_request import Request diff --git a/aiohttp/web_runner.py b/aiohttp/web_runner.py index 6b8cf0a6538..391adb51c74 100644 --- a/aiohttp/web_runner.py +++ b/aiohttp/web_runner.py @@ -9,7 +9,6 @@ from .web_app import Application from .web_server import Server - try: from ssl import SSLContext except ImportError: diff --git a/aiohttp/web_server.py b/aiohttp/web_server.py index 48c0069b75a..ad746ed0b4b 100644 --- a/aiohttp/web_server.py +++ b/aiohttp/web_server.py @@ -9,7 +9,6 @@ from .web_protocol import RequestHandler, _RequestFactory, _RequestHandler from .web_request import BaseRequest - __all__ = ('Server',) diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py index dc7005d32d4..182c98e29e7 100644 --- a/aiohttp/web_urldispatcher.py +++ b/aiohttp/web_urldispatcher.py @@ -11,9 +11,25 @@ from functools import wraps from pathlib import Path from types import MappingProxyType -from typing import (TYPE_CHECKING, Any, Awaitable, Callable, Container, # noqa - Dict, Generator, Iterable, Iterator, List, Mapping, - Optional, Set, Sized, Tuple, Union, cast) +from typing import ( # noqa + TYPE_CHECKING, + Any, + Awaitable, + Callable, + Container, + Dict, + Generator, + Iterable, + Iterator, + List, + Mapping, + Optional, + Set, + Sized, + Tuple, + Union, + cast, +) from yarl import URL @@ -22,14 +38,18 @@ from .helpers import DEBUG from .http import HttpVersion11 from .typedefs import PathLike -from .web_exceptions import (HTTPException, HTTPExpectationFailed, - HTTPForbidden, HTTPMethodNotAllowed, HTTPNotFound) +from .web_exceptions import ( + HTTPException, + HTTPExpectationFailed, + HTTPForbidden, + HTTPMethodNotAllowed, + HTTPNotFound, +) from .web_fileresponse import FileResponse from .web_request import Request from .web_response import Response, StreamResponse from .web_routedef import AbstractRouteDef - __all__ = ('UrlDispatcher', 'UrlMappingMatchInfo', 'AbstractResource', 'Resource', 'PlainResource', 'DynamicResource', 'AbstractRoute', 'ResourceRoute', diff --git a/aiohttp/web_ws.py b/aiohttp/web_ws.py index 72dae0437eb..faa05ab3e5a 100644 --- a/aiohttp/web_ws.py +++ b/aiohttp/web_ws.py @@ -12,9 +12,18 @@ from . import hdrs from .abc import AbstractStreamWriter from .helpers import call_later, set_result -from .http import (WS_CLOSED_MESSAGE, WS_CLOSING_MESSAGE, WS_KEY, - WebSocketError, WebSocketReader, WebSocketWriter, WSMessage, - WSMsgType, ws_ext_gen, ws_ext_parse) +from .http import ( + WS_CLOSED_MESSAGE, + WS_CLOSING_MESSAGE, + WS_KEY, + WebSocketError, + WebSocketReader, + WebSocketWriter, + WSMessage, + WSMsgType, + ws_ext_gen, + ws_ext_parse, +) from .log import ws_logger from .streams import EofStream, FlowControlDataQueue from .typedefs import JSONDecoder, JSONEncoder @@ -22,7 +31,6 @@ from .web_request import BaseRequest from .web_response import StreamResponse - __all__ = ('WebSocketResponse', 'WebSocketReady', 'WSMsgType',) THRESHOLD_CONNLOST_ACCESS = 5 diff --git a/aiohttp/worker.py b/aiohttp/worker.py index c2ba6d706f1..4681b47eadb 100644 --- a/aiohttp/worker.py +++ b/aiohttp/worker.py @@ -16,7 +16,6 @@ from .helpers import set_result from .web_log import AccessLogger - try: import ssl SSLContext = ssl.SSLContext # noqa diff --git a/examples/legacy/srv.py b/examples/legacy/srv.py index 64d9f0d68a9..0350e215fc4 100755 --- a/examples/legacy/srv.py +++ b/examples/legacy/srv.py @@ -10,7 +10,6 @@ import aiohttp import aiohttp.server - try: import ssl except ImportError: # pragma: no cover diff --git a/examples/legacy/tcp_protocol_parser.py b/examples/legacy/tcp_protocol_parser.py index ea03820d190..a4222854507 100755 --- a/examples/legacy/tcp_protocol_parser.py +++ b/examples/legacy/tcp_protocol_parser.py @@ -6,7 +6,6 @@ import aiohttp - try: import signal except ImportError: diff --git a/examples/static_files.py b/examples/static_files.py index 4ffd1ab60e1..426242a8514 100755 --- a/examples/static_files.py +++ b/examples/static_files.py @@ -2,7 +2,6 @@ from aiohttp import web - app = web.Application() app.router.add_static('/', pathlib.Path(__file__).parent, show_index=True) diff --git a/examples/web_cookies.py b/examples/web_cookies.py index 984ce6e5388..1a8c985737c 100755 --- a/examples/web_cookies.py +++ b/examples/web_cookies.py @@ -6,7 +6,6 @@ from aiohttp import web - tmpl = '''\ diff --git a/examples/web_srv_route_deco.py b/examples/web_srv_route_deco.py index 394f1f6e113..1f9af262841 100644 --- a/examples/web_srv_route_deco.py +++ b/examples/web_srv_route_deco.py @@ -7,7 +7,6 @@ from aiohttp import web - routes = web.RouteTableDef() diff --git a/examples/web_ws.py b/examples/web_ws.py index c85d0429d84..b981fc96886 100755 --- a/examples/web_ws.py +++ b/examples/web_ws.py @@ -6,7 +6,6 @@ from aiohttp import web - WS_FILE = os.path.join(os.path.dirname(__file__), 'websocket.html') diff --git a/setup.cfg b/setup.cfg index 58f711eb0db..f7b55b1c23a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,9 +15,13 @@ ignore = N801,N802,N803,E226,W504,E252 max-line-length=79 [isort] +multi_line_output=3 +include_trailing_comma=True +force_grid_wrap=0 +use_parentheses=True + known_third_party=jinja2 known_first_party=aiohttp,aiohttp_jinja2,aiopg -lines_after_imports=2 [report] exclude_lines = diff --git a/tests/conftest.py b/tests/conftest.py index 763a254ae05..3485f77d917 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,6 @@ import pytest - pytest_plugins = ['aiohttp.pytest_plugin', 'pytester'] diff --git a/tests/test_client_fingerprint.py b/tests/test_client_fingerprint.py index aa1b4c7e98d..6253a834ea4 100644 --- a/tests/test_client_fingerprint.py +++ b/tests/test_client_fingerprint.py @@ -6,7 +6,6 @@ import aiohttp from aiohttp.client_reqrep import _merge_ssl_params - ssl = pytest.importorskip('ssl') diff --git a/tests/test_client_request.py b/tests/test_client_request.py index 3c674ea4dab..bffe7acb19f 100644 --- a/tests/test_client_request.py +++ b/tests/test_client_request.py @@ -16,8 +16,12 @@ import aiohttp from aiohttp import BaseConnector, hdrs, payload -from aiohttp.client_reqrep import (ClientRequest, ClientResponse, Fingerprint, - _merge_ssl_params) +from aiohttp.client_reqrep import ( + ClientRequest, + ClientResponse, + Fingerprint, + _merge_ssl_params, +) from aiohttp.test_utils import make_mocked_coro diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 130b094b77c..6a712cadd68 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -12,7 +12,6 @@ from aiohttp import helpers - IS_PYPY = platform.python_implementation() == 'PyPy' diff --git a/tests/test_http_parser.py b/tests/test_http_parser.py index f5c1a88cc85..609c918af63 100644 --- a/tests/test_http_parser.py +++ b/tests/test_http_parser.py @@ -10,9 +10,12 @@ import aiohttp from aiohttp import http_exceptions, streams -from aiohttp.http_parser import (DeflateBuffer, HttpPayloadParser, - HttpRequestParserPy, HttpResponseParserPy) - +from aiohttp.http_parser import ( + DeflateBuffer, + HttpPayloadParser, + HttpRequestParserPy, + HttpResponseParserPy, +) try: import brotli diff --git a/tests/test_multipart.py b/tests/test_multipart.py index d054a64f495..a2f231441bf 100644 --- a/tests/test_multipart.py +++ b/tests/test_multipart.py @@ -8,15 +8,18 @@ import aiohttp from aiohttp import payload -from aiohttp.hdrs import (CONTENT_DISPOSITION, CONTENT_ENCODING, - CONTENT_TRANSFER_ENCODING, CONTENT_TYPE) +from aiohttp.hdrs import ( + CONTENT_DISPOSITION, + CONTENT_ENCODING, + CONTENT_TRANSFER_ENCODING, + CONTENT_TYPE, +) from aiohttp.helpers import parse_mimetype from aiohttp.multipart import MultipartResponseWrapper from aiohttp.streams import DEFAULT_LIMIT as stream_reader_default_limit from aiohttp.streams import StreamReader from aiohttp.test_utils import make_mocked_coro - BOUNDARY = b'--:' diff --git a/tests/test_pytest_plugin.py b/tests/test_pytest_plugin.py index 8f82eb84420..4c06844f4aa 100644 --- a/tests/test_pytest_plugin.py +++ b/tests/test_pytest_plugin.py @@ -4,7 +4,6 @@ import pytest - pytest_plugins = 'pytester' CONFTEST = ''' diff --git a/tests/test_resolver.py b/tests/test_resolver.py index aa00785ecff..140899823c0 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -7,7 +7,6 @@ from aiohttp.resolver import AsyncResolver, DefaultResolver, ThreadedResolver - try: import aiodns gethostbyname = hasattr(aiodns.DNSResolver, 'gethostbyname') diff --git a/tests/test_run_app.py b/tests/test_run_app.py index 4d8fa12a352..99ee1a045ef 100644 --- a/tests/test_run_app.py +++ b/tests/test_run_app.py @@ -17,7 +17,6 @@ from aiohttp.helpers import PY_37 from aiohttp.test_utils import make_mocked_coro - # Test for features of OS' socket support _has_unix_domain_socks = hasattr(socket, 'AF_UNIX') if _has_unix_domain_socks: diff --git a/tests/test_streams.py b/tests/test_streams.py index 0f0a9fa19e3..601efca083a 100644 --- a/tests/test_streams.py +++ b/tests/test_streams.py @@ -8,7 +8,6 @@ from aiohttp import streams - DATA = b'line1\nline2\nline3\n' diff --git a/tests/test_tcp_helpers.py b/tests/test_tcp_helpers.py index f23da27f85e..dbb8c0cf6c4 100644 --- a/tests/test_tcp_helpers.py +++ b/tests/test_tcp_helpers.py @@ -5,7 +5,6 @@ from aiohttp.tcp_helpers import CORK, tcp_cork, tcp_nodelay - has_ipv6 = socket.has_ipv6 if has_ipv6: # The socket.has_ipv6 flag may be True if Python was built with IPv6 diff --git a/tests/test_test_utils.py b/tests/test_test_utils.py index bf899dc6feb..70f72ed45ad 100644 --- a/tests/test_test_utils.py +++ b/tests/test_test_utils.py @@ -11,9 +11,11 @@ from aiohttp.test_utils import RawTestServer as _RawTestServer from aiohttp.test_utils import TestClient as _TestClient from aiohttp.test_utils import TestServer as _TestServer -from aiohttp.test_utils import (loop_context, make_mocked_request, - unittest_run_loop) - +from aiohttp.test_utils import ( + loop_context, + make_mocked_request, + unittest_run_loop, +) _hello_world_str = "Hello, world" _hello_world_bytes = _hello_world_str.encode('utf-8') diff --git a/tests/test_tracing.py b/tests/test_tracing.py index 68f4e795e5a..71488afd108 100644 --- a/tests/test_tracing.py +++ b/tests/test_tracing.py @@ -4,21 +4,25 @@ import pytest -from aiohttp.tracing import (Trace, TraceConfig, - TraceConnectionCreateEndParams, - TraceConnectionCreateStartParams, - TraceConnectionQueuedEndParams, - TraceConnectionQueuedStartParams, - TraceConnectionReuseconnParams, - TraceDnsCacheHitParams, TraceDnsCacheMissParams, - TraceDnsResolveHostEndParams, - TraceDnsResolveHostStartParams, - TraceRequestChunkSentParams, - TraceRequestEndParams, - TraceRequestExceptionParams, - TraceRequestRedirectParams, - TraceRequestStartParams, - TraceResponseChunkReceivedParams) +from aiohttp.tracing import ( + Trace, + TraceConfig, + TraceConnectionCreateEndParams, + TraceConnectionCreateStartParams, + TraceConnectionQueuedEndParams, + TraceConnectionQueuedStartParams, + TraceConnectionReuseconnParams, + TraceDnsCacheHitParams, + TraceDnsCacheMissParams, + TraceDnsResolveHostEndParams, + TraceDnsResolveHostStartParams, + TraceRequestChunkSentParams, + TraceRequestEndParams, + TraceRequestExceptionParams, + TraceRequestRedirectParams, + TraceRequestStartParams, + TraceResponseChunkReceivedParams, +) class TestTraceConfig: diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py index 670d8da7dfa..632fd275d3c 100644 --- a/tests/test_urldispatch.py +++ b/tests/test_urldispatch.py @@ -11,11 +11,19 @@ from aiohttp import hdrs, web from aiohttp.test_utils import make_mocked_request from aiohttp.web import HTTPMethodNotAllowed, HTTPNotFound, Response -from aiohttp.web_urldispatcher import (PATH_SEP, AbstractResource, Domain, - DynamicResource, MaskDomain, - PlainResource, ResourceRoute, - StaticResource, SystemRoute, View, - _default_expect_handler) +from aiohttp.web_urldispatcher import ( + PATH_SEP, + AbstractResource, + Domain, + DynamicResource, + MaskDomain, + PlainResource, + ResourceRoute, + StaticResource, + SystemRoute, + View, + _default_expect_handler, +) def make_handler(): diff --git a/tests/test_web_functional.py b/tests/test_web_functional.py index 642ea2f59cc..19c89132cdb 100644 --- a/tests/test_web_functional.py +++ b/tests/test_web_functional.py @@ -12,9 +12,14 @@ from yarl import URL import aiohttp -from aiohttp import (FormData, HttpVersion10, HttpVersion11, TraceConfig, - multipart, web) - +from aiohttp import ( + FormData, + HttpVersion10, + HttpVersion11, + TraceConfig, + multipart, + web, +) try: import ssl diff --git a/tests/test_web_log.py b/tests/test_web_log.py index 8261eb84311..a76fedba351 100644 --- a/tests/test_web_log.py +++ b/tests/test_web_log.py @@ -7,7 +7,6 @@ from aiohttp.abc import AbstractAccessLogger from aiohttp.web_log import AccessLogger - IS_PYPY = platform.python_implementation() == 'PyPy' diff --git a/tests/test_web_sendfile_functional.py b/tests/test_web_sendfile_functional.py index 3d71de99129..792c47566bd 100644 --- a/tests/test_web_sendfile_functional.py +++ b/tests/test_web_sendfile_functional.py @@ -9,7 +9,6 @@ import aiohttp from aiohttp import web - try: import ssl except ImportError: diff --git a/tests/test_websocket_parser.py b/tests/test_websocket_parser.py index 6dcd560862c..340b048e073 100644 --- a/tests/test_websocket_parser.py +++ b/tests/test_websocket_parser.py @@ -8,9 +8,15 @@ import aiohttp from aiohttp import http_websocket from aiohttp.http import WebSocketError, WSCloseCode, WSMessage, WSMsgType -from aiohttp.http_websocket import (_WS_DEFLATE_TRAILING, PACK_CLOSE_CODE, - PACK_LEN1, PACK_LEN2, PACK_LEN3, - WebSocketReader, _websocket_mask) +from aiohttp.http_websocket import ( + _WS_DEFLATE_TRAILING, + PACK_CLOSE_CODE, + PACK_LEN1, + PACK_LEN2, + PACK_LEN3, + WebSocketReader, + _websocket_mask, +) def build_frame(message, opcode, use_mask=False, noheader=False, is_fin=True, diff --git a/tests/test_worker.py b/tests/test_worker.py index f665243893b..d78662e0074 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -11,7 +11,6 @@ from aiohttp import web from aiohttp.test_utils import make_mocked_coro - base_worker = pytest.importorskip('aiohttp.worker') From 6246c40273808a03b63672e4a25dd53e96fd2b3c Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 28 Dec 2018 17:34:40 +0200 Subject: [PATCH 6/6] Convert client.py --- aiohttp/client.py | 74 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/aiohttp/client.py b/aiohttp/client.py index c0a1437bab2..ef31df8f013 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -29,41 +29,38 @@ from multidict import CIMultiDict, MultiDict, MultiDictProxy, istr from yarl import URL -from . import client_exceptions, client_reqrep -from . import connector as connector_mod from . import hdrs, http, payload from .abc import AbstractCookieJar -from .client_exceptions import ClientConnectionError # noqa -from .client_exceptions import ClientConnectorCertificateError # noqa -from .client_exceptions import ClientConnectorError # noqa -from .client_exceptions import ClientConnectorSSLError # noqa -from .client_exceptions import ClientHttpProxyError # noqa -from .client_exceptions import ClientPayloadError # noqa -from .client_exceptions import ClientProxyConnectionError # noqa -from .client_exceptions import ClientResponseError # noqa -from .client_exceptions import ClientSSLError # noqa -from .client_exceptions import ContentTypeError # noqa -from .client_exceptions import ServerConnectionError # noqa -from .client_exceptions import ServerDisconnectedError # noqa -from .client_exceptions import ServerFingerprintMismatch # noqa from .client_exceptions import ( + ClientConnectionError, + ClientConnectorCertificateError, + ClientConnectorError, + ClientConnectorSSLError, ClientError, + ClientHttpProxyError, ClientOSError, + ClientPayloadError, + ClientProxyConnectionError, + ClientResponseError, + ClientSSLError, + ContentTypeError, InvalidURL, + ServerConnectionError, + ServerDisconnectedError, + ServerFingerprintMismatch, ServerTimeoutError, TooManyRedirects, WSServerHandshakeError, ) -from .client_reqrep import RequestInfo # noqa from .client_reqrep import ( ClientRequest, ClientResponse, Fingerprint, + RequestInfo, _merge_ssl_params, ) from .client_ws import ClientWebSocketResponse -from .connector import UnixConnector # noqa -from .connector import BaseConnector, TCPConnector +from .connector import BaseConnector, TCPConnector, UnixConnector from .cookiejar import CookieJar from .helpers import ( PY_36, @@ -86,11 +83,42 @@ from .tracing import Trace, TraceConfig from .typedefs import JSONEncoder, LooseCookies, LooseHeaders, StrOrURL -__all__ = (client_exceptions.__all__ + # noqa - client_reqrep.__all__ + # noqa - connector_mod.__all__ + # noqa - ('ClientSession', 'ClientTimeout', - 'ClientWebSocketResponse', 'request')) +__all__ = ( + # client_exceptions + 'ClientConnectionError', + 'ClientConnectorCertificateError', + 'ClientConnectorError', + 'ClientConnectorSSLError', + 'ClientError', + 'ClientHttpProxyError', + 'ClientOSError', + 'ClientPayloadError', + 'ClientProxyConnectionError', + 'ClientResponseError', + 'ClientSSLError', + 'ContentTypeError', + 'InvalidURL', + 'ServerConnectionError', + 'ServerDisconnectedError', + 'ServerFingerprintMismatch', + 'ServerTimeoutError', + 'TooManyRedirects', + 'WSServerHandshakeError', + # client_reqrep + 'ClientRequest', + 'ClientResponse', + 'Fingerprint', + 'RequestInfo', + # connector + 'BaseConnector', + 'TCPConnector', + 'UnixConnector', + # client_ws + 'ClientWebSocketResponse', + # client + 'ClientSession', + 'ClientTimeout', + 'request') try: