(htmldir, *, verbose_print)
| 41 | |
| 42 | |
| 43 | def gather_ids(htmldir, *, verbose_print): |
| 44 | if not htmldir.joinpath('objects.inv').exists(): |
| 45 | raise ValueError(f'{htmldir!r} is not a Sphinx HTML output directory') |
| 46 | |
| 47 | if sys._is_gil_enabled: |
| 48 | pool = concurrent.futures.ProcessPoolExecutor() |
| 49 | else: |
| 50 | pool = concurrent.futures.ThreadPoolExecutor() |
| 51 | tasks = {} |
| 52 | for path in htmldir.glob('**/*.html'): |
| 53 | relative_path = path.relative_to(htmldir) |
| 54 | if '_static' in relative_path.parts: |
| 55 | continue |
| 56 | if 'whatsnew' in relative_path.parts: |
| 57 | continue |
| 58 | tasks[relative_path] = pool.submit(get_ids_from_file, path=path) |
| 59 | |
| 60 | ids_by_page = {} |
| 61 | for relative_path, future in tasks.items(): |
| 62 | verbose_print(relative_path) |
| 63 | ids = future.result() |
| 64 | ids_by_page[str(relative_path)] = ids |
| 65 | verbose_print(f' - {len(ids)} ids found') |
| 66 | |
| 67 | common = set.intersection(*ids_by_page.values()) |
| 68 | verbose_print(f'Filtering out {len(common)} common ids') |
| 69 | for key, page_ids in ids_by_page.items(): |
| 70 | ids_by_page[key] = sorted(page_ids - common) |
| 71 | |
| 72 | return ids_by_page |
| 73 | |
| 74 | |
| 75 | def do_check(baseline, checked, excluded, *, verbose_print): |
no test coverage detected
searching dependent graphs…