Skip to content

Commit c296a93

Browse files
authored
CLN: assorted (#36606)
* docstring fixups, closes #26982 * update RangeIndex docstring, closes #22373 * CLN: misc * CLN: update Makefil * update nat docstrings to match * revert controversial
1 parent 1accb6e commit c296a93

File tree

5 files changed

+36
-16
lines changed

5 files changed

+36
-16
lines changed

pandas/_libs/tslibs/nattype.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class NaTType(_NaT):
392392
393393
Returns
394394
-------
395-
string
395+
str
396396
""",
397397
)
398398
day_name = _make_nan_func(
@@ -407,7 +407,7 @@ class NaTType(_NaT):
407407
408408
Returns
409409
-------
410-
string
410+
str
411411
""",
412412
)
413413
# _nat_methods

pandas/_libs/tslibs/offsets.pyx

+27-9
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ cdef _wrap_timedelta_result(result):
219219

220220

221221
cdef _get_calendar(weekmask, holidays, calendar):
222-
"""Generate busdaycalendar"""
222+
"""
223+
Generate busdaycalendar
224+
"""
223225
if isinstance(calendar, np.busdaycalendar):
224226
if not holidays:
225227
holidays = tuple(calendar.holidays)
@@ -659,14 +661,18 @@ cdef class BaseOffset:
659661
return nint
660662

661663
def __setstate__(self, state):
662-
"""Reconstruct an instance from a pickled state"""
664+
"""
665+
Reconstruct an instance from a pickled state
666+
"""
663667
self.n = state.pop("n")
664668
self.normalize = state.pop("normalize")
665669
self._cache = state.pop("_cache", {})
666670
# At this point we expect state to be empty
667671

668672
def __getstate__(self):
669-
"""Return a pickleable state"""
673+
"""
674+
Return a pickleable state
675+
"""
670676
state = {}
671677
state["n"] = self.n
672678
state["normalize"] = self.normalize
@@ -971,7 +977,9 @@ cdef class RelativeDeltaOffset(BaseOffset):
971977
object.__setattr__(self, key, val)
972978

973979
def __getstate__(self):
974-
"""Return a pickleable state"""
980+
"""
981+
Return a pickleable state
982+
"""
975983
# RelativeDeltaOffset (technically DateOffset) is the only non-cdef
976984
# class, so the only one with __dict__
977985
state = self.__dict__.copy()
@@ -980,7 +988,9 @@ cdef class RelativeDeltaOffset(BaseOffset):
980988
return state
981989

982990
def __setstate__(self, state):
983-
"""Reconstruct an instance from a pickled state"""
991+
"""
992+
Reconstruct an instance from a pickled state
993+
"""
984994

985995
if "offset" in state:
986996
# Older (<0.22.0) versions have offset attribute instead of _offset
@@ -3604,7 +3614,9 @@ def shift_day(other: datetime, days: int) -> datetime:
36043614

36053615

36063616
cdef inline int year_add_months(npy_datetimestruct dts, int months) nogil:
3607-
"""new year number after shifting npy_datetimestruct number of months"""
3617+
"""
3618+
New year number after shifting npy_datetimestruct number of months.
3619+
"""
36083620
return dts.year + (dts.month + months - 1) // 12
36093621

36103622

@@ -3702,7 +3714,9 @@ cdef inline void _shift_months(const int64_t[:] dtindex,
37023714
Py_ssize_t count,
37033715
int months,
37043716
str day_opt) nogil:
3705-
"""See shift_months.__doc__"""
3717+
"""
3718+
See shift_months.__doc__
3719+
"""
37063720
cdef:
37073721
Py_ssize_t i
37083722
int months_to_roll
@@ -3734,7 +3748,9 @@ cdef inline void _shift_quarters(const int64_t[:] dtindex,
37343748
int q1start_month,
37353749
str day_opt,
37363750
int modby) nogil:
3737-
"""See shift_quarters.__doc__"""
3751+
"""
3752+
See shift_quarters.__doc__
3753+
"""
37383754
cdef:
37393755
Py_ssize_t i
37403756
int months_since, n
@@ -3990,7 +4006,9 @@ cdef inline int _roll_qtrday(npy_datetimestruct* dts,
39904006
int n,
39914007
int months_since,
39924008
str day_opt) nogil except? -1:
3993-
"""See roll_qtrday.__doc__"""
4009+
"""
4010+
See roll_qtrday.__doc__
4011+
"""
39944012

39954013
if n > 0:
39964014
if months_since < 0 or (months_since == 0 and

pandas/_libs/tslibs/timestamps.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ cdef class _Timestamp(ABCTimestamp):
503503

504504
Returns
505505
-------
506-
string
506+
str
507507
"""
508508
return self._get_date_name_field("day_name", locale)
509509

@@ -518,7 +518,7 @@ cdef class _Timestamp(ABCTimestamp):
518518

519519
Returns
520520
-------
521-
string
521+
str
522522
"""
523523
return self._get_date_name_field("month_name", locale)
524524

pandas/core/indexes/range.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ class RangeIndex(Int64Index):
5353
If int and "stop" is not given, interpreted as "stop" instead.
5454
stop : int (default: 0)
5555
step : int (default: 1)
56-
name : object, optional
57-
Name to be stored in the index.
56+
dtype : np.int64
57+
Unused, accepted for homogeneity with other index types.
5858
copy : bool, default False
5959
Unused, accepted for homogeneity with other index types.
60+
name : object, optional
61+
Name to be stored in the index.
6062
6163
Attributes
6264
----------

scripts/validate_rst_title_capitalization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Validate that the titles in the rst files follow the proper capitalization convention.
44

0 commit comments

Comments
 (0)