Skip to content

Commit 0e87452

Browse files
thooPingviinituutti
authored andcommitted
Fix validation error type SS05 and check in CI (pandas-dev#25133)
1 parent 0b74d9d commit 0e87452

21 files changed

+70
-57
lines changed

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ fi
240240
### DOCSTRINGS ###
241241
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
242242

243-
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, EX04, RT04)' ; echo $MSG
244-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR05,EX04,RT04
243+
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, EX04, RT04, SS05)' ; echo $MSG
244+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR05,EX04,RT04,SS05
245245
RET=$(($RET + $?)) ; echo $MSG "DONE"
246246

247247
fi

pandas/_libs/tslibs/nattype.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ cdef class _NaT(datetime):
183183
return np.datetime64(NPY_NAT, 'ns')
184184

185185
def to_datetime64(self):
186-
""" Returns a numpy.datetime64 object with 'ns' precision """
186+
"""
187+
Return a numpy.datetime64 object with 'ns' precision.
188+
"""
187189
return np.datetime64('NaT', 'ns')
188190

189191
def __repr__(self):
@@ -448,7 +450,7 @@ class NaTType(_NaT):
448450
"""
449451
Timestamp.now(tz=None)
450452
451-
Returns new Timestamp object representing current time local to
453+
Return new Timestamp object representing current time local to
452454
tz.
453455
454456
Parameters

pandas/_libs/tslibs/timestamps.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ cdef class _Timestamp(datetime):
340340
self.microsecond, self.tzinfo)
341341

342342
cpdef to_datetime64(self):
343-
""" Returns a numpy.datetime64 object with 'ns' precision """
343+
"""
344+
Return a numpy.datetime64 object with 'ns' precision.
345+
"""
344346
return np.datetime64(self.value, 'ns')
345347

346348
def __add__(self, other):
@@ -614,7 +616,7 @@ class Timestamp(_Timestamp):
614616
"""
615617
Timestamp.now(tz=None)
616618
617-
Returns new Timestamp object representing current time local to
619+
Return new Timestamp object representing current time local to
618620
tz.
619621
620622
Parameters

pandas/core/arrays/categorical.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def contains(cat, key, container):
214214

215215
class Categorical(ExtensionArray, PandasObject):
216216
"""
217-
Represents a categorical variable in classic R / S-plus fashion
217+
Represent a categorical variable in classic R / S-plus fashion
218218
219219
`Categoricals` can only take on only a limited, and usually fixed, number
220220
of possible values (`categories`). In contrast to statistical categorical
@@ -747,7 +747,7 @@ def _set_dtype(self, dtype):
747747

748748
def set_ordered(self, value, inplace=False):
749749
"""
750-
Sets the ordered attribute to the boolean value
750+
Set the ordered attribute to the boolean value
751751
752752
Parameters
753753
----------
@@ -793,7 +793,7 @@ def as_unordered(self, inplace=False):
793793
def set_categories(self, new_categories, ordered=None, rename=False,
794794
inplace=False):
795795
"""
796-
Sets the categories to the specified new_categories.
796+
Set the categories to the specified new_categories.
797797
798798
`new_categories` can include new categories (which will result in
799799
unused categories) or remove old categories (which results in values
@@ -864,7 +864,7 @@ def set_categories(self, new_categories, ordered=None, rename=False,
864864

865865
def rename_categories(self, new_categories, inplace=False):
866866
"""
867-
Renames categories.
867+
Rename categories.
868868
869869
Parameters
870870
----------
@@ -958,7 +958,7 @@ def rename_categories(self, new_categories, inplace=False):
958958

