|
39 | 39 | # Dictionary mapping internal module names to a readable string. so that we
|
40 | 40 | # can use the module name to logically group functions.
|
41 | 41 | function_groups = {
|
42 |
| - "dpctl._sycl_device_factory": "Device Selection Functions", |
43 | 42 | "dpctl._device_selection": "Device Selection Functions",
|
44 | 43 | "dpctl._sycl_queue_manager": "Queue Management Functions",
|
45 | 44 | "dpctl.tensor._ctors": "Array Construction",
|
@@ -237,13 +236,26 @@ def _group_functions(mod):
|
237 | 236 | obj,
|
238 | 237 | ]
|
239 | 238 | else:
|
240 |
| - try: |
241 |
| - flist = groups["Other Functions"] |
242 |
| - flist.append(obj) |
243 |
| - except KeyError: |
244 |
| - groups["Other Functions"] = [ |
245 |
| - obj, |
246 |
| - ] |
| 239 | + # Special case for _sycl_device_factory |
| 240 | + if ( |
| 241 | + obj.__module__ == "dpctl._sycl_device_factory" |
| 242 | + and "select_" in obj.__name__ |
| 243 | + ): |
| 244 | + try: |
| 245 | + flist = groups["Device Selection Functions"] |
| 246 | + flist.append(obj) |
| 247 | + except KeyError: |
| 248 | + groups["Device Selection Functions"] = [ |
| 249 | + obj, |
| 250 | + ] |
| 251 | + else: |
| 252 | + try: |
| 253 | + flist = groups["Other Functions"] |
| 254 | + flist.append(obj) |
| 255 | + except KeyError: |
| 256 | + groups["Other Functions"] = [ |
| 257 | + obj, |
| 258 | + ] |
247 | 259 | return groups
|
248 | 260 |
|
249 | 261 |
|
@@ -455,6 +467,8 @@ def _write_classes_summary_table(o, mod):
|
455 | 467 | classes.append(cls)
|
456 | 468 | class_names.append(mem_tup[0])
|
457 | 469 | if classes:
|
| 470 | + _write_line(o, ".. _" + mod.__name__.lower() + "_classes:") |
| 471 | + _write_empty_line(o) |
458 | 472 | _write_underlined(o, "Classes", "-")
|
459 | 473 | _write_empty_line(o)
|
460 | 474 | _write_hidden_toc(output, class_names)
|
@@ -511,11 +525,35 @@ def _write_functions_summary_table(o, mod, fnobj_list):
|
511 | 525 | _write_empty_line(o)
|
512 | 526 |
|
513 | 527 | def _write_function_groups_summary(o, mod, groups):
|
| 528 | + |
514 | 529 | for group in groups:
|
| 530 | + if group != "Other Functions": |
| 531 | + _write_line( |
| 532 | + o, |
| 533 | + ".. _" |
| 534 | + + mod.__name__.lower() |
| 535 | + + "_" |
| 536 | + + group.lower().replace(" ", "_") |
| 537 | + + ":", |
| 538 | + ) |
| 539 | + _write_empty_line(o) |
| 540 | + _write_underlined(o, group, "-") |
| 541 | + _write_empty_line(o) |
| 542 | + _write_functions_summary_table(o, mod, groups[group]) |
| 543 | + |
| 544 | + # We want to write "Other Functions" in the end always |
| 545 | + try: |
| 546 | + other_fns = groups["Other Functions"] |
| 547 | + _write_line( |
| 548 | + o, |
| 549 | + ".. _" + mod.__name__.lower() + "_other_functions:", |
| 550 | + ) |
515 | 551 | _write_empty_line(o)
|
516 |
| - _write_underlined(o, group, "-") |
| 552 | + _write_underlined(o, "Other Functions", "-") |
517 | 553 | _write_empty_line(o)
|
518 |
| - _write_functions_summary_table(o, mod, groups[group]) |
| 554 | + _write_functions_summary_table(o, mod, other_fns) |
| 555 | + except KeyError: |
| 556 | + pass |
519 | 557 |
|
520 | 558 | mod = _get_module(module)
|
521 | 559 |
|
|
0 commit comments