MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / filter_edges

Function filter_edges

src/table.py:968–983  ·  view source on GitHub ↗
(
    edges,
    orientation=None,
    edge_type=None,
    min_length=1,
)

Source from the content-addressed store, hash-verified

966
967
968def 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
986def cluster_list(xs, tolerance=0) -> list:

Callers 1

get_edgesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…