mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-16 03:24:54 +08:00
committed by
Jelle Zijlstra
parent
8794e40d41
commit
0177dedc42
@@ -138,32 +138,33 @@ else:
|
||||
|
||||
# This is an API stub only for the class below, not a class itself.
|
||||
# urllib.request uses it for a parameter.
|
||||
class HTTPConnectionProtocol(Protocol):
|
||||
class _HTTPConnectionProtocol(Protocol):
|
||||
if sys.version_info >= (3, 7):
|
||||
def __call__(self, host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
blocksize: int = ...): ...
|
||||
else:
|
||||
def __call__(self, host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...): ...
|
||||
|
||||
class HTTPConnection:
|
||||
host: str = ...
|
||||
port: int = ...
|
||||
timeout: float
|
||||
host: str
|
||||
port: int
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
@@ -196,7 +197,7 @@ class HTTPSConnection(HTTPConnection):
|
||||
host: str, port: Optional[int] = ...,
|
||||
key_file: Optional[str] = ...,
|
||||
cert_file: Optional[str] = ...,
|
||||
timeout: int = ...,
|
||||
timeout: float = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...,
|
||||
*, context: Optional[ssl.SSLContext] = ...,
|
||||
check_hostname: Optional[bool] = ...) -> None: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import (
|
||||
Any, Callable, ClassVar, Dict, List, IO, Mapping, Optional, Sequence, Tuple,
|
||||
TypeVar, Union, overload, NoReturn,
|
||||
)
|
||||
from http.client import HTTPResponse, HTTPMessage, HTTPConnectionProtocol
|
||||
from http.client import HTTPResponse, HTTPMessage, _HTTPConnectionProtocol
|
||||
from http.cookiejar import CookieJar
|
||||
from email.message import Message
|
||||
from urllib.response import addinfourl
|
||||
@@ -162,7 +162,7 @@ class AbstractHTTPHandler(BaseHandler): # undocumented
|
||||
def set_http_debuglevel(self, level: int) -> None: ...
|
||||
def do_request_(self, request: Request) -> Request: ...
|
||||
def do_open(self,
|
||||
http_class: HTTPConnectionProtocol,
|
||||
http_class: _HTTPConnectionProtocol,
|
||||
req: Request,
|
||||
**http_conn_args: Any) -> HTTPResponse: ...
|
||||
|
||||
|
||||
59
third_party/2and3/werkzeug/contrib/fixers.pyi
vendored
59
third_party/2and3/werkzeug/contrib/fixers.pyi
vendored
@@ -1,38 +1,35 @@
|
||||
from typing import Any, Sequence, Optional, Iterable
|
||||
from typing import Any, Iterable, List, Mapping, Optional, Sequence, Set, Text
|
||||
from wsgiref.types import WSGIApplication, WSGIEnvironment, StartResponse
|
||||
|
||||
class CGIRootFix:
|
||||
app: Any
|
||||
app_root: Any
|
||||
def __init__(self, app, app_root: str = ...): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
from ..middleware.proxy_fix import ProxyFix as ProxyFix
|
||||
|
||||
LighttpdCGIRootFix: Any
|
||||
|
||||
class PathInfoFromRequestUriFix:
|
||||
app: Any
|
||||
def __init__(self, app): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
|
||||
class ProxyFix(object):
|
||||
class CGIRootFix(object):
|
||||
app: WSGIApplication
|
||||
num_proxies: int
|
||||
def __init__(self, app: WSGIApplication, num_proxies: int = ...) -> None: ...
|
||||
def get_remote_addr(self, forwarded_for: Sequence[str]) -> Optional[str]: ...
|
||||
app_root: Text
|
||||
def __init__(self, app: WSGIApplication, app_root: Text = ...) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
|
||||
class HeaderRewriterFix:
|
||||
app: Any
|
||||
remove_headers: Any
|
||||
add_headers: Any
|
||||
def __init__(self, app, remove_headers: Optional[Any] = ..., add_headers: Optional[Any] = ...): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
class LighttpdCGIRootFix(CGIRootFix): ...
|
||||
|
||||
class InternetExplorerFix:
|
||||
app: Any
|
||||
fix_vary: Any
|
||||
fix_attach: Any
|
||||
def __init__(self, app, fix_vary: bool = ..., fix_attach: bool = ...): ...
|
||||
def fix_headers(self, environ, headers, status: Optional[Any] = ...): ...
|
||||
def run_fixed(self, environ, start_response): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
class PathInfoFromRequestUriFix(object):
|
||||
app: WSGIApplication
|
||||
def __init__(self, app: WSGIApplication) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
|
||||
class HeaderRewriterFix(object):
|
||||
app: WSGIApplication
|
||||
remove_headers: Set[Text]
|
||||
add_headers: List[Text]
|
||||
def __init__(
|
||||
self, app: WSGIApplication, remove_headers: Optional[Iterable[Text]] = ..., add_headers: Optional[Iterable[Text]] = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
|
||||
class InternetExplorerFix(object):
|
||||
app: WSGIApplication
|
||||
fix_vary: bool
|
||||
fix_attach: bool
|
||||
def __init__(self, app: WSGIApplication, fix_vary: bool = ..., fix_attach: bool = ...) -> None: ...
|
||||
def fix_headers(self, environ: WSGIEnvironment, headers: Mapping[str, str], status: Optional[Any] = ...) -> None: ...
|
||||
def run_fixed(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
|
||||
44
third_party/2and3/werkzeug/contrib/lint.pyi
vendored
44
third_party/2and3/werkzeug/contrib/lint.pyi
vendored
@@ -1,43 +1 @@
|
||||
from typing import Any
|
||||
|
||||
class WSGIWarning(Warning): ...
|
||||
class HTTPWarning(Warning): ...
|
||||
|
||||
def check_string(context, obj, stacklevel: int = ...): ...
|
||||
|
||||
class InputStream:
|
||||
def __init__(self, stream): ...
|
||||
def read(self, *args): ...
|
||||
def readline(self, *args): ...
|
||||
def __iter__(self): ...
|
||||
def close(self): ...
|
||||
|
||||
class ErrorStream:
|
||||
def __init__(self, stream): ...
|
||||
def write(self, s): ...
|
||||
def flush(self): ...
|
||||
def writelines(self, seq): ...
|
||||
def close(self): ...
|
||||
|
||||
class GuardedWrite:
|
||||
def __init__(self, write, chunks): ...
|
||||
def __call__(self, s): ...
|
||||
|
||||
class GuardedIterator:
|
||||
closed: Any
|
||||
headers_set: Any
|
||||
chunks: Any
|
||||
def __init__(self, iterator, headers_set, chunks): ...
|
||||
def __iter__(self): ...
|
||||
def next(self): ...
|
||||
def close(self): ...
|
||||
def __del__(self): ...
|
||||
|
||||
class LintMiddleware:
|
||||
app: Any
|
||||
def __init__(self, app): ...
|
||||
def check_environ(self, environ): ...
|
||||
def check_start_response(self, status, headers, exc_info): ...
|
||||
def check_headers(self, headers): ...
|
||||
def check_iterator(self, app_iter): ...
|
||||
def __call__(self, *args, **kwargs): ...
|
||||
from ..middleware.lint import *
|
||||
|
||||
21
third_party/2and3/werkzeug/contrib/profiler.pyi
vendored
21
third_party/2and3/werkzeug/contrib/profiler.pyi
vendored
@@ -1,15 +1,14 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, AnyStr, Generic, Optional, Protocol, Tuple, TypeVar
|
||||
|
||||
available: Any
|
||||
from ..middleware.profiler import *
|
||||
|
||||
class MergeStream:
|
||||
streams: Any
|
||||
def __init__(self, *streams): ...
|
||||
def write(self, data): ...
|
||||
_T = TypeVar("_T")
|
||||
_T_contra = TypeVar("_T_contra", contravariant=True)
|
||||
|
||||
class ProfilerMiddleware:
|
||||
def __init__(self, app, stream: Optional[Any] = ..., sort_by=..., restrictions=..., profile_dir: Optional[Any] = ...): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
class _Writable(Protocol[_T_contra]):
|
||||
def write(self, __s: _T_contra) -> Any: ...
|
||||
|
||||
def make_action(app_factory, hostname: str = ..., port: int = ..., threaded: bool = ..., processes: int = ...,
|
||||
stream: Optional[Any] = ..., sort_by=..., restrictions=...): ...
|
||||
class MergeStream(Generic[_T]):
|
||||
streams: Tuple[_Writable[_T], ...]
|
||||
def __init__(self, *streams: _Writable[_T]) -> None: ...
|
||||
def write(self, data: _T) -> None: ...
|
||||
|
||||
0
third_party/2and3/werkzeug/middleware/__init__.pyi
vendored
Normal file
0
third_party/2and3/werkzeug/middleware/__init__.pyi
vendored
Normal file
8
third_party/2and3/werkzeug/middleware/dispatcher.pyi
vendored
Normal file
8
third_party/2and3/werkzeug/middleware/dispatcher.pyi
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import Any, Iterable, Mapping, Optional, Text
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
class DispatcherMiddleware(object):
|
||||
app: WSGIApplication
|
||||
mounts: Mapping[Text, WSGIApplication]
|
||||
def __init__(self, app: WSGIApplication, mounts: Optional[Mapping[Text, WSGIApplication]] = ...) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
18
third_party/2and3/werkzeug/middleware/http_proxy.pyi
vendored
Normal file
18
third_party/2and3/werkzeug/middleware/http_proxy.pyi
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Text
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
_Opts = Mapping[Text, Any]
|
||||
_MutableOpts = MutableMapping[Text, Any]
|
||||
|
||||
class ProxyMiddleware(object):
|
||||
app: WSGIApplication
|
||||
targets: Dict[Text, _MutableOpts]
|
||||
def __init__(
|
||||
self,
|
||||
app: WSGIApplication,
|
||||
targets: Mapping[Text, _MutableOpts],
|
||||
chunk_size: int = ...,
|
||||
timeout: int = ...,
|
||||
) -> None: ...
|
||||
def proxy_to(self, opts: _Opts, path: Text, prefix: Text) -> WSGIApplication: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
|
||||
67
third_party/2and3/werkzeug/middleware/lint.pyi
vendored
Normal file
67
third_party/2and3/werkzeug/middleware/lint.pyi
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import sys
|
||||
from typing import Any, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
from ..datastructures import Headers
|
||||
|
||||
class WSGIWarning(Warning): ...
|
||||
class HTTPWarning(Warning): ...
|
||||
|
||||
def check_string(context: str, obj: object, stacklevel: int = ...) -> None: ...
|
||||
|
||||
class _Readable(Protocol):
|
||||
def read(self, __size: int = ...) -> bytes: ...
|
||||
def readline(self, __size: int = ...) -> bytes: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def close(self) -> Any: ...
|
||||
|
||||
class InputStream(object):
|
||||
def __init__(self, stream: _Readable) -> None: ...
|
||||
def read(self, __size: int = ...) -> bytes: ...
|
||||
def readline(self, __size: int = ...) -> bytes: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class _FullyWritable(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
def flush(self) -> Any: ...
|
||||
def close(self) -> Any: ...
|
||||
|
||||
class ErrorStream(object):
|
||||
def __init__(self, stream: _FullyWritable) -> None: ...
|
||||
def write(self, s: str) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def writelines(self, seq: Iterable[str]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class _Writable(Protocol):
|
||||
def write(self, __s: str) -> Any: ...
|
||||
|
||||
class GuardedWrite(object):
|
||||
def __init__(self, write: _Writable, chunks: List[int]) -> None: ...
|
||||
def __call__(self, s: str) -> None: ...
|
||||
|
||||
class GuardedIterator(object):
|
||||
closed: bool
|
||||
headers_set: bool
|
||||
chunks: List[int]
|
||||
def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: List[int]) -> None: ...
|
||||
def __iter__(self) -> GuardedIterator: ...
|
||||
if sys.version_info < (3,):
|
||||
def next(self) -> str: ...
|
||||
else:
|
||||
def __next__(self) -> str: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class LintMiddleware(object):
|
||||
def __init__(self, app: WSGIApplication) -> None: ...
|
||||
def check_environ(self, environ: WSGIEnvironment) -> None: ...
|
||||
def check_start_response(
|
||||
self,
|
||||
status: str,
|
||||
headers: List[Tuple[str, str]],
|
||||
exc_info: Optional[tuple],
|
||||
) -> Tuple[int, Headers]: ...
|
||||
def check_headers(self, headers: Mapping[str, str]) -> None: ...
|
||||
def check_iterator(self, app_iter: Iterable[bytes]) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> GuardedIterator: ...
|
||||
14
third_party/2and3/werkzeug/middleware/profiler.pyi
vendored
Normal file
14
third_party/2and3/werkzeug/middleware/profiler.pyi
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
from typing import IO, Iterable, List, Optional, Text, Tuple, Union
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
class ProfilerMiddleware(object):
|
||||
def __init__(
|
||||
self,
|
||||
app: WSGIApplication,
|
||||
stream: IO[str] = ...,
|
||||
sort_by: Tuple[Text, Text] = ...,
|
||||
restrictions: Iterable[Union[str, float]] = ...,
|
||||
profile_dir: Optional[Text] = ...,
|
||||
filename_format: Text = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ...
|
||||
23
third_party/2and3/werkzeug/middleware/proxy_fix.pyi
vendored
Normal file
23
third_party/2and3/werkzeug/middleware/proxy_fix.pyi
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Iterable, Optional
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
class ProxyFix(object):
|
||||
app: WSGIApplication
|
||||
x_for: int
|
||||
x_proto: int
|
||||
x_host: int
|
||||
x_port: int
|
||||
x_prefix: int
|
||||
num_proxies: int
|
||||
def __init__(
|
||||
self,
|
||||
app: WSGIApplication,
|
||||
num_proxies: Optional[int] = ...,
|
||||
x_for: int = ...,
|
||||
x_proto: int = ...,
|
||||
x_host: int = ...,
|
||||
x_port: int = ...,
|
||||
x_prefix: int = ...,
|
||||
) -> None: ...
|
||||
def get_remote_addr(self, forwarded_for: Iterable[str]) -> Optional[str]: ...
|
||||
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> WSGIApplication: ...
|
||||
29
third_party/2and3/werkzeug/middleware/shared_data.pyi
vendored
Normal file
29
third_party/2and3/werkzeug/middleware/shared_data.pyi
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import datetime
|
||||
from typing import Callable, IO, Iterable, List, Mapping, Optional, Text, Tuple, Union
|
||||
from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
_V = Union[Tuple[Text, Text], Text]
|
||||
|
||||
_Opener = Callable[[], Tuple[IO[bytes], datetime.datetime, int]]
|
||||
_Loader = Callable[[Optional[Text]], Union[Tuple[None, None], Tuple[Text, _Opener]]]
|
||||
|
||||
class SharedDataMiddleware(object):
|
||||
app: WSGIApplication
|
||||
exports: List[Tuple[Text, _Loader]]
|
||||
cache: bool
|
||||
cache_timeout: float
|
||||
def __init__(
|
||||
self,
|
||||
app: WSGIApplication,
|
||||
exports: Union[Mapping[Text, _V], Iterable[Tuple[Text, _V]]],
|
||||
disallow: Optional[Text] = ...,
|
||||
cache: bool = ...,
|
||||
cache_timeout: float = ...,
|
||||
fallback_mimetype: Text = ...,
|
||||
) -> None: ...
|
||||
def is_allowed(self, filename: Text) -> bool: ...
|
||||
def get_file_loader(self, filename: Text) -> _Loader: ...
|
||||
def get_package_loader(self, package: Text, package_path: Text) -> _Loader: ...
|
||||
def get_directory_loader(self, directory: Text) -> _Loader: ...
|
||||
def generate_etag(self, mtime: datetime.datetime, file_size: int, real_filename: Union[Text, bytes]) -> str: ...
|
||||
def __call__(self, environment: WSGIEnvironment, start_response: StartResponse) -> WSGIApplication: ...
|
||||
25
third_party/2and3/werkzeug/wsgi.pyi
vendored
25
third_party/2and3/werkzeug/wsgi.pyi
vendored
@@ -1,6 +1,10 @@
|
||||
from typing import Any, Optional, Protocol, Iterable, Text
|
||||
from wsgiref.types import WSGIEnvironment, InputStream
|
||||
|
||||
from .middleware.dispatcher import DispatcherMiddleware as DispatcherMiddleware
|
||||
from .middleware.http_proxy import ProxyMiddleware as ProxyMiddleware
|
||||
from .middleware.shared_data import SharedDataMiddleware as SharedDataMiddleware
|
||||
|
||||
def responder(f): ...
|
||||
def get_current_url(environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ...,
|
||||
trusted_hosts: Optional[Any] = ...): ...
|
||||
@@ -16,27 +20,6 @@ def peek_path_info(environ, charset: Text = ..., errors: Text = ...): ...
|
||||
def extract_path_info(environ_or_baseurl, path_or_url, charset: Text = ..., errors: Text = ...,
|
||||
collapse_http_schemes: bool = ...): ...
|
||||
|
||||
class SharedDataMiddleware:
|
||||
app: Any
|
||||
exports: Any
|
||||
cache: Any
|
||||
cache_timeout: Any
|
||||
fallback_mimetype: Any
|
||||
def __init__(self, app, exports, disallow: Optional[Any] = ..., cache: bool = ..., cache_timeout=...,
|
||||
fallback_mimetype: str = ...): ...
|
||||
def is_allowed(self, filename): ...
|
||||
def get_file_loader(self, filename): ...
|
||||
def get_package_loader(self, package, package_path): ...
|
||||
def get_directory_loader(self, directory): ...
|
||||
def generate_etag(self, mtime, file_size, real_filename): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
|
||||
class DispatcherMiddleware:
|
||||
app: Any
|
||||
mounts: Any
|
||||
def __init__(self, app, mounts: Optional[Any] = ...): ...
|
||||
def __call__(self, environ, start_response): ...
|
||||
|
||||
class ClosingIterator:
|
||||
def __init__(self, iterable, callbacks: Optional[Any] = ...): ...
|
||||
def __iter__(self): ...
|
||||
|
||||
Reference in New Issue
Block a user