Cache throughout one single BFS level.
(
graph: gh.Graph,
)
| 808 | |
| 809 | |
| 810 | def cache_match( |
| 811 | graph: gh.Graph, |
| 812 | ) -> Callable[str, list[tuple[gm.Point, ...]]]: |
| 813 | """Cache throughout one single BFS level.""" |
| 814 | cache = {} |
| 815 | |
| 816 | def match_fn(name: str) -> list[tuple[gm.Point, ...]]: |
| 817 | if name in cache: |
| 818 | return cache[name] |
| 819 | |
| 820 | result = list(match_all(name, graph)) |
| 821 | cache[name] = result |
| 822 | return result |
| 823 | |
| 824 | return match_fn |
| 825 | |
| 826 | |
| 827 | def try_to_map( |
no outgoing calls
no test coverage detected