Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions aplex/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Author

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:


def wakeup(self):
"""To wake up form wait_return_item method."""
Expand Down Expand Up @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BaseAsyncPoolExecutor.map refactored with the following changes:



if compat.PY36:
# If statement with variable condition can not prevent Python3.5
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_inte_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestMap.test_map_return_order refactored with the following changes:


assert results == target

Expand Down
6 changes: 1 addition & 5 deletions tests/integration/test_inte_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestCancel.test_cancel_running refactored with the following changes:

while not concurrent_fut.running():
time.sleep(0.1)
assert not future.done()
Expand Down