ior
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user