From 1a2622cd2e389e80ec65cca24cc4a2017f0f5cae Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sat, 21 Feb 2026 00:31:42 -0600 Subject: [PATCH] ior --- src/daglib/set.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/daglib/set.py b/src/daglib/set.py index 3c13180..a306a1c 100644 --- a/src/daglib/set.py +++ b/src/daglib/set.py @@ -57,6 +57,17 @@ class DAGSet(MutableSet[T]): # --- 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]: # a += b => update/extend match other: