Skip to content

Commit 2b1de5a

Browse files
author
czheo
committed
change default multitask syntax to use green threads
1 parent a767d27 commit 2b1de5a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

syntax_sugar/pipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __or__(self, rhs):
120120
raise SyntaxError('Bad pipe multiprocessing syntax.')
121121
poolsize = len(rhs)
122122
new_action = rhs[0]
123-
self.action = compose(partial(multithread, new_action, poolsize), self.action)
123+
self.action = compose(partial(multigreenthread, new_action, poolsize), self.action)
124124
elif isinstance(rhs, ProcessSyntax):
125125
self.action = compose(partial(multiprocess, rhs.func, rhs.poolsize), self.action)
126126
elif isinstance(rhs, ThreadSyntax):

tests/test_pipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ def test_pipe_multiprocess():
3333
assert pipe(100) | range | p[lambda x: x**2] * 3 | sorted | END == [x ** 2 for x in range(100)]
3434

3535
def test_pipe_multithread():
36-
assert pipe(100) | range | [lambda x: x**2] * 3 | sorted | END == [x ** 2 for x in range(100)]
3736
assert pipe(100) | range | t[lambda x: x**2] * 3 | sorted | END == [x ** 2 for x in range(100)]
3837

3938
def test_pipe_multigreenthread():
40-
assert pipe(100) | range | g[lambda x: x**2] * 3 | sorted | END == [x ** 2 for x in range(100)]
39+
assert pipe(10000) | range | [lambda x: x**2] * 10000 | sorted | END == [x ** 2 for x in range(10000)]
40+
assert pipe(10000) | range | g[lambda x: x**2] * 10000 | sorted | END == [x ** 2 for x in range(10000)]
4141

4242
def test_redirect():
4343
p = pipe(range(10)) | each(str) | ''.join

0 commit comments

Comments
 (0)