(data, node_id)
| 189 | return leaf_nodes |
| 190 | |
| 191 | def is_leaf_node(data, node_id): |
| 192 | # Helper function to find the node by its node_id |
| 193 | def find_node(data, node_id): |
| 194 | if isinstance(data, dict): |
| 195 | if data.get('node_id') == node_id: |
| 196 | return data |
| 197 | for key in data.keys(): |
| 198 | if 'nodes' in key: |
| 199 | result = find_node(data[key], node_id) |
| 200 | if result: |
| 201 | return result |
| 202 | elif isinstance(data, list): |
| 203 | for item in data: |
| 204 | result = find_node(item, node_id) |
| 205 | if result: |
| 206 | return result |
| 207 | return None |
| 208 | |
| 209 | # Find the node with the given node_id |
| 210 | node = find_node(data, node_id) |
| 211 | |
| 212 | # Check if the node is a leaf node |
| 213 | if node and not node.get('nodes'): |
| 214 | return True |
| 215 | return False |
| 216 | |
| 217 | def get_last_node(structure): |
| 218 | return structure[-1] |
nothing calls this directly
no test coverage detected