Return node(s) matching node name path :param node_list: list of nodes (output of get_doc_nodes) :param name_path: list of node names (corresponding to path)
(node_list, name_path)
| 551 | |
| 552 | |
| 553 | def find_node(node_list, name_path): |
| 554 | """Return node(s) matching node name path |
| 555 | |
| 556 | :param node_list: list of nodes (output of get_doc_nodes) |
| 557 | :param name_path: list of node names (corresponding to path) |
| 558 | """ |
| 559 | |
| 560 | def get_nodes(node_list, name, parents): |
| 561 | if parents: |
| 562 | nodes = [] |
| 563 | for parent in parents: |
| 564 | nodes.extend( |
| 565 | [ |
| 566 | p |
| 567 | for p in node_list |
| 568 | if p["path"].is_relative_to(parent["path"]) |
| 569 | and len(p["path"].relative_to(parent["path"]).parents) == 1 |
| 570 | and re.fullmatch(name, p["name"]) |
| 571 | and p not in nodes |
| 572 | ] |
| 573 | ) |
| 574 | else: |
| 575 | nodes = [p for p in node_list if re.fullmatch(name, p["name"])] |
| 576 | |
| 577 | return nodes |
| 578 | |
| 579 | parents = None |
| 580 | for name in name_path: |
| 581 | nodes = get_nodes(node_list, name, parents) |
| 582 | parents = nodes |
| 583 | |
| 584 | return nodes |
| 585 | |
| 586 | |
| 587 | def test_metadata(metadata_assy): |
nothing calls this directly
no test coverage detected