11"""Pure Python implementation of the datetime module."""
22
3+ lazy import _strptime
4+ lazy import warnings
5+
36__all__ = ("date" , "datetime" , "time" , "timedelta" , "timezone" , "tzinfo" ,
47 "MINYEAR" , "MAXYEAR" , "UTC" )
58
@@ -1077,7 +1080,6 @@ def strptime(cls, date_string, format):
10771080 For a list of supported format codes, see the documentation:
10781081 https://docs.python.org/3/library/datetime.html#format-codes
10791082 """
1080- import _strptime
10811083 return _strptime ._strptime_datetime_date (cls , date_string , format )
10821084
10831085 # Conversions to string
@@ -1469,7 +1471,6 @@ def strptime(cls, date_string, format):
14691471 For a list of supported format codes, see the documentation:
14701472 https://docs.python.org/3/library/datetime.html#format-codes
14711473 """
1472- import _strptime
14731474 return _strptime ._strptime_datetime_time (cls , date_string , format )
14741475
14751476 # Read-only field accessors
@@ -1908,7 +1909,6 @@ def fromtimestamp(cls, timestamp, tz=None):
19081909 @classmethod
19091910 def utcfromtimestamp (cls , t ):
19101911 """Construct a naive UTC datetime from a POSIX timestamp."""
1911- import warnings
19121912 warnings .warn ("datetime.datetime.utcfromtimestamp() is deprecated and scheduled "
19131913 "for removal in a future version. Use timezone-aware "
19141914 "objects to represent datetimes in UTC: "
@@ -1926,7 +1926,6 @@ def now(cls, tz=None):
19261926 @classmethod
19271927 def utcnow (cls ):
19281928 "Construct a UTC datetime from time.time()."
1929- import warnings
19301929 warnings .warn ("datetime.datetime.utcnow() is deprecated and scheduled for "
19311930 "removal in a future version. Use timezone-aware "
19321931 "objects to represent datetimes in UTC: "
@@ -2217,7 +2216,6 @@ def strptime(cls, date_string, format):
22172216 For a list of supported format codes, see the documentation:
22182217 https://docs.python.org/3/library/datetime.html#format-codes
22192218 """
2220- import _strptime
22212219 return _strptime ._strptime_datetime_datetime (cls , date_string , format )
22222220
22232221 def utcoffset (self ):
0 commit comments