959959
def reorder_categories(self, new_categories, ordered=None, inplace=False):
960960
"""
961-
Reorders categories as specified in new_categories.
961+
Reorder categories as specified in new_categories.
962962
963963
`new_categories` need to include all old categories and no new category
964964
items.
@@ -1051,7 +1051,7 @@ def add_categories(self, new_categories, inplace=False):
10511051

10521052
def remove_categories(self, removals, inplace=False):
10531053
"""
1054-
Removes the specified categories.
1054+
Remove the specified categories.
10551055
10561056
`removals` must be included in the old categories. Values which were in
10571057
the removed categories will be set to NaN
@@ -1104,7 +1104,7 @@ def remove_categories(self, removals, inplace=False):
11041104

11051105
def remove_unused_categories(self, inplace=False):
11061106
"""
1107-
Removes categories which are not used.
1107+
Remove categories which are not used.
11081108
11091109
Parameters
11101110
----------
@@ -1454,7 +1454,7 @@ def dropna(self):
14541454

14551455
def value_counts(self, dropna=True):
14561456
"""
1457-
Returns a Series containing counts of each category.
1457+
Return a Series containing counts of each category.
14581458
14591459
Every category will have an entry, even those with a count of 0.
14601460
@@ -1570,7 +1570,7 @@ def argsort(self, *args, **kwargs):
15701570

15711571
def sort_values(self, inplace=False, ascending=True, na_position='last'):
15721572
"""
1573-
Sorts the Categorical by category value returning a new
1573+
Sort the Categorical by category value returning a new
15741574
Categorical by default.
15751575
15761576
While an ordering is applied to the category values, sorting in this

pandas/core/dtypes/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ def _validate_date_like_dtype(dtype):
20062006

20072007
def pandas_dtype(dtype):
20082008
"""
2009-
Converts input into a pandas only dtype object or a numpy dtype object.
2009+
Convert input into a pandas only dtype object or a numpy dtype object.
20102010
20112011
Parameters
20122012
----------

pandas/core/dtypes/dtypes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818

1919
def register_extension_dtype(cls):
20-
"""Class decorator to register an ExtensionType with pandas.
20+
"""
21+
Register an ExtensionType with pandas as class decorator.
2122
2223
.. versionadded:: 0.24.0
2324

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6009,7 +6009,7 @@ def unstack(self, level=-1, fill_value=None):
60096009
return unstack(self, level, fill_value)
60106010

