Skip to content

Commit 783f8e9

Browse files
committed
add generator scripts
1 parent fb9ded6 commit 783f8e9

File tree

5 files changed

+716
-334
lines changed

5 files changed

+716
-334
lines changed

docs/_generators/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def get_all_test_functions() -> Dict[str, List[Type]]:
122122
multimodal_weak,
123123
separable,
124124
)
125+
from surfaces.test_functions.bbob._base_bbob import BBOBFunction
125126

126127
bbob_funcs = []
127128
for module in [
@@ -131,11 +132,18 @@ def get_all_test_functions() -> Dict[str, List[Type]]:
131132
multimodal_adequate,
132133
multimodal_weak,
133134
]:
134-
if hasattr(module, "__all__"):
135-
for name in module.__all__:
136-
cls = getattr(module, name, None)
137-
if cls is not None and inspect.isclass(cls):
138-
bbob_funcs.append(cls)
135+
# Find classes that are subclasses of BBOBFunction
136+
for name in dir(module):
137+
if name.startswith("_"):
138+
continue
139+
cls = getattr(module, name, None)
140+
if (
141+
cls is not None
142+
and inspect.isclass(cls)
143+
and issubclass(cls, BBOBFunction)
144+
and cls is not BBOBFunction
145+
):
146+
bbob_funcs.append(cls)
139147
categories["bbob"] = bbob_funcs
140148
except ImportError:
141149
categories["bbob"] = []

docs/_generators/generate_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
if str(PROJECT_ROOT) not in sys.path:
3131
sys.path.insert(0, str(PROJECT_ROOT))
3232

33-
from docs._generators.config import GENERATED_DIR, ensure_directories
33+
from docs._generators.config import GENERATED_DIR, ensure_directories # noqa: E402
3434

3535

3636
def clean_generated():

docs/_generators/generate_catalogs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
python -m docs._generators.generate_catalogs
2424
"""
2525

26-
from pathlib import Path
2726
from typing import List, Type
2827

2928
from . import extract_metadata, format_value, get_all_test_functions

0 commit comments

Comments
 (0)