deprecate total_seconds

This commit is contained in:
David Lord 2021-04-15 23:05:24 -07:00
parent f3ed1322a6
commit 85b430a366
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 13 additions and 2 deletions

View file

@ -709,7 +709,17 @@ def total_seconds(td):
:returns: number of seconds
:rtype: int
.. deprecated:: 2.0
Will be removed in Flask 2.1. Use
:meth:`timedelta.total_seconds` instead.
"""
warnings.warn(
"'total_seconds' is deprecated and will be removed in Flask"
" 2.1. Use 'timedelta.total_seconds' instead.",
DeprecationWarning,
stacklevel=2,
)
return td.days * 60 * 60 * 24 + td.seconds