consistent versions and deprecation messages

This commit is contained in:
David Lord 2021-04-15 15:58:24 -07:00
parent 16f51ef799
commit 8ab4967703
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
4 changed files with 26 additions and 23 deletions

View file

@ -98,7 +98,7 @@ def call_factory(script_info, app_factory, args=None, kwargs=None):
if "script_info" in sig.parameters: if "script_info" in sig.parameters:
warnings.warn( warnings.warn(
"The 'script_info' argument is deprecated and will not be" "The 'script_info' argument is deprecated and will not be"
" passed to the app factory function in 2.1.", " passed to the app factory function in Flask 2.1.",
DeprecationWarning, DeprecationWarning,
) )
kwargs["script_info"] = script_info kwargs["script_info"] = script_info
@ -110,7 +110,8 @@ def call_factory(script_info, app_factory, args=None, kwargs=None):
): ):
warnings.warn( warnings.warn(
"Script info is deprecated and will not be passed as the" "Script info is deprecated and will not be passed as the"
" single argument to the app factory function in 2.1.", " single argument to the app factory function in Flask"
" 2.1.",
DeprecationWarning, DeprecationWarning,
) )
args.append(script_info) args.append(script_info)

View file

@ -446,8 +446,9 @@ def _prepare_send_file_kwargs(
): ):
if attachment_filename is not None: if attachment_filename is not None:
warnings.warn( warnings.warn(
"The 'attachment_filename' parameter has been renamed to 'download_name'." "The 'attachment_filename' parameter has been renamed to"
" The old name will be removed in Flask 2.1.", " 'download_name'. The old name will be removed in Flask"
" 2.1.",
DeprecationWarning, DeprecationWarning,
stacklevel=3, stacklevel=3,
) )
@ -455,8 +456,8 @@ def _prepare_send_file_kwargs(
if cache_timeout is not None: if cache_timeout is not None:
warnings.warn( warnings.warn(
"The 'cache_timeout' parameter has been renamed to 'max_age'. The old name" "The 'cache_timeout' parameter has been renamed to"
" will be removed in Flask 2.1.", " 'max_age'. The old name will be removed in Flask 2.1.",
DeprecationWarning, DeprecationWarning,
stacklevel=3, stacklevel=3,
) )
@ -464,8 +465,8 @@ def _prepare_send_file_kwargs(
if add_etags is not None: if add_etags is not None:
warnings.warn( warnings.warn(
"The 'add_etags' parameter has been renamed to 'etag'. The old name will be" "The 'add_etags' parameter has been renamed to 'etag'. The"
" removed in Flask 2.1.", " old name will be removed in Flask 2.1.",
DeprecationWarning, DeprecationWarning,
stacklevel=3, stacklevel=3,
) )
@ -549,7 +550,7 @@ def send_file(
``conditional`` is enabled and ``max_age`` is not set by ``conditional`` is enabled and ``max_age`` is not set by
default. default.
.. versionchanged:: 2.0.0 .. versionchanged:: 2.0
``etag`` replaces the ``add_etags`` parameter. It can be a ``etag`` replaces the ``add_etags`` parameter. It can be a
string to use instead of generating one. string to use instead of generating one.
@ -629,7 +630,7 @@ def safe_join(directory, *pathnames):
""" """
warnings.warn( warnings.warn(
"'flask.helpers.safe_join' is deprecated and will be removed in" "'flask.helpers.safe_join' is deprecated and will be removed in"
" 2.1. Use 'werkzeug.utils.safe_join' instead.", " Flask 2.1. Use 'werkzeug.utils.safe_join' instead.",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
) )

View file

@ -103,7 +103,7 @@ def dumps(obj, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.dumps`. :param kwargs: Extra arguments passed to :func:`json.dumps`.
.. versionchanged:: 2.0 .. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1. ``encoding`` is deprecated and will be removed in Flask 2.1.
.. versionchanged:: 1.0.3 .. versionchanged:: 1.0.3
``app`` can be passed directly, rather than requiring an app ``app`` can be passed directly, rather than requiring an app
@ -115,7 +115,7 @@ def dumps(obj, app=None, **kwargs):
if encoding is not None: if encoding is not None:
warnings.warn( warnings.warn(
"'encoding' is deprecated and will be removed in 2.1.", "'encoding' is deprecated and will be removed in Flask 2.1.",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
) )
@ -140,7 +140,7 @@ def dump(obj, fp, app=None, **kwargs):
.. versionchanged:: 2.0 .. versionchanged:: 2.0
Writing to a binary file, and the ``encoding`` argument, is Writing to a binary file, and the ``encoding`` argument, is
deprecated and will be removed in 2.1. deprecated and will be removed in Flask 2.1.
""" """
_dump_arg_defaults(kwargs, app=app) _dump_arg_defaults(kwargs, app=app)
encoding = kwargs.pop("encoding", None) encoding = kwargs.pop("encoding", None)
@ -155,7 +155,7 @@ def dump(obj, fp, app=None, **kwargs):
if show_warning: if show_warning:
warnings.warn( warnings.warn(
"Writing to a binary file, and the 'encoding' argument, is" "Writing to a binary file, and the 'encoding' argument, is"
" deprecated and will be removed in 2.1.", " deprecated and will be removed in Flask 2.1.",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
) )
@ -175,8 +175,8 @@ def loads(s, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.loads`. :param kwargs: Extra arguments passed to :func:`json.loads`.
.. versionchanged:: 2.0 .. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1. The data ``encoding`` is deprecated and will be removed in Flask 2.1. The
must be a string or UTF-8 bytes. data must be a string or UTF-8 bytes.
.. versionchanged:: 1.0.3 .. versionchanged:: 1.0.3
``app`` can be passed directly, rather than requiring an app ``app`` can be passed directly, rather than requiring an app
@ -187,8 +187,8 @@ def loads(s, app=None, **kwargs):
if encoding is not None: if encoding is not None:
warnings.warn( warnings.warn(
"'encoding' is deprecated and will be removed in 2.1. The" "'encoding' is deprecated and will be removed in Flask 2.1."
" data must be a string or UTF-8 bytes.", " The data must be a string or UTF-8 bytes.",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
) )
@ -211,16 +211,17 @@ def load(fp, app=None, **kwargs):
:param kwargs: Extra arguments passed to :func:`json.load`. :param kwargs: Extra arguments passed to :func:`json.load`.
.. versionchanged:: 2.0 .. versionchanged:: 2.0
``encoding`` is deprecated and will be removed in 2.1. The file ``encoding`` is deprecated and will be removed in Flask 2.1. The
must be text mode, or binary mode with UTF-8 bytes. file must be text mode, or binary mode with UTF-8 bytes.
""" """
_load_arg_defaults(kwargs, app=app) _load_arg_defaults(kwargs, app=app)
encoding = kwargs.pop("encoding", None) encoding = kwargs.pop("encoding", None)
if encoding is not None: if encoding is not None:
warnings.warn( warnings.warn(
"'encoding' is deprecated and will be removed in 2.1. The" "'encoding' is deprecated and will be removed in Flask 2.1."
" file must be text mode, or binary mode with UTF-8 bytes.", " The file must be text mode, or binary mode with UTF-8"
" bytes.",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
) )

View file

@ -56,7 +56,7 @@ class Scaffold:
are relative to. Typically not set, it is discovered based on are relative to. Typically not set, it is discovered based on
the ``import_name``. the ``import_name``.
.. versionadded:: 2.0.0 .. versionadded:: 2.0
""" """
name: str name: str