docs: remove obsolete quantization example tests

Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Hongsheng Liu committed 2026-08-10 17:52:41 +08:00
1 parent 13731101ab
commit 8c994e57fd
2 files changed
+1 -156

No files matched your search

+1 -45
View File
@@ -41,17 +41,6 @@ GENERAL_EXAMPLE_SLUGS = frozenset(
}
)
# Generated example pages keep their source-derived URLs even when their
# navigation category changes. Quantization helpers are feature documentation,
# not user-serving examples, so keep them under the existing Features /
# Quantization section instead of creating a second top-level Quantization
# category under Examples.
EXAMPLE_NAV_TARGETS = {
"quantization": "quantization",
}
GENERATED_QUANTIZATION_EXAMPLES_TITLE = "Generated Examples"
def load_model_display_names() -> dict[str, str]:
try:
with open(MODEL_DISPLAY_NAMES_FILE, encoding="utf-8") as f:
@@ -382,12 +371,9 @@ def update_nav_file(examples: list[Example]):
items.append({example.nav_title: rel_path.as_posix()})
return items
# Build the new Examples section - start with preserved items. Categories
# not explicitly routed elsewhere retain the historical Examples behavior.
# Build the new Examples section - start with preserved items.
examples_section = preserved_items.copy()
for category in sorted(examples_by_category.keys()):
if EXAMPLE_NAV_TARGETS.get(category, "examples") != "examples":
continue
items = category_items(category)
if items:
category_title = fix_case(category.replace("_", " ").title())
@@ -396,36 +382,6 @@ def update_nav_file(examples: list[Example]):
# Update the nav structure
nav_list[user_guide_idx]["User Guide"][examples_idx]["Examples"] = examples_section
features_content = next(
(item["Features"] for item in user_guide_content if isinstance(item, dict) and "Features" in item),
None,
)
quantization_content = None
if isinstance(features_content, list):
quantization_content = next(
(item["Quantization"] for item in features_content if isinstance(item, dict) and "Quantization" in item),
None,
)
if isinstance(quantization_content, list):
# Remove only the group owned by this hook so repeated builds are
# idempotent and hand-authored Quantization navigation is retained.
quantization_content[:] = [
item
for item in quantization_content
if not (isinstance(item, dict) and GENERATED_QUANTIZATION_EXAMPLES_TITLE in item)
]
quantization_examples = examples_by_category.get("quantization")
if quantization_examples:
if not isinstance(quantization_content, list):
logger.warning(
"Could not find 'User Guide' -> 'Features' -> 'Quantization' section; "
"omitting generated quantization examples from navigation"
)
else:
quantization_content.append({GENERATED_QUANTIZATION_EXAMPLES_TITLE: category_items("quantization")})
# Write back to file
nav_data["nav"] = nav_list
with open(NAV_FILE, "w", encoding="utf-8") as f: