remove deprecated total_seconds

This commit is contained in:
David Lord 2021-11-12 09:25:27 -08:00
parent b7501776a1
commit f8cdc78ce1
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 2 additions and 22 deletions

View file

@ -15,6 +15,8 @@ Unreleased
- ``json`` functions no longer take an ``encoding`` parameter.
- ``safe_join`` is removed, use ``werkzeug.utils.safe_join``
instead.
- ``total_seconds`` is removed, use ``timedelta.total_seconds``
instead.
Version 2.0.2

View file

@ -5,7 +5,6 @@ import sys
import typing as t
import warnings
from datetime import datetime
from datetime import timedelta
from functools import lru_cache
from functools import update_wrapper
from threading import RLock
@ -761,27 +760,6 @@ class locked_cached_property(werkzeug.utils.cached_property):
super().__delete__(obj)
def total_seconds(td: timedelta) -> int:
"""Returns the total seconds from a timedelta object.
:param timedelta td: the timedelta to be converted in seconds
: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
def is_ip(value: str) -> bool:
"""Determine if the given string is an IP address.