Skip to content

CLN: assorted #36606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class NaTType(_NaT):

Returns
-------
string
str
""",
)
day_name = _make_nan_func(
Expand All @@ -407,7 +407,7 @@ class NaTType(_NaT):

Returns
-------
string
str
""",
)
# _nat_methods
Expand Down
36 changes: 27 additions & 9 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ cdef _wrap_timedelta_result(result):


cdef _get_calendar(weekmask, holidays, calendar):
"""Generate busdaycalendar"""
"""
Generate busdaycalendar
"""
if isinstance(calendar, np.busdaycalendar):
if not holidays:
holidays = tuple(calendar.holidays)
Expand Down Expand Up @@ -659,14 +661,18 @@ cdef class BaseOffset:
return nint

def __setstate__(self, state):
"""Reconstruct an instance from a pickled state"""
"""
Reconstruct an instance from a pickled state
"""
self.n = state.pop("n")
self.normalize = state.pop("normalize")
self._cache = state.pop("_cache", {})
# At this point we expect state to be empty

def __getstate__(self):
"""Return a pickleable state"""
"""
Return a pickleable state
"""
state = {}
state["n"] = self.n
state["normalize"] = self.normalize
Expand Down Expand Up @@ -971,7 +977,9 @@ cdef class RelativeDeltaOffset(BaseOffset):
object.__setattr__(self, key, val)

def __getstate__(self):
"""Return a pickleable state"""
"""
Return a pickleable state
"""
# RelativeDeltaOffset (technically DateOffset) is the only non-cdef
# class, so the only one with __dict__
state = self.__dict__.copy()
Expand All @@ -980,7 +988,9 @@ cdef class RelativeDeltaOffset(BaseOffset):
return state

def __setstate__(self, state):
"""Reconstruct an instance from a pickled state"""
"""
Reconstruct an instance from a pickled state
"""

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


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


Expand Down Expand Up @@ -3702,7 +3714,9 @@ cdef inline void _shift_months(const int64_t[:] dtindex,
Py_ssize_t count,
int months,
str day_opt) nogil:
"""See shift_months.__doc__"""
"""
See shift_months.__doc__
"""
cdef:
Py_ssize_t i
int months_to_roll
Expand Down Expand Up @@ -3734,7 +3748,9 @@ cdef inline void _shift_quarters(const int64_t[:] dtindex,
int q1start_month,
str day_opt,
int modby) nogil:
"""See shift_quarters.__doc__"""
"""
See shift_quarters.__doc__
"""
cdef:
Py_ssize_t i
int months_since, n
Expand Down Expand Up @@ -3990,7 +4006,9 @@ cdef inline int _roll_qtrday(npy_datetimestruct* dts,
int n,
int months_since,
str day_opt) nogil except? -1:
"""See roll_qtrday.__doc__"""
"""
See roll_qtrday.__doc__
"""

if n > 0:
if months_since < 0 or (months_since == 0 and
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ cdef class _Timestamp(ABCTimestamp):

Returns
-------
string
str
"""
return self._get_date_name_field("day_name", locale)

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

Returns
-------
string
str
"""
return self._get_date_name_field("month_name", locale)

Expand Down
6 changes: 4 additions & 2 deletions pandas/core/indexes/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ class RangeIndex(Int64Index):
If int and "stop" is not given, interpreted as "stop" instead.
stop : int (default: 0)
step : int (default: 1)
name : object, optional
Name to be stored in the index.
dtype : np.int64
Unused, accepted for homogeneity with other index types.
copy : bool, default False
Unused, accepted for homogeneity with other index types.
name : object, optional
Name to be stored in the index.

Attributes
----------
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate_rst_title_capitalization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Validate that the titles in the rst files follow the proper capitalization convention.

Expand Down