simple Rx pipeline implementation
Project description
=========
RexPython
=========
This is Reactive Extensions (Rx) for Python implementation mimicing RxJava2 API as far as it can.
It is LINQ free btw. The goal to make it hackable on the go.
https://github.com/chexov/rexpython
Installation
============
pip install rexpython
=====
Usage
=====
import rexpython as rx
def on_subscribe(emitter):
emitter.setDisposable(ActionDisposable(lambda: sys.stdout.write("disposed")))
print ("subscribed")
for i in xrange(1, 3):
emitter.onNext(i)
time.sleep(1)
# emitter.onError(Exception("foo"))
emitter.onComplete()
frames = rx.Observable.create(lambda emitter: on_subscribe(emitter, video_url, 2))
mat_img = frames.map(featureextractor.FeatureExtractor.preprocess_image)
vect = mat_img.map(lambda img: fe.get_activations([img]))
words = vect.map(lambda vec: d.getWordsForBatch(vec, 40)) \
.flatMap(lambda wlist: rx.Observable.from_(wlist))
words = words.doOnNext(lambda w: log.info("words=%s" % w)).doOnError(lambda err: log.error("ERRRORRR %s" % err))
value = words.toList().blockingGet()
RexPython
=========
This is Reactive Extensions (Rx) for Python implementation mimicing RxJava2 API as far as it can.
It is LINQ free btw. The goal to make it hackable on the go.
https://github.com/chexov/rexpython
Installation
============
pip install rexpython
=====
Usage
=====
import rexpython as rx
def on_subscribe(emitter):
emitter.setDisposable(ActionDisposable(lambda: sys.stdout.write("disposed")))
print ("subscribed")
for i in xrange(1, 3):
emitter.onNext(i)
time.sleep(1)
# emitter.onError(Exception("foo"))
emitter.onComplete()
frames = rx.Observable.create(lambda emitter: on_subscribe(emitter, video_url, 2))
mat_img = frames.map(featureextractor.FeatureExtractor.preprocess_image)
vect = mat_img.map(lambda img: fe.get_activations([img]))
words = vect.map(lambda vec: d.getWordsForBatch(vec, 40)) \
.flatMap(lambda wlist: rx.Observable.from_(wlist))
words = words.doOnNext(lambda w: log.info("words=%s" % w)).doOnError(lambda err: log.error("ERRRORRR %s" % err))
value = words.toList().blockingGet()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rexpython-0.1.7.tar.gz
(7.0 kB
view details)
File details
Details for the file rexpython-0.1.7.tar.gz
.
File metadata
- Download URL: rexpython-0.1.7.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e74a7e1b30549a1c6144773bb0cd554e12ffd456a2cb25f4ae71576fbd985b4 |
|
MD5 | 405a5e26e69e205564142d6fc21001b8 |
|
BLAKE2b-256 | 22f3ced886bbd91e4e2eeed129e9857eb31ad9f45a14f6e3750237e3648315fb |