2424# -----------------------------------------------------------------------------
2525# Code
2626# -----------------------------------------------------------------------------
27-
2827__all__ = ["tzUTC" , "utc_aware" , "utcfromtimestamp" , "utcnow" ]
2928
29+ # Enable display of DeprecrationWarning for this module explicitly.
30+ warnings .filterwarnings ("default" , category = DeprecationWarning , module = __name__ )
31+
3032# constant for zero offset
3133ZERO = timedelta (0 )
3234
@@ -36,18 +38,24 @@ def __getattr__(name):
3638 err = f"IPython.utils.tz is deprecated and has no attribute { name } "
3739 raise AttributeError (err )
3840
39- msg = "The module `IPython.utils.tz` is deprecated and will be completely removed."
40- warnings .warn (msg , category = DeprecationWarning , stacklevel = 2 )
41+ _warn_deprecated ()
4142
4243 return getattr (name )
4344
4445
46+ def _warn_deprecated ():
47+ msg = "The module `IPython.utils.tz` is deprecated and will be completely removed."
48+ warnings .warn (msg , category = DeprecationWarning , stacklevel = 2 )
49+
50+
4551class tzUTC (tzinfo ):
4652 """tzinfo object for UTC (zero offset)
4753
4854 Deprecated since IPython 8.19.0.
4955 """
5056
57+ _warn_deprecated ()
58+
5159 def utcoffset (self , d ):
5260 return ZERO
5361
@@ -65,6 +73,7 @@ def utc_aware(unaware):
6573 """
6674
6775 def utc_method (* args , ** kwargs ):
76+ _warn_deprecated ()
6877 dt = unaware (* args , ** kwargs )
6978 return dt .replace (tzinfo = UTC )
7079
0 commit comments