Skip to content

Commit 34e8efe

Browse files
jamescobonkerrTomAugspurger
authored andcommitted
DOC: resolve all GL03 docstring validation errors (#25525)
* Resolve GL03 docstring validation errors * Update code_checks.sh to validate GL03 * Remove newline concat in _build_option_description function * Resolve PR04 errors * Resolve remaining SS04 errors * Remove newline from end of _cnum_doc string * Move terminating quotes to same line to avoid line breaks
1 parent 26cfa28 commit 34e8efe

File tree

13 files changed

+8
-36
lines changed

13 files changed

+8
-36
lines changed

ci/code_checks.sh

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

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

248248
fi

pandas/_libs/tslibs/timedeltas.pyx

-1
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,6 @@ class Timedelta(_Timedelta):
11561156
Notes
11571157
-----
11581158
The ``.value`` attribute is always in ns.
1159-
11601159
"""
11611160
def __new__(cls, object value=_no_input, unit=None, **kwargs):
11621161
cdef _Timedelta td_base

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def f(self):
119119
return result
120120

121121
f.__name__ = name
122-
f.__doc__ = "\n{}\n".format(docstring)
122+
f.__doc__ = docstring
123123
return property(f)
124124

125125

pandas/core/arrays/sparse.py

-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
541541
3. ``data.dtype.fill_value`` if `fill_value` is None and `dtype`
542542
is not a ``SparseDtype`` and `data` is a ``SparseArray``.
543543
544-
545544
kind : {'integer', 'block'}, default 'integer'
546545
The type of storage for sparse locations.
547546

pandas/core/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,6 @@ def to_numpy(self, dtype=None, copy=False):
870870
871871
.. versionadded:: 0.24.0
872872
873-
874873
Parameters
875874
----------
876875
dtype : str or numpy.dtype, optional

pandas/core/config.py

-1
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ def _build_option_description(k):
651651
.format(rkey=d.rkey if d.rkey else ''))
652652
s += u(')')
653653

654-
s += '\n\n'
655654
return s
656655

657656

pandas/core/frame.py

-2
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,6 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
21842184
Convert URLs to HTML links.
21852185
21862186
.. versionadded:: 0.24.0
2187-
21882187
%(returns)s
21892188
See Also
21902189
--------
@@ -6027,7 +6026,6 @@ def unstack(self, level=-1, fill_value=None):
60276026
columns, considered measured variables (`value_vars`), are "unpivoted" to
60286027
the row axis, leaving just two non-identifier columns, 'variable' and
60296028
'value'.
6030-
60316029
%(versionadded)s
60326030
Parameters
60336031
----------

pandas/core/generic.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ def swaplevel(self, i=-2, j=-1, axis=0):
948948
949949
The indexes ``i`` and ``j`` are now optional, and default to
950950
the two innermost levels of the index.
951-
952951
"""
953952
axis = self._get_axis_number(axis)
954953
result = self.copy()
@@ -4951,9 +4950,7 @@ def pipe(self, func, *args, **kwargs):
49514950

49524951
_shared_docs['aggregate'] = dedent("""
49534952
Aggregate using one or more operations over the specified axis.
4954-
49554953
%(versionadded)s
4956-
49574954
Parameters
49584955
----------
49594956
func : function, str, list or dict
@@ -4983,17 +4980,13 @@ def pipe(self, func, *args, **kwargs):
49834980
* DataFrame : when DataFrame.agg is called with several functions
49844981
49854982
Return scalar, Series or DataFrame.
4986-
49874983
%(see_also)s
4988-
49894984
Notes
49904985
-----
49914986
`agg` is an alias for `aggregate`. Use the alias.
49924987
49934988
A passed user-defined-function will be passed a Series for evaluation.
4994-
4995-
%(examples)s
4996-
""")
4989+
%(examples)s""")
49974990

49984991
_shared_docs['transform'] = ("""
49994992
Call ``func`` on self producing a %(klass)s with transformed values
@@ -10307,7 +10300,7 @@ def _doc_parms(cls):
1030710300
1030810301
Returns
1030910302
-------
10310-
%(name1)s or %(name2)s (if level specified)
10303+
%(name1)s or %(name2)s (if level specified)\
1031110304
%(see_also)s
1031210305
%(examples)s\
1031310306
"""
@@ -10464,8 +10457,7 @@ def _doc_parms(cls):
1046410457
%(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
1046510458
%(name2)s.cumprod : Return cumulative product over %(name2)s axis.
1046610459
10467-
%(examples)s
10468-
"""
10460+
%(examples)s"""
1046910461

1047010462
_cummin_examples = """\
1047110463
Examples

pandas/core/groupby/base.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ class where members are defined.
126126
property_wrapper_template = \
127127
"""@property
128128
def %(name)s(self) :
129-
\"""
130-
%(doc)s
131-
\"""
129+
\"""%(doc)s\"""
132130
return self.__getattr__('%(name)s')"""
133131

134132
for name in whitelist:

pandas/core/groupby/groupby.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ class providing the base-class of operations.
221221
222222
Examples
223223
--------
224-
%(examples)s
225-
"""
224+
%(examples)s"""
226225

227226
_transform_template = """
228227
Call function producing a like-indexed %(klass)s on each group and
@@ -1106,9 +1105,7 @@ def mean(self, *args, **kwargs):
11061105
Returns
11071106
-------
11081107
pandas.Series or pandas.DataFrame
1109-
11101108
%(see_also)s
1111-
11121109
Examples
11131110
--------
11141111
>>> df = pd.DataFrame({'A': [1, 1, 2, 1, 2],
@@ -1564,9 +1561,7 @@ def nth(self, n, dropna=None):
15641561
dropna : None or str, optional
15651562
apply the specified dropna operation before counting which row is
15661563
the nth row. Needs to be None, 'any' or 'all'
1567-
15681564
%(see_also)s
1569-
15701565
Examples
15711566
--------
15721567
@@ -2139,9 +2134,7 @@ def head(self, n=5):
21392134
21402135
Essentially equivalent to ``.apply(lambda x: x.head(n))``,
21412136
except ignores as_index flag.
2142-
21432137
%(see_also)s
2144-
21452138
Examples
21462139
--------
21472140
@@ -2167,9 +2160,7 @@ def tail(self, n=5):
21672160
21682161
Essentially equivalent to ``.apply(lambda x: x.tail(n))``,
21692162
except ignores as_index flag.
2170-
21712163
%(see_also)s
2172-
21732164
Examples
21742165
--------
21752166

pandas/core/indexes/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -3104,7 +3104,6 @@ def reindex(self, target, method=None, level=None, limit=None,
31043104
Resulting index.
31053105
indexer : np.ndarray or None
31063106
Indices of output values in original index.
3107-
31083107
"""
31093108
# GH6552: preserve names when reindexing to non-named target
31103109
# (i.e. neither Index nor Series).

pandas/io/feather_format.py

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def read_feather(path, columns=None, use_threads=True):
110110
Returns
111111
-------
112112
type of object stored in file
113-
114113
"""
115114

116115
feather, pyarrow = _try_import()

pandas/plotting/_misc.py

-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
303303
Returns
304304
-------
305305
class:`matplotlip.axis.Axes`
306-
307306
"""
308307
from math import sqrt, pi
309308
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)