summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2022-04-08 16:33:41 +0300
committerAarni Koskela <akx@iki.fi>2022-04-08 16:45:46 +0300
commit10b3d6eec0d4cf2d76e451c0a0df5152b454e3db (patch)
tree0fcf02d1763ad602595e86fff80993096f762fc2
parentd2d88da71cf8a67acdaccf48dc249f6e3567fafc (diff)
downloadbabel-10b3d6eec0d4cf2d76e451c0a0df5152b454e3db.tar.gz
Deprecate get_next_timezone_transition()
In preparation of removing the hard dependency on pytz Refs #716
-rw-r--r--babel/dates.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/babel/dates.py b/babel/dates.py
index 01b6580..1386316 100644
--- a/babel/dates.py
+++ b/babel/dates.py
@@ -221,11 +221,21 @@ def get_next_timezone_transition(zone=None, dt=None):
Transition information can only be provided for timezones returned by
the :func:`get_timezone` function.
+ This function is pending deprecation with no replacement planned in the
+ Babel library.
+
:param zone: the timezone for which the transition should be looked up.
If not provided the local timezone is used.
:param dt: the date after which the next transition should be found.
If not given the current time is assumed.
"""
+ warnings.warn(
+ "get_next_timezone_transition() is deprecated and will be "
+ "removed in the next version of Babel. "
+ "Please see https://github.com/python-babel/babel/issues/716 "
+ "for discussion.",
+ category=DeprecationWarning,
+ )
zone = get_timezone(zone)
dt = _get_datetime(dt).replace(tzinfo=None)
@@ -256,6 +266,9 @@ class TimezoneTransition(object):
"""A helper object that represents the return value from
:func:`get_next_timezone_transition`.
+ This class is pending deprecation with no replacement planned in the
+ Babel library.
+
:field activates:
The time of the activation of the timezone transition in UTC.
:field from_tzinfo:
@@ -268,6 +281,13 @@ class TimezoneTransition(object):
"""
def __init__(self, activates, from_tzinfo, to_tzinfo, reference_date=None):
+ warnings.warn(
+ "TimezoneTransition is deprecated and will be "
+ "removed in the next version of Babel. "
+ "Please see https://github.com/python-babel/babel/issues/716 "
+ "for discussion.",
+ category=DeprecationWarning,
+ )
self.activates = activates
self.from_tzinfo = from_tzinfo
self.to_tzinfo = to_tzinfo