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 6 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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.PHONY : develop build clean clean_pyc doc lint-diff black
.PHONY : develop build clean clean_pyc doc lint-diff black check

all: develop

clean:
-python setup.py clean
-python3 setup.py clean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for having python3 rather than python?
When using virtual environment, it will be just python.
When working on windows (unluckily) there is python or py or py -3, but no python3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when not using a virtualenv on OSX or Linux, python still points at python2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thus, it will break make on windows.
What about setting $(PYTHON) variable depending on OS?
https://stackoverflow.com/a/14777895

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I'd rather just keep these as is. I'm pretty sure macOS and most linux distros have or are in the process of removing the standard py2 installation, so this is adding what will soon be legacy code style

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does make even work on windows?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to use make on windows. I use it. in GitBash terminal (MinGW) it works almost as in bash.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deal breaker? i think osx/linux use case is more common, but not a hill worth dying on.


clean_pyc:
-find . -name '*.py[co]' -exec rm {} \;

build: clean_pyc
python setup.py build_ext --inplace
python3 setup.py build_ext --inplace

lint-diff:
git diff upstream/master --name-only -- "*.py" | xargs flake8
Expand All @@ -18,13 +18,13 @@ black:
black .

develop: build
python -m pip install --no-build-isolation -e .
python3 -m pip install --no-build-isolation -e .

doc:
-rm -rf doc/build doc/source/generated
cd doc; \
python make.py clean; \
python make.py html
python3 make.py clean; \
python3 make.py html

check:
python3 scripts/validate_unwanted_patterns.py \
Expand Down
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