Skip to content

Commit

Permalink
Enable more Pydocstyle rules (NVIDIA#11582)
Browse files Browse the repository at this point in the history
Recently I have reviewed a handful of PRs with problems in their docstrings that I've been fixing with GitHub review suggestions. I took 40 minutes and enabled a bunch of pydocstyle rules that we agreed on in NVIDIA#10711, to help prevent some of these problems and reduce the amount of review effort required for the future. There are a handful of big ones (`D200, D202, D205, D400`) that will require a more intense effort to implement -- those rules may not be worth the significant refactoring effort. I think this may resolve the part of NVIDIA#10711 that we wanted to tackle in the short term, though I'm happy to hear others' views (@shwina @vyasr).

Error code reference: https://www.pydocstyle.org/en/stable/error_codes.html

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Ashwin Srinath (https://github.com/shwina)
  - Matthew Roeschke (https://github.com/mroeschke)
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: rapidsai/cudf#11582
  • Loading branch information
bdice authored Aug 23, 2022
1 parent e431440 commit da6b3ed
Show file tree
Hide file tree
Showing 19 changed files with 120 additions and 177 deletions.
16 changes: 0 additions & 16 deletions python/cudf/cudf/core/column/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def as_ordered(self, inplace: bool = False) -> Optional[SeriesOrIndex]:
Parameters
----------
inplace : bool, default False
Whether or not to add the categories inplace
or return a copy of this categorical with
Expand Down Expand Up @@ -192,7 +191,6 @@ def as_unordered(self, inplace: bool = False) -> Optional[SeriesOrIndex]:
Parameters
----------
inplace : bool, default False
Whether or not to set the ordered attribute
in-place or return a copy of this
Expand Down Expand Up @@ -266,10 +264,8 @@ def add_categories(
Parameters
----------
new_categories : category or list-like of category
The new categories to be included.
inplace : bool, default False
Whether or not to add the categories inplace
or return a copy of this categorical with
Expand Down Expand Up @@ -353,10 +349,8 @@ def remove_categories(
Parameters
----------
removals : category or list-like of category
The categories which should be removed.
inplace : bool, default False
Whether or not to remove the categories
inplace or return a copy of this categorical
Expand Down Expand Up @@ -461,20 +455,16 @@ def set_categories(
Parameters
----------
new_categories : list-like
The categories in new order.
ordered : bool, default None
Whether or not the categorical is treated as
a ordered categorical. If not given, do
not change the ordered information.
rename : bool, default False
Whether or not the `new_categories` should be
considered as a rename of the old categories
or as reordered categories.
inplace : bool, default False
Whether or not to reorder the categories in-place
or return a copy of this categorical with
Expand Down Expand Up @@ -540,22 +530,17 @@ def reorder_categories(
Parameters
----------
new_categories : Index-like
The categories in new order.
ordered : bool, optional
Whether or not the categorical is treated
as a ordered categorical. If not given, do
not change the ordered information.
inplace : bool, default False
Whether or not to reorder the categories
inplace or return a copy of this categorical
with reordered categories.
Returns
-------
cat
Expand Down Expand Up @@ -1585,7 +1570,6 @@ def _create_empty_categorical_column(
def pandas_categorical_as_column(
categorical: ColumnLike, codes: ColumnLike = None
) -> CategoricalColumn:

"""Creates a CategoricalColumn from a pandas.Categorical
If ``codes`` is defined, use it instead of ``categorical.codes``
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ def get_slice_bound(self, label: ScalarLike, side: str, kind: str) -> int:
Calculate slice bound that corresponds to given label.
Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.
Parameters
----------
label : Scalar
Expand Down
56 changes: 27 additions & 29 deletions python/cudf/cudf/core/column/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ def replace(
Examples
--------
>>> import cudf
>>> s = cudf.Series(['foo', 'fuz', None])
>>> s
Expand Down Expand Up @@ -1013,7 +1012,7 @@ def slice(
Series or Index from sliced substring from
original string object.
See also
See Also
--------
slice_replace
Replace a slice with a string.
Expand Down Expand Up @@ -1076,7 +1075,7 @@ def isinteger(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1138,7 +1137,7 @@ def ishex(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isdecimal
Check whether all characters are decimal.
Expand Down Expand Up @@ -1205,7 +1204,7 @@ def isfloat(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1274,7 +1273,7 @@ def isdecimal(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1338,7 +1337,7 @@ def isalnum(self) -> SeriesOrIndex:
Series or Index of boolean values with the
same length as the original Series/Index.
See also
See Also
--------
isalpha
Check whether all characters are alphabetic.
Expand Down Expand Up @@ -1407,7 +1406,7 @@ def isalpha(self) -> SeriesOrIndex:
Series or Index of boolean values with the same length
as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1466,7 +1465,7 @@ def isdigit(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1529,7 +1528,7 @@ def isnumeric(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1600,7 +1599,7 @@ def isupper(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1659,7 +1658,7 @@ def islower(self) -> SeriesOrIndex:
Series or Index of boolean values with the same
length as the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -1739,7 +1738,7 @@ def lower(self) -> SeriesOrIndex:
Series or Index of object
A copy of the object with all strings converted to lowercase.
See also
See Also
--------
upper
Converts all characters to uppercase.
Expand Down Expand Up @@ -1780,7 +1779,7 @@ def upper(self) -> SeriesOrIndex:
-------
Series or Index of object
See also
See Also
--------
lower
Converts all characters to lowercase.
Expand Down Expand Up @@ -1859,7 +1858,7 @@ def swapcase(self) -> SeriesOrIndex:
-------
Series or Index of object
See also
See Also
--------
lower
Converts all characters to lowercase.
Expand Down Expand Up @@ -1907,7 +1906,7 @@ def title(self) -> SeriesOrIndex:
-------
Series or Index of object
See also
See Also
--------
lower
Converts all characters to lowercase.
Expand Down Expand Up @@ -2076,7 +2075,7 @@ def slice_replace(
A new string with the specified section of the string
replaced with `repl` string.
See also
See Also
--------
slice
Just slicing without replacement.
Expand Down Expand Up @@ -2373,7 +2372,7 @@ def split(
Series, Index, DataFrame or MultiIndex
Type matches caller unless ``expand=True`` (see Notes).
See also
See Also
--------
rsplit
Splits string around given separator/delimiter, starting from
Expand Down Expand Up @@ -2540,7 +2539,7 @@ def rsplit(
Series, Index, DataFrame or MultiIndex
Type matches caller unless ``expand=True`` (see Notes).
See also
See Also
--------
split
Split strings around given separator/delimiter.
Expand Down Expand Up @@ -2700,7 +2699,7 @@ def partition(self, sep: str = " ", expand: bool = True) -> SeriesOrIndex:
The parameter `expand` is not yet supported and will raise a
`NotImplementedError` if anything other than the default value is set.
See also
See Also
--------
rpartition
Split the string at the last occurrence of sep.
Expand Down Expand Up @@ -2845,7 +2844,7 @@ def pad(
Returns Series or Index with minimum number
of char in object.
See also
See Also
--------
rjust
Fills the left side of strings with an arbitrary character.
Expand Down Expand Up @@ -2928,7 +2927,7 @@ def zfill(self, width: int) -> SeriesOrIndex:
Series/Index of str dtype
Returns Series or Index with prepended ‘0’ characters.
See also
See Also
--------
rjust
Fills the left side of strings with an arbitrary character.
Expand Down Expand Up @@ -3181,7 +3180,7 @@ def strip(self, to_strip: str = None) -> SeriesOrIndex:
Series/Index of str dtype
Returns Series or Index.
See also
See Also
--------
lstrip
Remove leading characters in Series/Index.
Expand Down Expand Up @@ -3240,7 +3239,7 @@ def lstrip(self, to_strip: str = None) -> SeriesOrIndex:
-------
Series or Index of object
See also
See Also
--------
strip
Remove leading and trailing characters in Series/Index.
Expand Down Expand Up @@ -3289,7 +3288,7 @@ def rstrip(self, to_strip: str = None) -> SeriesOrIndex:
Series/Index of str dtype
Returns Series or Index.
See also
See Also
--------
strip
Remove leading and trailing characters in Series/Index.
Expand Down Expand Up @@ -3601,7 +3600,7 @@ def isspace(self) -> SeriesOrIndex:
Series or Index of boolean values with the same length as
the original Series/Index.
See also
See Also
--------
isalnum
Check whether all characters are alphanumeric.
Expand Down Expand Up @@ -3720,7 +3719,7 @@ def startswith(self, pat: Union[str, Sequence]) -> SeriesOrIndex:
A Series of booleans indicating whether the given
pattern matches the start of each string element.
See also
See Also
--------
endswith
Same as startswith, but tests the end of string.
Expand Down Expand Up @@ -3839,7 +3838,7 @@ def rfind(
-------
Series or Index of int
See also
See Also
--------
find
Return lowest indexes in each strings.
Expand Down Expand Up @@ -4475,7 +4474,6 @@ def token_count(self, delimiter: str = " ") -> SeriesOrIndex:
Parameters
----------
delimiter : str or list of strs, Default is whitespace.
The characters or strings used to locate the
split points of each string.
Expand Down
Loading

0 comments on commit da6b3ed

Please sign in to comment.