Skip to content

Commit 0a18b87

Browse files
committed
DOC: unpin numpydoc, fix validation script pandas-dev#39688
1 parent 54662c4 commit 0a18b87

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ dependencies:
116116
- natsort # DataFrame.sort_values
117117
- pip:
118118
- git+https://github.com/pydata/pydata-sphinx-theme.git@master
119-
- numpydoc < 1.2 # 2021-02-09 1.2dev breaking CI
119+
- git+https://github.com/numpy/numpydoc.git
120120
- pandas-dev-flaker==0.2.0

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ pyreadstat
7979
tabulate>=0.8.3
8080
natsort
8181
git+https://github.com/pydata/pydata-sphinx-theme.git@master
82-
numpydoc < 1.2
82+
git+https://github.com/numpy/numpydoc.git
8383
pandas-dev-flaker==0.2.0

scripts/validate_docstrings.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import doctest
1818
import glob
1919
import importlib
20+
from io import StringIO
2021
import json
2122
import os
2223
import subprocess
@@ -27,11 +28,6 @@
2728
Optional,
2829
)
2930

30-
try:
31-
from io import StringIO
32-
except ImportError:
33-
from cStringIO import StringIO
34-
3531
# Template backend makes matplotlib to not plot anything. This is useful
3632
# to avoid that plot windows are open from the doctests while running the
3733
# script. Setting here before matplotlib is loaded.
@@ -49,7 +45,8 @@
4945
import pandas # isort:skip
5046

5147
sys.path.insert(1, os.path.join(BASE_PATH, "doc", "sphinxext"))
52-
from numpydoc.validate import validate, Docstring # isort:skip
48+
from numpydoc.validate import validate, Validator # isort:skip
49+
from numpydoc.docscrape import get_doc_object
5350

5451

5552
PRIVATE_CLASSES = ["NDFrame", "IndexOpsMixin"]
@@ -145,7 +142,7 @@ def get_api_items(api_doc_fd):
145142
previous_line = line
146143

147144

148-
class PandasDocstring(Docstring):
145+
class PandasDocstring(Validator):
149146
@property
150147
def mentioned_private_classes(self):
151148
return [klass for klass in PRIVATE_CLASSES if klass in self.raw_doc]
@@ -213,7 +210,9 @@ def pandas_validate(func_name: str):
213210
dict
214211
Information about the docstring and the errors found.
215212
"""
216-
doc = PandasDocstring(func_name)
213+
func_obj = get_doc_object(Validator._load_obj(func_name))
214+
print(func_name, func_obj._obj)
215+
doc = PandasDocstring(func_obj)
217216
result = validate(func_name)
218217

219218
mentioned_errs = doc.mentioned_private_classes

0 commit comments

Comments
 (0)