Skip to content

Commit 841ddc7

Browse files
committed
WIP: fix conf for Windows. Experiment with YearEnd
1 parent 1d2e420 commit 841ddc7

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

doc/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@
114114
):
115115
exclude_patterns.append(rel_fname)
116116
elif single_doc and rel_fname != pattern:
117+
if "\\" in rel_fname:
118+
rel_fname = rel_fname.replace("\\", "/")
117119
exclude_patterns.append(rel_fname)
118120

119121
with open(os.path.join(source_path, "index.rst.template"), encoding="utf-8") as f:

pandas/_libs/tslibs/offsets.pyx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# cython: embedsignature=True
2-
31
import re
42
import time
53
import warnings
@@ -79,6 +77,7 @@ from pandas._libs.tslibs.np_datetime cimport (
7977
pandas_datetime_to_datetimestruct,
8078
pydate_to_dtstruct,
8179
)
80+
from pandas.util._decorators import set_module
8281

8382
import_pandas_datetime()
8483

@@ -622,6 +621,7 @@ cdef class BaseOffset:
622621
@cache_readonly
623622
def freqstr(self) -> str:
624623
"""
624+
625625
Return a string representing the frequency.
626626

627627
See Also
@@ -648,6 +648,7 @@ cdef class BaseOffset:
648648

649649
>>> pd.offsets.Nano(-3).freqstr
650650
'-3ns'
651+
651652
"""
652653
try:
653654
code = self.rule_code
@@ -2690,13 +2691,29 @@ cdef class BYearBegin(YearOffset):
26902691
_day_opt = "business_start"
26912692

26922693

2693-
cdef class YearEnd(YearOffset):
2694+
cdef class _YearEnd(YearOffset):
2695+
_default_month = 12
2696+
_prefix = "YE"
2697+
_day_opt = "end"
2698+
2699+
cdef readonly:
2700+
int _period_dtype_code
2701+
2702+
def __init__(self, n=1, normalize=False, month=None):
2703+
# Because YearEnd can be the freq for a Period, define its
2704+
# _period_dtype_code at construction for performance
2705+
YearOffset.__init__(self, n, normalize, month)
2706+
self._period_dtype_code = PeriodDtypeCode.A + self.month % 12
2707+
2708+
2709+
@set_module("pandas.tseries.offsets")
2710+
class YearEnd(_YearEnd):
26942711
"""
26952712
DateOffset increments between calendar year end dates.
26962713
26972714
YearEnd goes to the next date which is the end of the year.
26982715
2699-
Attributes
2716+
Parameters
27002717
----------
27012718
n : int, default 1
27022719
The number of years represented.
@@ -2730,18 +2747,9 @@ cdef class YearEnd(YearOffset):
27302747
Timestamp('2022-12-31 00:00:00')
27312748
"""
27322749

2733-
_default_month = 12
2734-
_prefix = "YE"
2735-
_day_opt = "end"
2736-
2737-
cdef readonly:
2738-
int _period_dtype_code
2739-
2740-
def __init__(self, n=1, normalize=False, month=None):
2741-
# Because YearEnd can be the freq for a Period, define its
2742-
# _period_dtype_code at construction for performance
2743-
YearOffset.__init__(self, n, normalize, month)
2744-
self._period_dtype_code = PeriodDtypeCode.A + self.month % 12
2750+
def __new__(cls, fuck=None, normalize=False, month=None):
2751+
# this is a comment
2752+
return _YearEnd.__new__(cls, fuck, normalize, month)
27452753

27462754

27472755
cdef class YearBegin(YearOffset):

0 commit comments

Comments
 (0)