Skip to content

Commit 19231e1

Browse files
committed
revert ccalendar, just implement shift_months cases
1 parent ca96e15 commit 19231e1

File tree

4 files changed

+9
-84
lines changed

4 files changed

+9
-84
lines changed

pandas/_libs/tslibs/ccalendar.pxd

Lines changed: 0 additions & 13 deletions
This file was deleted.

pandas/_libs/tslibs/ccalendar.pyx

Lines changed: 0 additions & 65 deletions
This file was deleted.

pandas/_libs/tslibs/offsets.pyx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ np.import_array()
1717

1818
from util cimport is_string_object, is_integer_object
1919

20-
from ccalendar cimport get_days_in_month, monthrange
20+
from pandas._libs.tslib import monthrange
21+
2122
from conversion cimport tz_convert_single, pydt_to_i8
2223
from frequencies cimport get_freq_code
2324
from nattype cimport NPY_NAT
2425
from np_datetime cimport (pandas_datetimestruct,
25-
dtstruct_to_dt64, dt64_to_dtstruct)
26+
dtstruct_to_dt64, dt64_to_dtstruct,
27+
is_leapyear, days_per_month_table)
2628

2729
# ---------------------------------------------------------------------
2830
# Constants
@@ -450,6 +452,11 @@ class BaseOffset(_BaseOffset):
450452
# ----------------------------------------------------------------------
451453
# RelativeDelta Arithmetic
452454

455+
@cython.wraparound(False)
456+
@cython.boundscheck(False)
457+
cdef inline int get_days_in_month(int year, int month) nogil:
458+
return days_per_month_table[is_leapyear(year)][month - 1]
459+
453460

454461
cdef inline int year_add_months(pandas_datetimestruct dts, int months) nogil:
455462
"""new year number after shifting pandas_datetimestruct number of months"""

setup.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ class CheckSDist(sdist_class):
343343
'pandas/_libs/window.pyx',
344344
'pandas/_libs/sparse.pyx',
345345
'pandas/_libs/parsers.pyx',
346-
'pandas/_libs/tslibs/ccalendar.pyx',
347346
'pandas/_libs/tslibs/strptime.pyx',
348347
'pandas/_libs/tslibs/np_datetime.pyx',
349348
'pandas/_libs/tslibs/timedeltas.pyx',
@@ -559,8 +558,6 @@ def pxd(name):
559558
'_libs/tslibs/nattype'],
560559
'depends': tseries_depends,
561560
'sources': np_datetime_sources},
562-
'_libs.tslibs.ccalendar': {
563-
'pyxfile': '_libs/tslibs/ccalendar'},
564561
'_libs.tslibs.conversion': {
565562
'pyxfile': '_libs/tslibs/conversion',
566563
'pxdfiles': ['_libs/src/util',
@@ -587,7 +584,6 @@ def pxd(name):
587584
'_libs.tslibs.offsets': {
588585
'pyxfile': '_libs/tslibs/offsets',
589586
'pxdfiles': ['_libs/src/util',
590-
'_libs/tslibs/ccalendar',
591587
'_libs/tslibs/conversion',
592588
'_libs/tslibs/frequencies',
593589
'_libs/tslibs/nattype'],

0 commit comments

Comments
 (0)