From f8cdc78ce10f32a46390799e7ac16d231fb35803 Mon Sep 17 00:00:00 2001 From: David Lord Date: Fri, 12 Nov 2021 09:25:27 -0800 Subject: [PATCH] remove deprecated total_seconds --- CHANGES.rst | 2 ++ src/flask/helpers.py | 22 ---------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2358e159..3560dc65 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 diff --git a/src/flask/helpers.py b/src/flask/helpers.py index df6a14cb..20701e2a 100644 --- a/src/flask/helpers.py +++ b/src/flask/helpers.py @@ -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.