diff --git a/src/werkzeug/_internal.py b/src/werkzeug/_internal.py index 70ab68761..6800e2258 100644 --- a/src/werkzeug/_internal.py +++ b/src/werkzeug/_internal.py @@ -97,13 +97,11 @@ def _log(type: str, message: str, *args: t.Any, **kwargs: t.Any) -> None: @t.overload -def _dt_as_utc(dt: None) -> None: - ... +def _dt_as_utc(dt: None) -> None: ... @t.overload -def _dt_as_utc(dt: datetime) -> datetime: - ... +def _dt_as_utc(dt: datetime) -> datetime: ... def _dt_as_utc(dt: datetime | None) -> datetime | None: @@ -149,12 +147,10 @@ def lookup(self, instance: t.Any) -> t.MutableMapping[str, t.Any]: @t.overload def __get__( self, instance: None, owner: type - ) -> _DictAccessorProperty[_TAccessorValue]: - ... + ) -> _DictAccessorProperty[_TAccessorValue]: ... @t.overload - def __get__(self, instance: t.Any, owner: type) -> _TAccessorValue: - ... + def __get__(self, instance: t.Any, owner: type) -> _TAccessorValue: ... def __get__( self, instance: t.Any | None, owner: type diff --git a/src/werkzeug/datastructures/structures.pyi b/src/werkzeug/datastructures/structures.pyi index 2e7af35be..746011abe 100644 --- a/src/werkzeug/datastructures/structures.pyi +++ b/src/werkzeug/datastructures/structures.pyi @@ -24,7 +24,7 @@ _CD = TypeVar("_CD", bound="CallbackDict") def is_immutable(self: object) -> NoReturn: ... def iter_multi_items( - mapping: Mapping[K, V | Iterable[V]] | Iterable[tuple[K, V]] + mapping: Mapping[K, V | Iterable[V]] | Iterable[tuple[K, V]], ) -> Iterator[tuple[K, V]]: ... class ImmutableList(ImmutableListMixin[V]): ... diff --git a/src/werkzeug/debug/repr.py b/src/werkzeug/debug/repr.py index 1dcdd67be..37d2e76db 100644 --- a/src/werkzeug/debug/repr.py +++ b/src/werkzeug/debug/repr.py @@ -4,6 +4,7 @@ Together with the CSS and JavaScript of the debugger this gives a colorful and more compact output. """ + from __future__ import annotations import codecs diff --git a/src/werkzeug/exceptions.py b/src/werkzeug/exceptions.py index 253612918..25366a9f7 100644 --- a/src/werkzeug/exceptions.py +++ b/src/werkzeug/exceptions.py @@ -43,6 +43,7 @@ def application(request): return e """ + from __future__ import annotations import typing as t diff --git a/src/werkzeug/formparser.py b/src/werkzeug/formparser.py index 5117a2673..35b6798c9 100644 --- a/src/werkzeug/formparser.py +++ b/src/werkzeug/formparser.py @@ -41,8 +41,7 @@ def __call__( content_type: str | None, filename: str | None, content_length: int | None = None, - ) -> t.IO[bytes]: - ... + ) -> t.IO[bytes]: ... F = t.TypeVar("F", bound=t.Callable[..., t.Any]) diff --git a/src/werkzeug/http.py b/src/werkzeug/http.py index 4ead0165a..973a4a906 100644 --- a/src/werkzeug/http.py +++ b/src/werkzeug/http.py @@ -553,13 +553,11 @@ def parse_options_header(value: str | None) -> tuple[str, dict[str, str]]: @t.overload -def parse_accept_header(value: str | None) -> ds.Accept: - ... +def parse_accept_header(value: str | None) -> ds.Accept: ... @t.overload -def parse_accept_header(value: str | None, cls: type[_TAnyAccept]) -> _TAnyAccept: - ... +def parse_accept_header(value: str | None, cls: type[_TAnyAccept]) -> _TAnyAccept: ... def parse_accept_header( @@ -622,15 +620,13 @@ def parse_accept_header( @t.overload def parse_cache_control_header( value: str | None, on_update: _t_cc_update, cls: None = None -) -> ds.RequestCacheControl: - ... +) -> ds.RequestCacheControl: ... @t.overload def parse_cache_control_header( value: str | None, on_update: _t_cc_update, cls: type[_TAnyCC] -) -> _TAnyCC: - ... +) -> _TAnyCC: ... def parse_cache_control_header( @@ -670,15 +666,13 @@ def parse_cache_control_header( @t.overload def parse_csp_header( value: str | None, on_update: _t_csp_update, cls: None = None -) -> ds.ContentSecurityPolicy: - ... +) -> ds.ContentSecurityPolicy: ... @t.overload def parse_csp_header( value: str | None, on_update: _t_csp_update, cls: type[_TAnyCSP] -) -> _TAnyCSP: - ... +) -> _TAnyCSP: ... def parse_csp_header( diff --git a/src/werkzeug/middleware/dispatcher.py b/src/werkzeug/middleware/dispatcher.py index 559fea585..e11bacc52 100644 --- a/src/werkzeug/middleware/dispatcher.py +++ b/src/werkzeug/middleware/dispatcher.py @@ -30,6 +30,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import typing as t diff --git a/src/werkzeug/middleware/http_proxy.py b/src/werkzeug/middleware/http_proxy.py index 59ba9b324..5e239156a 100644 --- a/src/werkzeug/middleware/http_proxy.py +++ b/src/werkzeug/middleware/http_proxy.py @@ -7,6 +7,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import typing as t diff --git a/src/werkzeug/middleware/lint.py b/src/werkzeug/middleware/lint.py index 8c858673b..23255853f 100644 --- a/src/werkzeug/middleware/lint.py +++ b/src/werkzeug/middleware/lint.py @@ -12,6 +12,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import typing as t @@ -424,8 +425,8 @@ def checking_start_response( status: str = args[0] headers: list[tuple[str, str]] = args[1] - exc_info: None | ( - tuple[type[BaseException], BaseException, TracebackType] + exc_info: ( + None | (tuple[type[BaseException], BaseException, TracebackType]) ) = args[2] if len(args) == 3 else None headers_set[:] = self.check_start_response(status, headers, exc_info) diff --git a/src/werkzeug/middleware/profiler.py b/src/werkzeug/middleware/profiler.py index 1120c83ef..112b87776 100644 --- a/src/werkzeug/middleware/profiler.py +++ b/src/werkzeug/middleware/profiler.py @@ -11,6 +11,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import os.path diff --git a/src/werkzeug/middleware/proxy_fix.py b/src/werkzeug/middleware/proxy_fix.py index 8dfbb36c0..cbf4e0bae 100644 --- a/src/werkzeug/middleware/proxy_fix.py +++ b/src/werkzeug/middleware/proxy_fix.py @@ -21,6 +21,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import typing as t diff --git a/src/werkzeug/middleware/shared_data.py b/src/werkzeug/middleware/shared_data.py index e3ec7cab8..1d71c27fb 100644 --- a/src/werkzeug/middleware/shared_data.py +++ b/src/werkzeug/middleware/shared_data.py @@ -8,6 +8,7 @@ :copyright: 2007 Pallets :license: BSD-3-Clause """ + from __future__ import annotations import importlib.util @@ -38,7 +39,6 @@ class SharedDataMiddleware: - """A WSGI middleware which provides static content for development environments or simple server setups. Its usage is quite simple:: diff --git a/src/werkzeug/routing/__init__.py b/src/werkzeug/routing/__init__.py index 84b043fdf..62adc48fb 100644 --- a/src/werkzeug/routing/__init__.py +++ b/src/werkzeug/routing/__init__.py @@ -105,6 +105,7 @@ routing tried to match a ``POST`` request) a ``MethodNotAllowed`` exception is raised. """ + from .converters import AnyConverter as AnyConverter from .converters import BaseConverter as BaseConverter from .converters import FloatConverter as FloatConverter diff --git a/src/werkzeug/routing/map.py b/src/werkzeug/routing/map.py index 87b83a54c..572a580d5 100644 --- a/src/werkzeug/routing/map.py +++ b/src/werkzeug/routing/map.py @@ -379,7 +379,6 @@ def __repr__(self) -> str: class MapAdapter: - """Returned by :meth:`Map.bind` or :meth:`Map.bind_to_environ` and does the URL matching and building based on runtime information. """ @@ -477,8 +476,7 @@ def match( # type: ignore return_rule: t.Literal[False] = False, query_args: t.Mapping[str, t.Any] | str | None = None, websocket: bool | None = None, - ) -> tuple[str, t.Mapping[str, t.Any]]: - ... + ) -> tuple[str, t.Mapping[str, t.Any]]: ... @t.overload def match( @@ -488,8 +486,7 @@ def match( return_rule: t.Literal[True] = True, query_args: t.Mapping[str, t.Any] | str | None = None, websocket: bool | None = None, - ) -> tuple[Rule, t.Mapping[str, t.Any]]: - ... + ) -> tuple[Rule, t.Mapping[str, t.Any]]: ... def match( self, diff --git a/src/werkzeug/serving.py b/src/werkzeug/serving.py index ff5eb8c66..5e05239b5 100644 --- a/src/werkzeug/serving.py +++ b/src/werkzeug/serving.py @@ -11,6 +11,7 @@ from myapp import create_app from werkzeug import run_simple """ + from __future__ import annotations import errno diff --git a/src/werkzeug/testapp.py b/src/werkzeug/testapp.py index 57f1f6fdf..69ba6078e 100644 --- a/src/werkzeug/testapp.py +++ b/src/werkzeug/testapp.py @@ -1,6 +1,7 @@ """A small application that can be used to test a WSGI server and check it for WSGI compliance. """ + from __future__ import annotations import os diff --git a/src/werkzeug/wrappers/request.py b/src/werkzeug/wrappers/request.py index 25b091691..0f82db77c 100644 --- a/src/werkzeug/wrappers/request.py +++ b/src/werkzeug/wrappers/request.py @@ -374,8 +374,7 @@ def get_data( # type: ignore cache: bool = True, as_text: t.Literal[False] = False, parse_form_data: bool = False, - ) -> bytes: - ... + ) -> bytes: ... @t.overload def get_data( @@ -383,8 +382,7 @@ def get_data( cache: bool = True, as_text: t.Literal[True] = ..., parse_form_data: bool = False, - ) -> str: - ... + ) -> str: ... def get_data( self, cache: bool = True, as_text: bool = False, parse_form_data: bool = False @@ -564,14 +562,12 @@ def json(self) -> t.Any | None: @t.overload def get_json( self, force: bool = ..., silent: t.Literal[False] = ..., cache: bool = ... - ) -> t.Any: - ... + ) -> t.Any: ... @t.overload def get_json( self, force: bool = ..., silent: bool = ..., cache: bool = ... - ) -> t.Any | None: - ... + ) -> t.Any | None: ... def get_json( self, force: bool = False, silent: bool = False, cache: bool = True diff --git a/src/werkzeug/wrappers/response.py b/src/werkzeug/wrappers/response.py index ee5c69478..10ee5d557 100644 --- a/src/werkzeug/wrappers/response.py +++ b/src/werkzeug/wrappers/response.py @@ -260,12 +260,10 @@ def from_app( return cls(*run_wsgi_app(app, environ, buffered)) @t.overload - def get_data(self, as_text: t.Literal[False] = False) -> bytes: - ... + def get_data(self, as_text: t.Literal[False] = False) -> bytes: ... @t.overload - def get_data(self, as_text: t.Literal[True]) -> str: - ... + def get_data(self, as_text: t.Literal[True]) -> str: ... def get_data(self, as_text: bool = False) -> bytes | str: """The string representation of the response body. Whenever you call @@ -595,12 +593,10 @@ def json(self) -> t.Any | None: return self.get_json() @t.overload - def get_json(self, force: bool = ..., silent: t.Literal[False] = ...) -> t.Any: - ... + def get_json(self, force: bool = ..., silent: t.Literal[False] = ...) -> t.Any: ... @t.overload - def get_json(self, force: bool = ..., silent: bool = ...) -> t.Any | None: - ... + def get_json(self, force: bool = ..., silent: bool = ...) -> t.Any | None: ... def get_json(self, force: bool = False, silent: bool = False) -> t.Any | None: """Parse :attr:`data` as JSON. Useful during testing.