This commit is contained in:
Nuno Campos
2025-03-31 18:46:51 -07:00
parent 94fa46f9fa
commit e85b7e6cd9
3 changed files with 8 additions and 6 deletions
@@ -30,7 +30,8 @@ class AnyValue(Generic[Value], BaseChannel[Value, Value, Value]):
"""The type of the update received by the channel."""
return self.typ
def copy(self):
def copy(self) -> Self:
"""Return a copy of the channel."""
empty = self.__class__(self.typ, self.key)
empty.value = self.value
return empty
+2 -1
View File
@@ -66,7 +66,8 @@ class BinaryOperatorAggregate(Generic[Value], BaseChannel[Value, Value, Value]):
"""The type of the update received by the channel."""
return self.typ
def copy(self):
def copy(self) -> Self:
"""Return a copy of the channel."""
empty = self.__class__(self.typ, self.operator)
empty.key = self.key
empty.value = self.value
+4 -4
View File
@@ -192,11 +192,11 @@ def local_read(
local_channels: dict[str, BaseChannel] = {}
for k in channels:
if k in updated:
c = channels[k].copy()
c.update(updated[k])
cc = channels[k].copy()
cc.update(updated[k])
else:
c = channels[k]
local_channels[k] = c
cc = channels[k]
local_channels[k] = cc
# read fresh values
values = read_channels(local_channels, select)
else: