Retrieve information about the module without importing it. Cache to avoid redundant filesystem reads.
(path: Path)
| 88 | |
| 89 | @cache |
| 90 | def _module_facts(path: Path) -> _ModuleFacts: |
| 91 | """ |
| 92 | Retrieve information about the module without importing it. |
| 93 | Cache to avoid redundant filesystem reads. |
| 94 | """ |
| 95 | try: |
| 96 | source = path.read_text(encoding="utf-8") |
| 97 | except OSError: |
| 98 | return _ModuleFacts(frozenset(), False) |
| 99 | return _ModuleFacts( |
| 100 | frozenset(_CATEGORY_RE.findall(source)), |
| 101 | _HAS_TESTS_RE.search(source) is not None, |
| 102 | ) |
| 103 | |
| 104 | |
| 105 | def _plural(n: int, noun: str) -> str: |
no test coverage detected