Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in the documentation ? #662

Open
tlebrize opened this issue Aug 26, 2022 · 1 comment
Open

Error in the documentation ? #662

tlebrize opened this issue Aug 26, 2022 · 1 comment

Comments

@tlebrize
Copy link

Describe the bug
One of the first example of the Get Started documentation fails with:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    reactivex.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon").pipe(
  File "./venv/lib/python3.8/site-packages/reactivex/observable/observable.py", line 237, in pipe
    return pipe_(self, *operators)
  File "./venv/lib/python3.8/site-packages/reactivex/pipe.py", line 214, in pipe
    return compose(*fns)(__value)
  File "./venv/lib/python3.8/site-packages/reactivex/pipe.py", line 87, in _compose
    return reduce(lambda obs, op: op(obs), operators, source)
  File "./venv/lib/python3.8/site-packages/reactivex/pipe.py", line 87, in <lambda>
    return reduce(lambda obs, op: op(obs), operators, source)
TypeError: 'Observable' object is not callable

The next example in the list also fails in the same way.

To Reproduce
Copy the code from the Custom Operator part of the documentation into a file and run it.

The line return rx.pipe( needs to be replaced with return reactivex.pipe( to work with the above imports.

Expected behavior
The code should run

Code or Screenshots

import reactivex
from reactivex import operators as ops

def length_more_than_5():
    return reactivex.pipe(
        ops.map(lambda s: len(s)),
        ops.filter(lambda i: i >= 5),
    )

reactivex.of("Alpha", "Beta", "Gamma", "Delta", "Epsilon").pipe(
    length_more_than_5()
).subscribe(lambda value: print("Received {0}".format(value)))

Additional context

  • OS: Ubuntu 22.04
  • RxPY: 4.0.4
  • Python: 3.8.10 and 3.10.4
@wuyuanyi135
Copy link

According to doc, pipe has been replaced by compose. This inconsistency in the doc also confused me for quite a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants