explicit pure/merge separation
This commit is contained in:
parent
b789b3c9f3
commit
2aa07d7f10
@ -12,7 +12,10 @@ class PureReduce(Reduce[Pure, Pure], Generic[Pure]):
|
||||
super().__init__(initial)
|
||||
|
||||
async def reduce(self, out: Pure, element: Pure) -> Pure:
|
||||
return self.merge(out, element)
|
||||
return self.pure(out, element)
|
||||
|
||||
def merge(self, left: Pure, right: Pure) -> Pure:
|
||||
return self.pure(left, right)
|
||||
|
||||
def pure(self, left: Pure, right: Pure) -> Pure:
|
||||
raise NotImplementedError
|
||||
|
@ -8,7 +8,7 @@ class VerifyReduce(PureReduce[bool]):
|
||||
def __init__(self):
|
||||
super().__init__(True)
|
||||
|
||||
def merge(self, left: bool, right: bool) -> bool:
|
||||
def pure(self, left: bool, right: bool) -> bool:
|
||||
assert_true(left)
|
||||
assert_true(right)
|
||||
return True
|
||||
|
@ -194,7 +194,7 @@ class VerifySubsetAction(
|
||||
class VerifySubsetReduce(
|
||||
PureReduce[CheckResult]
|
||||
):
|
||||
def merge(self, left: CheckResult, right: CheckResult) -> CheckResult:
|
||||
def pure(self, left: CheckResult, right: CheckResult) -> CheckResult:
|
||||
return max(left, right)
|
||||
|
||||
def loose(self) -> Reduce[CheckResult, CheckResult]:
|
||||
|
@ -16,7 +16,7 @@ __all__ = ('FlowCheque',)
|
||||
|
||||
|
||||
class SumReduce(PureReduce[int]):
|
||||
def merge(self, left: int, right: int) -> int:
|
||||
def pure(self, left: int, right: int) -> int:
|
||||
return left + right
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user