Skip to content
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

Fix docstrings in series.py #10712

Closed
wants to merge 4 commits into from
Closed
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
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ repos:
hooks:
- id: pydocstyle
args: ["--config=python/.flake8"]
exclude: |
(?x)^(
ci|
cpp|
conda|
docs|
java|
notebooks|
python/dask_cudf|
python/cudf_kafka|
python/custreamz|
python/cudf/cudf/tests
)

- repo: local
hooks:
- id: clang-format
Expand Down
7 changes: 3 additions & 4 deletions python/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ ignore =
E203

[pydocstyle]
match = ^(.*abc\.py|.*api/types\.py|.*single_column_frame\.py|.*indexed_frame\.py)$
# Due to https://github.com/PyCQA/pydocstyle/issues/363, we must exclude rather than include using match-dir.
match-dir = ^(?!ci|cpp|python/dask_cudf|python/cudf_kafka|python/custreamz).*$
# In addition to numpy style, we additionally ignore:
match = ^(.*abc\.py|.*api/types\.py|.*single_column_frame\.py|.*indexed_frame\.py|.*series\.py)$
# Due to https://github.com/PyCQA/pydocstyle/issues/363, we must exclude rather than include using match-dir. Note that as discussed in https://stackoverflow.com/questions/65478393/how-to-filter-directories-using-the-match-dir-flag-for-pydocstyle, unlike the match option above this match-dir will have no effect when pydocstyle is invoked from pre-commit. Therefore this exclusion list must also be maintained in the pre-commit config file.
match-dir = ^(?!(ci|cpp|conda|docs|java|notebooks|dask_cudf|cudf_kafka|custreamz|tests)).*$
add-ignore =
# magic methods
D105,
Expand Down
14 changes: 8 additions & 6 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6258,7 +6258,7 @@ def from_dataframe(df, allow_copy=False):
return df_protocol.from_dataframe(df, allow_copy=allow_copy)


def make_binop_func(op, postprocess=None):
def _make_binop_func(op, postprocess=None):
# This function is used to wrap binary operations in Frame with an
# appropriate API for DataFrame as required for pandas compatibility. The
# main effect is reordering and error-checking parameters in
Expand Down Expand Up @@ -6317,16 +6317,16 @@ def wrapper(self, other, axis="columns", level=None, fill_value=None):
"rtruediv",
"rdiv",
]:
setattr(DataFrame, binop, make_binop_func(binop))
setattr(DataFrame, binop, _make_binop_func(binop))


def _make_replacement_func(value):
# This function generates a postprocessing function suitable for use with
# make_binop_func that fills null columns with the desired fill value.
# _make_binop_func that fills null columns with the desired fill value.

def func(left, right, output):
# This function may be passed as the postprocess argument to
# make_binop_func. Columns that are only present in one of the inputs
# _make_binop_func. Columns that are only present in one of the inputs
# will be null in the output. This function postprocesses the output to
# replace those nulls with some desired output.
if isinstance(right, Series):
Expand Down Expand Up @@ -6354,7 +6354,7 @@ def func(left, right, output):
# The ne comparator needs special postprocessing because elements that missing
# in one operand should be treated as null and result in True in the output
# rather than simply propagating nulls.
DataFrame.ne = make_binop_func("ne", _make_replacement_func(True))
DataFrame.ne = _make_binop_func("ne", _make_replacement_func(True))


# All other comparison operators needs return False when one of the operands is
Expand All @@ -6367,7 +6367,9 @@ def func(left, right, output):
"ge",
]:
setattr(
DataFrame, binop, make_binop_func(binop, _make_replacement_func(False))
DataFrame,
binop,
_make_binop_func(binop, _make_replacement_func(False)),
)


Expand Down
Loading