Skip to content
Myr

better type checking during deprecation

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent c7c8dc3 · Browse files · 1 file+14 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−13 removed

  • other:+14 added−13 removed

1 file+14 added−13 removed

modified:src/flask/__init__.py+14 added-13 removed
40 unmodified lines
41from .templating import stream_template_string as stream_template_string42from .wrappers import Request as Request43from .wrappers import Response as Response4445if not t.TYPE_CHECKING:4646def __getattr__(name: str) -> t.Any:47 if name == "__version__":48 import importlib.metadata49 import warnings47 def __getattr__(name: str) -> t.Any:48 if name == "__version__":49 import importlib.metadata50 import warnings5151 warnings.warn(52 "The '__version__' attribute is deprecated and will be removed in"53 " Flask 3.2. Use feature detection or"54 " 'importlib.metadata.version(\"flask\")' instead.",55 DeprecationWarning,56 stacklevel=2,57 )58 return importlib.metadata.version("flask")52 warnings.warn(53 "The '__version__' attribute is deprecated and will be removed in"54 " Flask 3.2. Use feature detection or"55 " 'importlib.metadata.version(\"flask\")' instead.",56 DeprecationWarning,57 stacklevel=2,58 )59 return importlib.metadata.version("flask")6060 raise AttributeError(name)61 raise AttributeError(name)