Closed nmiculinic closed 3 years ago
If I change pipe source to something like this it works, but it's kinda hacky
from typing import Callable
from aioreactive.core import AsyncObservable
from functools import wraps, partial
import importlib
import sys
import aioreactive.operators
def pipe(source: AsyncObservable, *args: Callable[[AsyncObservable], AsyncObservable]) -> AsyncObservable:
for op in args:
source = op(source)
return source
_this_module = sys.modules[__name__]
def setup(x):
def fn(*args, **kwargs):
ff = eval(f"aioreactive.operators.{x}")
return partial(ff, *args, **kwargs)
setattr(_this_module, x , fn)
for x in ["concat", "debounce", "delay", "filter", "map", ]:
setup(x)
Sorry, have done some refactoring so the correct way to import partially applied operators for the example is:
from aioreactive.core import Operators as op
Have fixed the example code in master.
upon running: AttributeError: module 'aioreactive.operators.pipe' has no attribute 'filter'