60116011
_shared_docs['melt'] = ("""
6012-
Unpivots a DataFrame from wide format to long format, optionally
6012+
Unpivot a DataFrame from wide format to long format, optionally
60136013
leaving identifier variables set.
60146014
60156015
This function is useful to massage a DataFrame into a format where one

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10125,7 +10125,7 @@ def nanptp(values, axis=0, skipna=True):
1012510125

1012610126
cls.ptp = _make_stat_function(
1012710127
cls, 'ptp', name, name2, axis_descr,
10128-
"""Returns the difference between the maximum value and the
10128+
"""Return the difference between the maximum value and the
1012910129
minimum value in the object. This is the equivalent of the
1013010130
``numpy.ndarray`` method ``ptp``.\n\n.. deprecated:: 0.24.0
1013110131
Use numpy.ptp instead""",

pandas/core/groupby/generic.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,9 @@ def true_and_notna(x, *args, **kwargs):
10211021
return filtered
10221022

10231023
def nunique(self, dropna=True):
1024-
""" Returns number of unique elements in the group """
1024+
"""
1025+
Return number of unique elements in the group.
1026+
"""
10251027
ids, _, _ = self.grouper.group_info
10261028

10271029
val = self.obj.get_values()

pandas/core/groupby/groupby.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def curried(x):
625625

626626
def get_group(self, name, obj=None):
627627
"""
628-
Constructs NDFrame from group with provided name.
628+
Construct NDFrame from group with provided name.
629629
630630
Parameters
631631
----------
@@ -1047,7 +1047,7 @@ def result_to_bool(result):
10471047
@Appender(_common_see_also)
10481048
def any(self, skipna=True):
10491049
"""
1050-
Returns True if any value in the group is truthful, else False.
1050+
Return True if any value in the group is truthful, else False.
10511051
10521052
Parameters
10531053
----------
@@ -1060,7 +1060,7 @@ def any(self, skipna=True):
10601060
@Appender(_common_see_also)
10611061
def all(self, skipna=True):
10621062
"""
1063-
Returns True if all values in the group are truthful, else False.
1063+
Return True if all values in the group are truthful, else False.
10641064
10651065
Parameters
10661066
----------
@@ -1813,7 +1813,7 @@ def cumcount(self, ascending=True):
18131813
def rank(self, method='average', ascending=True, na_option='keep',
18141814
pct=False, axis=0):
18151815
"""
1816-
Provides the rank of values within each group.
1816+
Provide the rank of values within each group.
18171817
18181818
Parameters
18191819
----------
@@ -2039,7 +2039,7 @@ def pct_change(self, periods=1, fill_method='pad', limit=None, freq=None,
20392039
@Substitution(name='groupby', see_also=_common_see_also)
20402040
def head(self, n=5):
20412041
"""
2042-
Returns first n rows of each group.
2042+
Return first n rows of each group.
20432043
20442044
Essentially equivalent to ``.apply(lambda x: x.head(n))``,
20452045
except ignores as_index flag.
@@ -2067,7 +2067,7 @@ def head(self, n=5):
20672067
@Substitution(name='groupby', see_also=_common_see_also)
20682068
def tail(self, n=5):
20692069
"""
2070-
Returns last n rows of each group.
2070+
Return last n rows of each group.
20712071
20722072
Essentially equivalent to ``.apply(lambda x: x.tail(n))``,
20732073
except ignores as_index flag.

pandas/core/indexes/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4049,7 +4049,7 @@ def putmask(self, mask, value):
40494049

40504050
def equals(self, other):
40514051
"""
4052-
Determines if two Index objects contain the same elements.
4052+
Determine if two Index objects contain the same elements.
40534053
"""
40544054
if self.is_(other):
40554055
return True
@@ -4144,7 +4144,7 @@ def asof(self, label):
41444144

41454145
def asof_locs(self, where, mask):
41464146
"""
4147-
Finds the locations (indices) of the labels from the index for
4147+
Find the locations (indices) of the labels from the index for
41484148
every entry in the `where` argument.
41494149
41504150
As in the `asof` function, if the label (a particular entry in

pandas/core/indexes/category.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def _is_dtype_compat(self, other):
232232

233233
def equals(self, other):
234234
"""
235-
Determines if two CategorialIndex objects contain the same elements.
235+
Determine if two CategorialIndex objects contain the same elements.
236236
"""
237237
if self.is_(other):
238238
return True

pandas/core/indexes/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ def delete(self, loc):
12841284

12851285
def indexer_at_time(self, time, asof=False):
12861286
"""
1287-
Returns index locations of index values at particular time of day
1287+
Return index locations of index values at particular time of day
12881288
(e.g. 9:30AM).
12891289
12901290
Parameters

pandas/core/ops.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def _get_op_name(op, special):
447447
_op_descriptions[reverse_op]['reverse'] = key
448448

449449
_flex_doc_SERIES = """
450-
{desc} of series and other, element-wise (binary operator `{op_name}`).
450+
Return {desc} of series and other, element-wise (binary operator `{op_name}`).
451451
452452
Equivalent to ``{equiv}``, but with support to substitute a fill_value for
453453
missing data in one of the inputs.
@@ -547,7 +547,7 @@ def _get_op_name(op, special):
547547
"""
548548

549549
_flex_doc_FRAME = """
550-
{desc} of dataframe and other, element-wise (binary operator `{op_name}`).
550+
Get {desc} of dataframe and other, element-wise (binary operator `{op_name}`).
551551
552552
Equivalent to ``{equiv}``, but with support to substitute a fill_value
553553
for missing data in one of the inputs. With reverse version, `{reverse}`.
@@ -701,7 +701,7 @@ def _get_op_name(op, special):
701701
"""
702702

703703
_flex_comp_doc_FRAME = """
704-
{desc} of dataframe and other, element-wise (binary operator `{op_name}`).
704+
Get {desc} of dataframe and other, element-wise (binary operator `{op_name}`).
705705
706706
Among flexible wrappers (`eq`, `ne`, `le`, `lt`, `ge`, `gt`) to comparison
707707
operators.
@@ -847,7 +847,7 @@ def _get_op_name(op, special):
847847
"""
848848

849849
_flex_doc_PANEL = """
850-
{desc} of series and other, element-wise (binary operator `{op_name}`).
850+
Return {desc} of series and other, element-wise (binary operator `{op_name}`).
851851
Equivalent to ``{equiv}``.
852852
853853
Parameters

pandas/core/panel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ def construct_index_parts(idx, major=True):
999999

10001000
def apply(self, func, axis='major', **kwargs):
10011001
"""
1002-
Applies function along axis (or axes) of the Panel.
1002+
Apply function along axis (or axes) of the Panel.
10031003
10041004
Parameters
10051005
----------

pandas/core/series.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def nonzero(self):
580580

581581
def put(self, *args, **kwargs):
582582
"""
583-
Applies the `put` method to its `values` attribute if it has one.
583+
Apply the `put` method to its `values` attribute if it has one.
584584
585585
See Also
586586
--------
@@ -1456,7 +1456,7 @@ def iteritems(self):
14561456

14571457
def keys(self):
14581458
"""
1459-
Alias for index.
1459+
Return alias for index.
14601460
"""
14611461
return self.index
14621462

@@ -2987,7 +2987,7 @@ def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
29872987

29882988
def argsort(self, axis=0, kind='quicksort', order=None):
29892989
"""
2990-
Overrides ndarray.argsort. Argsorts the value, omitting NA/null values,
2990+
Override ndarray.argsort. Argsorts the value, omitting NA/null values,
29912991
and places the result in the same locations as the non-NA values.
29922992
29932993
Parameters

pandas/core/strings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@ def rindex(self, sub, start=0, end=None):
28692869
return self._wrap_result(result)
28702870

28712871
_shared_docs['len'] = ("""
2872-
Computes the length of each element in the Series/Index. The element may be
2872+
Compute the length of each element in the Series/Index. The element may be
28732873
a sequence (such as a string, tuple or list) or a collection
28742874
(such as a dictionary).
28752875

pandas/core/window.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def aggregate(self, arg, *args, **kwargs):
438438

439439
class Window(_Window):
440440
"""
441-
Provides rolling window calculations.
441+
Provide rolling window calculations.
442442
443443
.. versionadded:: 0.18.0
444444
@@ -1803,7 +1803,7 @@ def corr(self, other=None, pairwise=None, **kwargs):
18031803

18041804
class RollingGroupby(_GroupByMixin, Rolling):
18051805
"""
1806-
Provides a rolling groupby implementation.
1806+
Provide a rolling groupby implementation.
18071807
18081808
.. versionadded:: 0.18.1
18091809
@@ -1834,7 +1834,7 @@ def _validate_monotonic(self):
18341834

18351835
class Expanding(_Rolling_and_Expanding):
18361836
"""
1837-
Provides expanding transformations.
1837+
Provide expanding transformations.
18381838
18391839
.. versionadded:: 0.18.0
18401840
@@ -2076,7 +2076,7 @@ def corr(self, other=None, pairwise=None, **kwargs):
20762076

20772077
class ExpandingGroupby(_GroupByMixin, Expanding):
20782078
"""
2079-
Provides a expanding groupby implementation.
2079+
Provide a expanding groupby implementation.
20802080
20812081
.. versionadded:: 0.18.1
20822082

0 commit comments

Comments
 (0)