Skip to content

Commit f342836

Browse files
fangchenliphofl
authored andcommitted
DEPS/DOC: unpin numpydoc pandas-dev#39688 (pandas-dev#45830)
1 parent 6555941 commit f342836

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies:
3232
# documentation
3333
- gitpython # obtain contributors from git for whatsnew
3434
- gitdb
35-
- numpydoc < 1.2 # 2021-02-09 1.2dev breaking CI
35+
- numpydoc
3636
- pandas-dev-flaker=0.4.0
3737
- pydata-sphinx-theme
3838
- pytest-cython

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pycodestyle
1818
pyupgrade
1919
gitpython
2020
gitdb
21-
numpydoc < 1.2
21+
numpydoc
2222
pandas-dev-flaker==0.4.0
2323
pydata-sphinx-theme
2424
pytest-cython

scripts/validate_docstrings.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
import matplotlib
3030
import matplotlib.pyplot as plt
3131
import numpy
32+
from numpydoc.docscrape import get_doc_object
3233
from numpydoc.validate import (
33-
Docstring,
34+
Validator,
3435
validate,
3536
)
3637

@@ -134,7 +135,17 @@ def get_api_items(api_doc_fd):
134135
previous_line = line
135136

136137

137-
class PandasDocstring(Docstring):
138+
class PandasDocstring(Validator):
139+
def __init__(self, func_name: str, doc_obj=None):
140+
self.func_name = func_name
141+
if doc_obj is None:
142+
doc_obj = get_doc_object(Validator._load_obj(func_name))
143+
super().__init__(doc_obj)
144+
145+
@property
146+
def name(self):
147+
return self.func_name
148+
138149
@property
139150
def mentioned_private_classes(self):
140151
return [klass for klass in PRIVATE_CLASSES if klass in self.raw_doc]
@@ -218,8 +229,10 @@ def pandas_validate(func_name: str):
218229
dict
219230
Information about the docstring and the errors found.
220231
"""
221-
doc = PandasDocstring(func_name)
222-
result = validate(func_name)
232+
func_obj = Validator._load_obj(func_name)
233+
doc_obj = get_doc_object(func_obj)
234+
doc = PandasDocstring(func_name, doc_obj)
235+
result = validate(doc_obj)
223236

224237
mentioned_errs = doc.mentioned_private_classes
225238
if mentioned_errs:

0 commit comments

Comments
 (0)