MCPcopy Index your code
hub / github.com/python/cpython / gather_ids

Function gather_ids

Doc/tools/check-html-ids.py:43–72  ·  view source on GitHub ↗
(htmldir, *, verbose_print)

Source from the content-addressed store, hash-verified

41
42
43def 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
75def do_check(baseline, checked, excluded, *, verbose_print):

Callers 1

mainFunction · 0.85

Calls 11

submitMethod · 0.95
strFunction · 0.85
verbose_printFunction · 0.70
existsMethod · 0.45
joinpathMethod · 0.45
globMethod · 0.45
relative_toMethod · 0.45
itemsMethod · 0.45
resultMethod · 0.45
intersectionMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…