From a689896fe4a541ba55880db5dbe993a75ca4cd9c Mon Sep 17 00:00:00 2001 From: Kumaran Rajendhiran Date: Mon, 26 Aug 2024 16:56:21 +0530 Subject: [PATCH] Remove docs/api directory before running create_api_docs script (#1730) --- docs/create_api_docs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/create_api_docs.py b/docs/create_api_docs.py index fe070b4a8d..da84276487 100644 --- a/docs/create_api_docs.py +++ b/docs/create_api_docs.py @@ -1,6 +1,7 @@ """Create API documentation for a module.""" import itertools +import shutil from importlib import import_module from inspect import getmembers, isclass, isfunction from pathlib import Path @@ -295,6 +296,7 @@ def _generate_api_docs_for_module(root_path: Path, module_name: str) -> Tuple[st api_summary = _get_api_summary(members_with_submodules) api_root = root_path / "docs" / "en" / "api" + shutil.rmtree(api_root / module_name, ignore_errors=True) api_root.mkdir(parents=True, exist_ok=True) (api_root / ".meta.yml").write_text(API_META)