Skip to content

Commit d404460

Browse files
BatalexWillAyd
authored andcommitted
DOC: use substitution decorator for business month classes (#25828) (#25868)
1 parent 923ac2b commit d404460

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

Diff for: pandas/tseries/offsets.py

+15-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
apply_index_wraps, as_datetime, roll_yearday, shift_month)
1616
import pandas.compat as compat
1717
from pandas.errors import AbstractMethodError
18-
from pandas.util._decorators import cache_readonly
18+
from pandas.util._decorators import Appender, Substitution, cache_readonly
1919

2020
from pandas.core.dtypes.generic import ABCPeriod
2121

@@ -971,21 +971,25 @@ class BusinessMonthBegin(MonthOffset):
971971

972972
class _CustomBusinessMonth(_CustomMixin, BusinessMixin, MonthOffset):
973973
"""
974-
DateOffset subclass representing one custom business month, incrementing
975-
between [BEGIN/END] of month dates.
974+
DateOffset subclass representing custom business month(s).
975+
976+
Increments between %(bound)s of month dates.
976977
977978
Parameters
978979
----------
979980
n : int, default 1
981+
The number of months represented.
980982
normalize : bool, default False
981-
Normalize start/end dates to midnight before generating date range
983+
Normalize start/end dates to midnight before generating date range.
982984
weekmask : str, Default 'Mon Tue Wed Thu Fri'
983-
weekmask of valid business days, passed to ``numpy.busdaycalendar``
985+
Weekmask of valid business days, passed to ``numpy.busdaycalendar``.
984986
holidays : list
985-
list/array of dates to exclude from the set of valid business days,
986-
passed to ``numpy.busdaycalendar``
987+
List/array of dates to exclude from the set of valid business days,
988+
passed to ``numpy.busdaycalendar``.
987989
calendar : pd.HolidayCalendar or np.busdaycalendar
990+
Calendar to integrate.
988991
offset : timedelta, default timedelta(0)
992+
Time offset to apply.
989993
"""
990994
_attributes = frozenset(['n', 'normalize',
991995
'weekmask', 'holidays', 'calendar', 'offset'])
@@ -1052,18 +1056,15 @@ def apply(self, other):
10521056
return result
10531057

10541058

1059+
@Substitution(bound="end")
1060+
@Appender(_CustomBusinessMonth.__doc__)
10551061
class CustomBusinessMonthEnd(_CustomBusinessMonth):
1056-
# TODO(py27): Replace condition with Subsitution after dropping Py27
1057-
if _CustomBusinessMonth.__doc__:
1058-
__doc__ = _CustomBusinessMonth.__doc__.replace('[BEGIN/END]', 'end')
10591062
_prefix = 'CBM'
10601063

10611064

1065+
@Substitution(bound="beginning")
1066+
@Appender(_CustomBusinessMonth.__doc__)
10621067
class CustomBusinessMonthBegin(_CustomBusinessMonth):
1063-
# TODO(py27): Replace condition with Subsitution after dropping Py27
1064-
if _CustomBusinessMonth.__doc__:
1065-
__doc__ = _CustomBusinessMonth.__doc__.replace('[BEGIN/END]',
1066-
'beginning')
10671068
_prefix = 'CBMS'
10681069

10691070

0 commit comments

Comments
 (0)