mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Werkzeug stub fixes (#2229)
* Fix stub for werkzeug.exceptions.Aborter and abort * `werkzeug.exceptions.abort` [1] was missing and is thus added here. It's also commonly used in Flask as `flask.abort`. * They both always raise [2], hence the `NoReturn` return type. [1]: http://werkzeug.pocoo.org/docs/0.14/exceptions/#werkzeug.exceptions.abort [2]:d129d17066/werkzeug/exceptions.py (L708-L713)* Fix stub for werkzeug.wrappers.AuthorizationMixin The code [1] uses `@cached_property` [2], which is basically a Python property, and optionally returns an `Authorization` [3] object. [1]:d129d17066/werkzeug/wrappers.py (L1462-L1466)[2]:d129d17066/werkzeug/utils.py (L35)[3]:d129d17066/werkzeug/datastructures.py (L2438)
This commit is contained in:
committed by
Jelle Zijlstra
parent
02c42c9cf6
commit
15ad132393
6
third_party/2and3/werkzeug/exceptions.pyi
vendored
6
third_party/2and3/werkzeug/exceptions.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, NoReturn
|
||||
|
||||
class HTTPException(Exception):
|
||||
code = ... # type: Any
|
||||
@@ -147,4 +147,6 @@ class HTTPVersionNotSupported(HTTPException):
|
||||
class Aborter:
|
||||
mapping = ... # type: Any
|
||||
def __init__(self, mapping=None, extra=None): ...
|
||||
def __call__(self, code, *args, **kwargs): ...
|
||||
def __call__(self, code, *args, **kwargs) -> NoReturn: ...
|
||||
|
||||
def abort(status: Any, *args: Any, **kwargs: Any) -> NoReturn: ...
|
||||
|
||||
5
third_party/2and3/werkzeug/wrappers.pyi
vendored
5
third_party/2and3/werkzeug/wrappers.pyi
vendored
@@ -6,7 +6,7 @@ from typing import (
|
||||
from wsgiref.types import WSGIEnvironment, InputStream
|
||||
|
||||
from .datastructures import (
|
||||
CombinedMultiDict, EnvironHeaders, Headers, ImmutableMultiDict,
|
||||
Authorization, CombinedMultiDict, EnvironHeaders, Headers, ImmutableMultiDict,
|
||||
MultiDict, TypeConversionDict, HeaderSet,
|
||||
)
|
||||
|
||||
@@ -139,7 +139,8 @@ class UserAgentMixin:
|
||||
def user_agent(self): ...
|
||||
|
||||
class AuthorizationMixin:
|
||||
def authorization(self): ...
|
||||
@property
|
||||
def authorization(self) -> Optional[Authorization]: ...
|
||||
|
||||
class StreamOnlyMixin:
|
||||
disable_data_descriptor = ... # type: Any
|
||||
|
||||
Reference in New Issue
Block a user