Skip to content

Commit 1bf36c7

Browse files
DeaMariaLeonpooja-subramaniam
authored andcommitted
DOC: Fix some RT02 issues in docstrings (pandas-dev#50896)
DOC: Fix RT02 issues in docstrings
1 parent cb6e90e commit 1bf36c7

File tree

8 files changed

+14
-29
lines changed

8 files changed

+14
-29
lines changed

ci/code_checks.sh

+2-17
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,8 @@ fi
7979
### DOCSTRINGS ###
8080
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8181

82-
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG
83-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05,SS06
84-
RET=$(($RET + $?)) ; echo $MSG "DONE"
85-
86-
MSG='Partially validate docstrings (RT02)' ; echo $MSG
87-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT02 --ignore_functions \
88-
pandas.Index.all \
89-
pandas.Index.any \
90-
pandas.MultiIndex.drop \
91-
pandas.DatetimeIndex.to_pydatetime \
92-
pandas.TimedeltaIndex.to_pytimedelta \
93-
pandas.io.formats.style.Styler.export \
94-
pandas.api.extensions.ExtensionArray.astype \
95-
pandas.api.extensions.ExtensionArray.dropna \
96-
pandas.api.extensions.ExtensionArray.isna \
97-
pandas.api.extensions.ExtensionArray.repeat \
98-
pandas.api.extensions.ExtensionArray.unique
82+
MSG='Validate docstrings (EX04, GL01, GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, PR03, PR04, PR05, PR06, PR08, PR09, PR10, RT01, RT02, RT04, RT05, SA02, SA03, SA04, SS01, SS02, SS03, SS04, SS05, SS06)' ; echo $MSG
83+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX04,GL01,GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,PR03,PR04,PR05,PR06,PR08,PR09,PR10,RT01,RT02,RT04,RT05,SA02,SA03,SA04,SS01,SS02,SS03,SS04,SS05,SS06
9984
RET=$(($RET + $?)) ; echo $MSG "DONE"
10085

10186
fi

pandas/core/arrays/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def astype(self, dtype: AstypeArg, copy: bool = True) -> ArrayLike:
566566
567567
Returns
568568
-------
569-
array : np.ndarray or ExtensionArray
569+
np.ndarray or pandas.api.extensions.ExtensionArray
570570
An ExtensionArray if dtype is ExtensionDtype,
571571
Otherwise a NumPy ndarray with 'dtype' for its dtype.
572572
"""
@@ -600,7 +600,7 @@ def isna(self) -> np.ndarray | ExtensionArraySupportsAnyAll:
600600
601601
Returns
602602
-------
603-
na_values : Union[np.ndarray, ExtensionArray]
603+
numpy.ndarray or pandas.api.extensions.ExtensionArray
604604
In most cases, this should return a NumPy ndarray. For
605605
exceptional cases like ``SparseArray``, where returning
606606
an ndarray would be expensive, an ExtensionArray may be
@@ -819,7 +819,7 @@ def dropna(self: ExtensionArrayT) -> ExtensionArrayT:
819819
820820
Returns
821821
-------
822-
valid : ExtensionArray
822+
pandas.api.extensions.ExtensionArray
823823
"""
824824
# error: Unsupported operand type for ~ ("ExtensionArray")
825825
return self[~self.isna()] # type: ignore[operator]
@@ -880,7 +880,7 @@ def unique(self: ExtensionArrayT) -> ExtensionArrayT:
880880
881881
Returns
882882
-------
883-
uniques : ExtensionArray
883+
pandas.api.extensions.ExtensionArray
884884
"""
885885
uniques = unique(self.astype(object))
886886
return self._from_sequence(uniques, dtype=self.dtype)
@@ -1088,7 +1088,7 @@ def factorize(
10881088
10891089
Returns
10901090
-------
1091-
repeated_array : %(klass)s
1091+
%(klass)s
10921092
Newly created %(klass)s with repeated elements.
10931093
10941094
See Also

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ def to_pydatetime(self) -> npt.NDArray[np.object_]:
10671067
10681068
Returns
10691069
-------
1070-
datetimes : ndarray[object]
1070+
numpy.ndarray
10711071
"""
10721072
return ints_to_pydatetime(self.asi8, tz=self.tz, reso=self._creso)
10731073

pandas/core/arrays/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def to_pytimedelta(self) -> npt.NDArray[np.object_]:
781781
782782
Returns
783783
-------
784-
timedeltas : ndarray[object]
784+
numpy.ndarray
785785
"""
786786
return ints_to_pytimedelta(self._ndarray)
787787

pandas/core/indexes/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6680,7 +6680,7 @@ def any(self, *args, **kwargs):
66806680
66816681
Returns
66826682
-------
6683-
any : bool or array-like (if axis is specified)
6683+
bool or array-like (if axis is specified)
66846684
A single element array-like may be converted to bool.
66856685
66866686
See Also
@@ -6724,7 +6724,7 @@ def all(self, *args, **kwargs):
67246724
67256725
Returns
67266726
-------
6727-
all : bool or array-like (if axis is specified)
6727+
bool or array-like (if axis is specified)
67286728
A single element array-like may be converted to bool.
67296729
67306730
See Also

pandas/core/indexes/multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ def drop( # type: ignore[override]
21642164
21652165
Returns
21662166
-------
2167-
dropped : MultiIndex
2167+
MultiIndex
21682168
"""
21692169
if level is not None:
21702170
return self._drop_from_level(codes, level, errors)

pandas/core/strings/accessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ def repeat(self, repeats):
14791479
14801480
Returns
14811481
-------
1482-
Series or Index of object
1482+
Series or pandas.Index
14831483
Series or Index of repeated string objects specified by
14841484
input parameter repeats.
14851485

pandas/io/formats/style.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ def export(self) -> dict[str, Any]:
20352035
20362036
Returns
20372037
-------
2038-
styles : dict
2038+
dict
20392039
20402040
See Also
20412041
--------

0 commit comments

Comments
 (0)