@@ -4,7 +4,7 @@ import time
4
4
import locale
5
5
import calendar
6
6
import re
7
- from datetime import date as datetime_date
7
+ import datetime
8
8
9
9
from _thread import allocate_lock as _thread_allocate_lock
10
10
@@ -288,20 +288,20 @@ def array_strptime(object[:] values, object fmt, bint exact=True, errors='raise'
288
288
elif iso_year != - 1 and iso_week != - 1 :
289
289
year, julian = _calc_julian_from_V(iso_year, iso_week,
290
290
weekday + 1 )
291
- # Cannot pre-calculate datetime_date () since can change in Julian
291
+ # Cannot pre-calculate datetime.date () since can change in Julian
292
292
# calculation and thus could have different value for the day of the wk
293
293
# calculation.
294
294
try :
295
295
if julian == - 1 :
296
296
# Need to add 1 to result since first day of the year is 1, not
297
297
# 0.
298
- ordinal = datetime_date (year, month, day).toordinal()
299
- julian = ordinal - datetime_date (year, 1 , 1 ).toordinal() + 1
298
+ ordinal = datetime.date (year, month, day).toordinal()
299
+ julian = ordinal - datetime.date (year, 1 , 1 ).toordinal() + 1
300
300
else :
301
301
# Assume that if they bothered to include Julian day it will
302
302
# be accurate.
303
- datetime_result = datetime_date .fromordinal(
304
- (julian - 1 ) + datetime_date (year, 1 , 1 ).toordinal())
303
+ datetime_result = datetime.date .fromordinal(
304
+ (julian - 1 ) + datetime.date (year, 1 , 1 ).toordinal())
305
305
year = datetime_result.year
306
306
month = datetime_result.month
307
307
day = datetime_result.day
@@ -311,7 +311,7 @@ def array_strptime(object[:] values, object fmt, bint exact=True, errors='raise'
311
311
continue
312
312
raise
313
313
if weekday == - 1 :
314
- weekday = datetime_date (year, month, day).weekday()
314
+ weekday = datetime.date (year, month, day).weekday()
315
315
316
316
dts.year = year
317
317
dts.month = month
@@ -649,7 +649,7 @@ cdef int _calc_julian_from_U_or_W(int year, int week_of_year,
649
649
cdef:
650
650
int first_weekday, week_0_length, days_to_week
651
651
652
- first_weekday = datetime_date (year, 1 , 1 ).weekday()
652
+ first_weekday = datetime.date (year, 1 , 1 ).weekday()
653
653
# If we are dealing with the %U directive (week starts on Sunday), it's
654
654
# easier to just shift the view to Sunday being the first day of the
655
655
# week.
@@ -692,14 +692,14 @@ cdef (int, int) _calc_julian_from_V(int iso_year, int iso_week, int iso_weekday)
692
692
cdef:
693
693
int correction, ordinal
694
694
695
- correction = datetime_date (iso_year, 1 , 4 ).isoweekday() + 3
695
+ correction = datetime.date (iso_year, 1 , 4 ).isoweekday() + 3
696
696
ordinal = (iso_week * 7 ) + iso_weekday - correction
697
697
# ordinal may be negative or 0 now, which means the date is in the previous
698
698
# calendar year
699
699
if ordinal < 1 :
700
- ordinal += datetime_date (iso_year, 1 , 1 ).toordinal()
700
+ ordinal += datetime.date (iso_year, 1 , 1 ).toordinal()
701
701
iso_year -= 1
702
- ordinal -= datetime_date (iso_year, 1 , 1 ).toordinal()
702
+ ordinal -= datetime.date (iso_year, 1 , 1 ).toordinal()
703
703
return iso_year, ordinal
704
704
705
705
0 commit comments