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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Apr 3, 2021

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

@sourcery-ai sourcery-ai bot requested a review from lunluen April 3, 2021 06:28
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:

Comment on lines -888 to +893
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)
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:

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:

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:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Apr 3, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.15%.

Quality metrics Before After Change
Complexity 9.05 🙂 8.94 🙂 -0.11 👍
Method Length 42.17 ⭐ 42.08 ⭐ -0.09 👍
Working memory 8.79 🙂 8.78 🙂 -0.01 👍
Quality 67.47% 🙂 67.62% 🙂 0.15% 👍
Other metrics Before After Change
Lines 1182 1178 -4
Changed files Quality Before Quality After Quality Change
aplex/executor.py 65.38% 🙂 65.47% 🙂 0.09% 👍
tests/integration/test_inte_executors.py 78.88% ⭐ 78.96% ⭐ 0.08% 👍
tests/integration/test_inte_futures.py 71.36% 🙂 72.91% 🙂 1.55% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
aplex/executor.py BaseWorkerMixin.run 40 ⛔ 427 ⛔ 13 😞 17.76% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
aplex/executor.py _HandlerThread._run 19 😞 127 😞 11 😞 46.45% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
aplex/executor.py _HandlerThread._handle_worker_state 13 🙂 139 😞 12 😞 48.11% 😞 Try splitting into smaller methods. Extract out complex expressions
aplex/executor.py BaseAsyncPoolExecutor.map 9 🙂 129 😞 13 😞 51.30% 🙂 Try splitting into smaller methods. Extract out complex expressions
aplex/executor.py BaseWorkerMixin.run.handle_submit_queue 12 🙂 90 🙂 13 😞 53.69% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants