MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / list_modules

Function list_modules

src/ifcedit/ifcedit/discover.py:36–67  ·  view source on GitHub ↗

List all API modules with their function counts and descriptions. Returns a list of dicts: [{"module": "root", "description": "...", "functions": [...], "count": 4}, ...]

()

Source from the content-addressed store, hash-verified

34
35
36def list_modules() -> list[dict]:
37 """List all API modules with their function counts and descriptions.
38
39 Returns a list of dicts: [{"module": "root", "description": "...", "functions": [...], "count": 4}, ...]
40 """
41 api_path = _api_package_path()
42 modules = []
43 for child in sorted(api_path.iterdir()):
44 if not child.is_dir() or child.name.startswith("_"):
45 continue
46 init_file = child / "__init__.py"
47 if not init_file.exists():
48 continue
49 try:
50 mod = importlib.import_module(f"ifcopenshell.api.{child.name}")
51 except Exception:
52 continue
53 all_names = getattr(mod, "__all__", [])
54 if not all_names:
55 continue
56 description = ""
57 if mod.__doc__:
58 description = mod.__doc__.strip().split("\n")[0]
59 modules.append(
60 {
61 "module": child.name,
62 "description": description,
63 "functions": list(all_names),
64 "count": len(all_names),
65 }
66 )
67 return modules
68
69
70def list_functions(module: str) -> list[dict]:

Callers 6

ifc_listMethod · 0.90
test_returns_listMethod · 0.90
test_module_structureMethod · 0.90
cmd_listFunction · 0.90

Calls 3

_api_package_pathFunction · 0.85
splitMethod · 0.80
appendMethod · 0.45

Tested by 4

test_returns_listMethod · 0.72
test_module_structureMethod · 0.72