-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored master branch #9
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,7 +440,7 @@ def remove_closed_worker(self, worker_id): | |
return target # For subclass' super(). No need to find it again. | ||
|
||
def are_all_workers_closed(self): | ||
return False if self._workers else True | ||
return not self._workers | ||
|
||
def wakeup(self): | ||
"""To wake up form wait_return_item method.""" | ||
|
@@ -885,13 +885,13 @@ def map(self, | |
if not futures: | ||
return [] | ||
|
||
if self._awaitable: | ||
if not compat.PY36: | ||
return self._MapAsyncIterator(futures, end_time, self._loop) | ||
return self._map_async_gen(futures, end_time) | ||
else: | ||
if not self._awaitable: | ||
return self._map_gen(futures, end_time) | ||
|
||
if not compat.PY36: | ||
return self._MapAsyncIterator(futures, end_time, self._loop) | ||
return self._map_async_gen(futures, end_time) | ||
Comment on lines
-888
to
+893
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
if compat.PY36: | ||
# If statement with variable condition can not prevent Python3.5 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ def test_map_return_order(self, executor_factory, work, awaitable): | |
if awaitable: | ||
results = tuple(self._async_for_consumer(map_results)) | ||
else: | ||
results = tuple(j for j in map_results) | ||
results = tuple(map_results) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
assert results == target | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,7 @@ def test_cancel_running(self, executor_factory, awaitable, work): | |
executor = executor_factory(awaitable=awaitable) | ||
future = executor.submit(work) | ||
|
||
if awaitable: | ||
concurrent_fut = future._future | ||
else: | ||
concurrent_fut = future | ||
|
||
concurrent_fut = future._future if awaitable else future | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
while not concurrent_fut.running(): | ||
time.sleep(0.1) | ||
assert not future.done() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
BaseWorkerManager.are_all_workers_closed
refactored with the following changes:boolean-if-exp-identity
)