mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Merge Python 2 and 3 wsgiref (#2106)
* Merge Python 2 and 3 wsgiref * Move wsigref to 2and3
This commit is contained in:
committed by
Jelle Zijlstra
parent
3f196bde44
commit
09008599ce
@@ -1,34 +0,0 @@
|
||||
# Type declaration for a WSGI Function in Python 3
|
||||
#
|
||||
# wsgiref/types.py doesn't exist and neither does WSGIApplication, it's a type
|
||||
# provided for type checking purposes.
|
||||
#
|
||||
# This means you cannot simply import wsgiref.types in your code. Instead,
|
||||
# use the `TYPE_CHECKING` flag from the typing module:
|
||||
#
|
||||
# from typing import TYPE_CHECKING
|
||||
#
|
||||
# if TYPE_CHECKING:
|
||||
# from wsgiref.types import WSGIApplication
|
||||
#
|
||||
# This import is now only taken into account by the type checker. Consequently,
|
||||
# you need to use 'WSGIApplication' and not simply WSGIApplication when type
|
||||
# hinting your code. Otherwise Python will raise NameErrors.
|
||||
|
||||
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Type, Union, Any
|
||||
from types import TracebackType
|
||||
|
||||
_exc_info = Tuple[Optional[Type[BaseException]],
|
||||
Optional[BaseException],
|
||||
Optional[TracebackType]]
|
||||
WSGIEnvironment = Dict[str, Any]
|
||||
WSGIApplication = Callable[
|
||||
[
|
||||
WSGIEnvironment,
|
||||
Union[
|
||||
Callable[[str, List[Tuple[str, str]]], Callable[[Union[bytes, str]], None]],
|
||||
Callable[[str, List[Tuple[str, str]], _exc_info], Callable[[Union[bytes, str]], None]]
|
||||
]
|
||||
],
|
||||
Iterable[Union[bytes, str]]
|
||||
]
|
||||
@@ -1,43 +0,0 @@
|
||||
from typing import Any
|
||||
|
||||
class WSGIWarning(Warning): ...
|
||||
|
||||
def validator(application): ...
|
||||
|
||||
class InputWrapper:
|
||||
input = ... # type: Any
|
||||
def __init__(self, wsgi_input): ...
|
||||
def read(self, *args): ...
|
||||
def readline(self, *args): ...
|
||||
def readlines(self, *args): ...
|
||||
def __iter__(self): ...
|
||||
def close(self): ...
|
||||
|
||||
class ErrorWrapper:
|
||||
errors = ... # type: Any
|
||||
def __init__(self, wsgi_errors): ...
|
||||
def write(self, s): ...
|
||||
def flush(self): ...
|
||||
def writelines(self, seq): ...
|
||||
def close(self): ...
|
||||
|
||||
class WriteWrapper:
|
||||
writer = ... # type: Any
|
||||
def __init__(self, wsgi_writer): ...
|
||||
def __call__(self, s): ...
|
||||
|
||||
class PartialIteratorWrapper:
|
||||
iterator = ... # type: Any
|
||||
def __init__(self, wsgi_iterator): ...
|
||||
def __iter__(self): ...
|
||||
|
||||
class IteratorWrapper:
|
||||
original_iterator = ... # type: Any
|
||||
iterator = ... # type: Any
|
||||
closed = ... # type: Any
|
||||
check_start_response = ... # type: Any
|
||||
def __init__(self, wsgi_iterator, check_start_response): ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
def close(self): ...
|
||||
def __del__(self): ...
|
||||
Reference in New Issue
Block a user