Skip to content

Commit 9f2c716

Browse files
charlesdong1991jreback
authored andcommitted
DOC: Make _field_accessor manage the docstring format (pandas-dev#24099)
1 parent 669cb27 commit 9f2c716

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pandas/core/arrays/datetimes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def f(self):
8282
return result
8383

8484
f.__name__ = name
85-
f.__doc__ = docstring
85+
f.__doc__ = "\n{}\n".format(docstring)
8686
return property(f)
8787

8888

@@ -1138,12 +1138,12 @@ def date(self):
11381138
"The name of day in a week (ex: Friday)\n\n.. deprecated:: 0.23.0")
11391139

11401140
dayofyear = _field_accessor('dayofyear', 'doy',
1141-
"\nThe ordinal day of the year\n")
1142-
quarter = _field_accessor('quarter', 'q', "\nThe quarter of the date\n")
1141+
"The ordinal day of the year.")
1142+
quarter = _field_accessor('quarter', 'q', "The quarter of the date.")
11431143
days_in_month = _field_accessor(
11441144
'days_in_month',
11451145
'dim',
1146-
"\nThe number of days in the month\n")
1146+
"The number of days in the month.")
11471147
daysinmonth = days_in_month
11481148
_is_month_doc = """
11491149
Indicates whether the date is the {first_or_last} day of the month.

pandas/core/arrays/timedeltas.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def f(self):
6060
return result
6161

6262
f.__name__ = name
63-
f.__doc__ = docstring
63+
f.__doc__ = "\n{}\n".format(docstring)
6464
return property(f)
6565

6666

@@ -692,16 +692,16 @@ def to_pytimedelta(self):
692692
return tslibs.ints_to_pytimedelta(self.asi8)
693693

694694
days = _field_accessor("days", "days",
695-
"\nNumber of days for each element.\n")
695+
"Number of days for each element.")
696696
seconds = _field_accessor("seconds", "seconds",
697-
"\nNumber of seconds (>= 0 and less than 1 day) "
698-
"for each element.\n")
697+
"Number of seconds (>= 0 and less than 1 day) "
698+
"for each element.")
699699
microseconds = _field_accessor("microseconds", "microseconds",
700-
"\nNumber of microseconds (>= 0 and less "
701-
"than 1 second) for each element.\n")
700+
"Number of microseconds (>= 0 and less "
701+
"than 1 second) for each element.")
702702
nanoseconds = _field_accessor("nanoseconds", "nanoseconds",
703-
"\nNumber of nanoseconds (>= 0 and less "
704-
"than 1 microsecond) for each element.\n")
703+
"Number of nanoseconds (>= 0 and less "
704+
"than 1 microsecond) for each element.")
705705

706706
@property
707707
def components(self):

0 commit comments

Comments
 (0)