Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
# documentation
- gitpython # obtain contributors from git for whatsnew
- gitdb
- numpydoc < 1.2 # 2021-02-09 1.2dev breaking CI
- numpydoc
- pandas-dev-flaker=0.4.0
- pydata-sphinx-theme
- pytest-cython
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pycodestyle
pyupgrade
gitpython
gitdb
numpydoc < 1.2
numpydoc
pandas-dev-flaker==0.4.0
pydata-sphinx-theme
pytest-cython
Expand Down
21 changes: 17 additions & 4 deletions scripts/validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
import matplotlib
import matplotlib.pyplot as plt
import numpy
from numpydoc.docscrape import get_doc_object
from numpydoc.validate import (
Docstring,
Validator,
validate,
)

Expand Down Expand Up @@ -134,7 +135,17 @@ def get_api_items(api_doc_fd):
previous_line = line


class PandasDocstring(Docstring):
class PandasDocstring(Validator):
def __init__(self, func_name: str, doc_obj=None):
self.func_name = func_name
if doc_obj is None:
doc_obj = get_doc_object(Validator._load_obj(func_name))
super().__init__(doc_obj)

@property
def name(self):
return self.func_name

@property
def mentioned_private_classes(self):
return [klass for klass in PRIVATE_CLASSES if klass in self.raw_doc]
Expand Down Expand Up @@ -218,8 +229,10 @@ def pandas_validate(func_name: str):
dict
Information about the docstring and the errors found.
"""
doc = PandasDocstring(func_name)
result = validate(func_name)
func_obj = Validator._load_obj(func_name)
doc_obj = get_doc_object(func_obj)
doc = PandasDocstring(func_name, doc_obj)
result = validate(doc_obj)

mentioned_errs = doc.mentioned_private_classes
if mentioned_errs:
Expand Down