This commit is contained in:
John Lancaster
2026-02-21 00:31:42 -06:00
parent 9074d4b4a2
commit 1a2622cd2e

View File

@@ -57,6 +57,17 @@ class DAGSet(MutableSet[T]):
# --- in-place operator support --- # --- in-place operator support ---
def __ior__(self, other: Iterable[T]) -> DAGSet[T]:
# a |= b => union update
match other:
case str():
other = {other}
case Iterable():
other = set(other)
case _:
other = {other}
return super().__ior__(other)
def __iadd__(self, other: Iterable[T]) -> DAGSet[T]: def __iadd__(self, other: Iterable[T]) -> DAGSet[T]:
# a += b => update/extend # a += b => update/extend
match other: match other: