MCPcopy
hub / github.com/AstrBotDevs/AstrBot / _extract_top_level_modules

Function _extract_top_level_modules

astrbot/core/utils/pip_installer.py:487–501  ·  view source on GitHub ↗
(
    distribution: importlib_metadata.Distribution,
)

Source from the content-addressed store, hash-verified

485
486
487def _extract_top_level_modules(
488 distribution: importlib_metadata.Distribution,
489) -> set[str]:
490 try:
491 text = distribution.read_text("top_level.txt") or ""
492 except Exception:
493 return set()
494
495 modules: set[str] = set()
496 for line in text.splitlines():
497 candidate = line.strip()
498 if not candidate or candidate.startswith("#"):
499 continue
500 modules.add(candidate)
501 return modules
502
503
504def _collect_candidate_modules(

Callers 1

Calls 4

setFunction · 0.85
startswithMethod · 0.80
addMethod · 0.80
read_textMethod · 0.45

Tested by

no test coverage detected