-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test cases, bugfix in reduce multicast operator, add flowable ope…
…rator mixin
- Loading branch information
1 parent
198c507
commit 735a3da
Showing
107 changed files
with
2,405 additions
and
1,626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import rxbp | ||
|
||
f1 = rxbp.range(10).pipe( | ||
rxbp.op.filter(lambda v: v%2), | ||
) | ||
|
||
f2 = rxbp.range(10) | ||
|
||
f3 = rxbp.match(f1, f2).pipe( | ||
rxbp.op.filter(lambda v: v[0]%5), | ||
) | ||
|
||
result = rxbp.match(f3, f2).run() | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import rxbp | ||
from rxbp.multicast.multicast import MultiCast | ||
|
||
|
||
def and_zip(multicast: MultiCast): | ||
return rxbp.multicast.zip( | ||
multicast, | ||
multicast, | ||
).pipe( | ||
rxbp.multicast.op.map(lambda t: t[0].zip(t[1])) | ||
) | ||
|
||
|
||
def merge_and_reduce(multicast: MultiCast): | ||
return rxbp.multicast.merge( | ||
multicast, | ||
multicast, | ||
).pipe( | ||
rxbp.multicast.op.reduce(), | ||
) | ||
|
||
|
||
result = rxbp.multicast.from_flowable(rxbp.range(10)).pipe( | ||
rxbp.multicast.op.lift(lambda m: m), | ||
rxbp.multicast.op.map(and_zip), | ||
rxbp.multicast.op.map(merge_and_reduce), | ||
rxbp.multicast.op.flat_map(lambda m: m), | ||
).to_flowable().run() | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from typing import Callable | ||
|
||
from rxbp.flowablebase import FlowableBase | ||
from rxbp.flowableopmixin import FlowableOpMixin | ||
|
||
|
||
class FlowableOperator: | ||
def __init__(self, func: Callable[[FlowableBase], FlowableBase]): | ||
def __init__(self, func: Callable[[FlowableOpMixin], FlowableOpMixin]): | ||
self.func = func | ||
|
||
def __call__(self, flowable: FlowableBase): | ||
def __call__(self, flowable: FlowableOpMixin): | ||
return self.func(flowable) |
Oops, something went wrong.