Skip to content

Commit 42fade9

Browse files
Merge branch 'main' into mlir/pr17-strings-getitem
2 parents 20d0aa8 + aa9e398 commit 42fade9

185 files changed

Lines changed: 15134 additions & 3120 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/update-pandas-testing/SKILL.md‎

Lines changed: 183 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""
5+
Collect the public pandas API documented in the pandas API reference.
6+
7+
Every name listed in an ``autosummary`` directive, or declared by a Python
8+
object directive such as ``.. type::``, in ``doc/source/reference/*.rst`` is
9+
joined with the active ``currentmodule`` and printed as a fully qualified
10+
name, one per line, sorted.
11+
12+
Usage:
13+
python collect_public_api.py <path to pandas repository> > public_api.txt
14+
"""
15+
16+
import argparse
17+
import re
18+
from collections.abc import Iterator
19+
from pathlib import Path
20+
21+
CURRENTMODULE = re.compile(r"^\s*\.\. currentmodule:: (?P<module>\S+)\s*$")
22+
AUTOSUMMARY = re.compile(r"^(?P<indent>\s*)\.\. autosummary::\s*$")
23+
ENTRY = re.compile(r"^~?(?P<name>[\w.]+)$")
24+
OBJECT_DIRECTIVE = re.compile(
25+
r"\.\. (?:py:)?(?:attribute|class|data|exception|function|method|type)::"
26+
r"\s+(?P<name>[\w.]+)"
27+
)
28+
29+
30+
def indentation(line: str) -> int:
31+
return len(line) - len(line.lstrip())
32+
33+
34+
def iter_public_names(rst_file: Path) -> Iterator[str]:
35+
module = "pandas"
36+
block_indent = None
37+
for line in rst_file.read_text().splitlines():
38+
if block_indent is not None:
39+
stripped = line.strip()
40+
if not stripped:
41+
continue
42+
if indentation(line) > block_indent:
43+
if stripped.startswith(":"):
44+
continue
45+
if (match := ENTRY.match(stripped)) is not None:
46+
yield f"{module}.{match['name']}"
47+
continue
48+
block_indent = None
49+
if (match := CURRENTMODULE.match(line)) is not None:
50+
module = match["module"]
51+
elif (match := AUTOSUMMARY.match(line)) is not None:
52+
block_indent = len(match["indent"])
53+
elif (match := OBJECT_DIRECTIVE.search(line)) is not None:
54+
yield f"{module}.{match['name']}"
55+
56+
57+
def main() -> None:
58+
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
59+
parser.add_argument(
60+
"pandas_repo", type=Path, help="Path to a pandas repository"
61+
)
62+
args = parser.parse_args()
63+
reference_dir = args.pandas_repo / "doc" / "source" / "reference"
64+
rst_files = sorted(reference_dir.glob("*.rst"))
65+
if not rst_files:
66+
parser.error(f"No .rst files found in {reference_dir}")
67+
names = sorted(
68+
{name for rst in rst_files for name in iter_public_names(rst)}
69+
)
70+
print("\n".join(names)) # noqa: T201
71+
72+
73+
if __name__ == "__main__":
74+
main()

0 commit comments

Comments
 (0)