Move wsgiref.types to _typeshed.wsgi (#4175)

Re-export the types from wsgiref.types for now to avoid breaking
existing code. wsgiref.types should be removed eventually.

Also, reduce the boilerplate description in _typeshed/wsgi.pyi as it
mirrors the description in _typeshed/__init__.pyi.
This commit is contained in:
Sebastian Rittau
2020-06-05 00:38:45 +02:00
committed by GitHub
parent 5b66868156
commit 1f82564ee2
17 changed files with 49 additions and 58 deletions

View File

@@ -1,5 +1,5 @@
from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text
from wsgiref.types import WSGIApplication, WSGIEnvironment, StartResponse
from _typeshed.wsgi import WSGIApplication, WSGIEnvironment, StartResponse
from ..middleware.proxy_fix import ProxyFix as ProxyFix

View File

@@ -1,7 +1,7 @@
import datetime
from typing import Any, Dict, Tuple, List, Text, NoReturn, Optional, Protocol, Type, Union, Iterable
from wsgiref.types import WSGIEnvironment, StartResponse
from _typeshed.wsgi import WSGIEnvironment, StartResponse
from werkzeug.wrappers import Response
class _EnvironContainer(Protocol):

View File

@@ -1,5 +1,5 @@
from typing import Any, Optional, Text, Tuple, Callable, Iterable, TypeVar, NoReturn, Protocol, IO, Generator, Dict, Mapping, Union
from wsgiref.types import WSGIEnvironment
from _typeshed.wsgi import WSGIEnvironment
from .datastructures import Headers

View File

@@ -4,7 +4,7 @@ from typing import (
Dict, Text, Union, Tuple, Any, Optional, Mapping, Iterable, Callable, List, Type,
TypeVar, Protocol, overload, SupportsInt,
)
from wsgiref.types import WSGIEnvironment
from _typeshed.wsgi import WSGIEnvironment
from .datastructures import (
Headers, Accept, RequestCacheControl, HeaderSet, Authorization, WWWAuthenticate,

View File

@@ -1,5 +1,5 @@
from typing import Any, Iterable, Mapping, Optional, Text
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
class DispatcherMiddleware(object):
app: WSGIApplication

View File

@@ -1,5 +1,5 @@
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
_Opts = Mapping[Text, Any]
_MutableOpts = MutableMapping[Text, Any]

View File

@@ -1,6 +1,6 @@
import sys
from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from ..datastructures import Headers

View File

@@ -1,5 +1,5 @@
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
class ProfilerMiddleware(object):
def __init__(

View File

@@ -1,5 +1,5 @@
from typing import Iterable, Optional
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
class ProxyFix(object):
app: WSGIApplication

View File

@@ -1,6 +1,6 @@
import datetime
from typing import Callable, IO, Iterable, List, Mapping, Optional, Text, Tuple, Union
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
_V = Union[Tuple[Text, Text], Text]

View File

@@ -1,5 +1,5 @@
import sys
from wsgiref.types import WSGIEnvironment
from _typeshed.wsgi import WSGIEnvironment
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
from typing_extensions import Literal

View File

@@ -3,7 +3,7 @@ from datetime import datetime
from typing import (
Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, overload
)
from wsgiref.types import WSGIEnvironment, InputStream
from _typeshed.wsgi import WSGIEnvironment, InputStream
from .datastructures import (
Authorization, CombinedMultiDict, EnvironHeaders, Headers, ImmutableMultiDict,

View File

@@ -1,5 +1,5 @@
from typing import Any, Optional, Protocol, Iterable, Text
from wsgiref.types import WSGIEnvironment, InputStream
from _typeshed.wsgi import WSGIEnvironment, InputStream
from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware
from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware