Skip to content

Commit

Permalink
Use ops instead of _ for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrattli committed Jan 20, 2019
1 parent ed8b722 commit 99efc91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions examples/autocomplete/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from tornado.escape import json_decode
from tornado import ioloop

from rx import operators as _
from rx import operators as ops
from rx.subjects import Subject
from rx.concurrency import IOLoopScheduler

Expand Down Expand Up @@ -50,11 +50,11 @@ def open(self):

# Get all distinct key up events from the input and only fire if long enough and distinct
searcher = self.stream.pipe(
_.map(lambda x: x["term"]),
_.filter(lambda text: len(text) > 2), # Only if the text is longer than 2 characters
_.debounce(0.750), # Pause for 750ms
_.distinct_until_changed(), # Only if the value has changed
_.flat_map_latest(search_wikipedia)
ops.map(lambda x: x["term"]),
ops.filter(lambda text: len(text) > 2), # Only if the text is longer than 2 characters
ops.debounce(0.750), # Pause for 750ms
ops.distinct_until_changed(), # Only if the value has changed
ops.flat_map_latest(search_wikipedia)
)

def send_response(x):
Expand Down
12 changes: 6 additions & 6 deletions examples/autocomplete/autocomplete_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from tornado.web import RequestHandler, StaticFileHandler, Application, url
from tornado.websocket import WebSocketHandler

from rx import operators as _
from rx import operators as ops
from rx.concurrency import AsyncIOScheduler
from rx.subjects import Subject

Expand Down Expand Up @@ -52,11 +52,11 @@ def open(self):

# Get all distinct key up events from the input and only fire if long enough and distinct
searcher = self.subject.pipe(
_.map(lambda x: x["term"]),
_.filter(lambda text: len(text) > 2), # Only if the text is longer than 2 characters
_.debounce(0.750), # Pause for 750ms
_.distinct_until_changed(), # Only if the value has changed
_.flat_map_latest(search_wikipedia)
ops.map(lambda x: x["term"]),
ops.filter(lambda text: len(text) > 2), # Only if the text is longer than 2 characters
ops.debounce(0.750), # Pause for 750ms
ops.distinct_until_changed(), # Only if the value has changed
ops.flat_map_latest(search_wikipedia)
)

def send_response(x):
Expand Down

0 comments on commit 99efc91

Please sign in to comment.