python的简单反应式扩展(rx)
rexpython的Python项目详细描述
====
rexpython
==
这是python实现的反应式扩展(rx),尽可能模仿rxjava2 api。
这是linq-free btw。目标是让它可以在运行中进行黑客攻击。
https://github.com/chexov/rexpython
installation
===
pip installrexpython
==
用法
=
=
将rexpython导入为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)
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.observate.from(wlist))
words=words.doonnext(lambda w:log.info(“words=%s%w)).doonerr(lambda err:log.error(“errrorr%s=”err))
value=words.tolist().blockingget()
rexpython
==
这是python实现的反应式扩展(rx),尽可能模仿rxjava2 api。
这是linq-free btw。目标是让它可以在运行中进行黑客攻击。
https://github.com/chexov/rexpython
installation
===
pip installrexpython
==
用法
=
=
将rexpython导入为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)
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.observate.from(wlist))
words=words.doonnext(lambda w:log.info(“words=%s%w)).doonerr(lambda err:log.error(“errrorr%s=”err))
value=words.tolist().blockingget()