Skip to content

Commit ff517c0

Browse files
committed
fixup! DOC: Add ignore_functions option to validate_docstrings.py
1 parent 762c347 commit ff517c0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

ci/code_checks.sh

+2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8383
$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
8484
RET=$(($RET + $?)) ; echo $MSG "DONE"
8585

86+
MSG='Partially validate docstrings (RT02)' ; echo $MSG
8687
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT02 --ignore_functions=pandas.Series.align,pandas.Series.dt.total_seconds,pandas.Series.cat.rename_categories,pandas.Series.cat.reorder_categories,pandas.Series.cat.add_categories,pandas.Series.cat.remove_categories,pandas.Series.cat.remove_unused_categories,pandas.Index.all,pandas.Index.any,pandas.CategoricalIndex.rename_categories,pandas.CategoricalIndex.reorder_categories,pandas.CategoricalIndex.add_categories,pandas.CategoricalIndex.remove_categories,pandas.CategoricalIndex.remove_unused_categories,pandas.MultiIndex.drop,pandas.DatetimeIndex.to_pydatetime,pandas.TimedeltaIndex.to_pytimedelta,pandas.core.groupby.SeriesGroupBy.apply,pandas.core.groupby.DataFrameGroupBy.apply,pandas.io.formats.style.Styler.export,pandas.api.extensions.ExtensionArray.astype,pandas.api.extensions.ExtensionArray.dropna,pandas.api.extensions.ExtensionArray.isna,pandas.api.extensions.ExtensionArray.repeat,pandas.api.extensions.ExtensionArray.unique,pandas.DataFrame.align
88+
RET=$(($RET + $?)) ; echo $MSG "DONE"
8789

8890
fi
8991

scripts/validate_docstrings.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ def validate_all(prefix, ignore_deprecated=False, ignore_functions=None):
319319
result = {}
320320
seen = {}
321321

322-
if ignore_functions is None:
323-
ignore_functions = {}
324-
else:
325-
ignore_functions = set(ignore_functions)
322+
ignore_functions = set(ignore_functions or [])
326323

327324
base_path = pathlib.Path(__file__).parent.parent
328325
api_doc_fnames = pathlib.Path(base_path, "doc", "source", "reference")
@@ -332,9 +329,9 @@ def validate_all(prefix, ignore_deprecated=False, ignore_functions=None):
332329
api_items += list(get_api_items(f))
333330

334331
for func_name, _, section, subsection in api_items:
335-
if (
336-
prefix and not func_name.startswith(prefix)
337-
) or func_name in ignore_functions:
332+
if func_name in ignore_functions:
333+
continue
334+
if prefix and not func_name.startswith(prefix):
338335
continue
339336
doc_info = pandas_validate(func_name)
340337
if ignore_deprecated and doc_info["deprecated"]:
@@ -482,7 +479,7 @@ def main(func_name, prefix, errors, output_format, ignore_deprecated, ignore_fun
482479
"--ignore_functions",
483480
default=None,
484481
help="function or method to not validate "
485-
"(e.g. Pandas.DataFrame.head). "
482+
"(e.g. pandas.DataFrame.head). "
486483
"Inverse of the `function` argument.",
487484
)
488485

0 commit comments

Comments
 (0)