Skip to content

Commit

Permalink
DEPS/DOC: unpin numpydoc pandas-dev#39688 (pandas-dev#45830)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangchenli authored Feb 11, 2022
1 parent 769fc54 commit 0a7507d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
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

0 comments on commit 0a7507d

Please sign in to comment.