(
edges,
orientation=None,
edge_type=None,
min_length=1,
)
| 966 | |
| 967 | |
| 968 | def filter_edges( |
| 969 | edges, |
| 970 | orientation=None, |
| 971 | edge_type=None, |
| 972 | min_length=1, |
| 973 | ) -> list: |
| 974 | if orientation not in ("v", "h", None): |
| 975 | raise ValueError("Orientation must be 'v' or 'h'") |
| 976 | |
| 977 | def test(e) -> bool: |
| 978 | dim = "height" if e["orientation"] == "v" else "width" |
| 979 | et_correct = e["object_type"] == edge_type if edge_type is not None else True |
| 980 | orient_correct = orientation is None or e["orientation"] == orientation |
| 981 | return bool(et_correct and orient_correct and (e[dim] >= min_length)) |
| 982 | |
| 983 | return list(filter(test, edges)) |
| 984 | |
| 985 | |
| 986 | def cluster_list(xs, tolerance=0) -> list: |
no outgoing calls
no test coverage detected
searching dependent graphs…