Fix missing async functions in Docs bug (#21760)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-08-21 16:44:43 +02:00 committed by GitHub
parent 554af34ece
commit 49dade4f89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -29,9 +29,11 @@ MKDOCS_YAML = PACKAGE_DIR.parent / "mkdocs.yml"
def extract_classes_and_functions(filepath: Path) -> tuple[list[str], list[str]]:
"""Extract class and function names from a given Python file."""
"""Extract top-level class and (a)sync function names from a Python file."""
content = filepath.read_text()
return (re.findall(r"(?:^|\n)class\s(\w+)(?:\(|:)", content), re.findall(r"(?:^|\n)def\s(\w+)\(", content))
classes = re.findall(r"(?:^|\n)class\s(\w+)(?:\(|:)", content)
functions = re.findall(r"(?:^|\n)(?:async\s+)?def\s(\w+)\(", content)
return classes, functions
def create_markdown(py_filepath: Path, module_path: str, classes: list[str], functions: list[str]) -> Path:

View File

@ -49,4 +49,8 @@ keywords: Ultralytics, data conversion, YOLO models, COCO, DOTA, YOLO bbox2segme
## ::: ultralytics.data.converter.convert_to_multispectral
<br><br><hr><br>
## ::: ultralytics.data.converter.convert_ndjson_to_yolo
<br><br>