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 main branch #1

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Feb 5, 2023

Branch main 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 main branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from HaoZeke February 5, 2023 23:30
Comment on lines +90 to -95
self.calls += 1
## TODO: calls in multipoint may be more than once
if pos.ravel().shape[0] != self.limits.dims:
self.calls += 1
return self.multipoint(pos)
else:
self.calls += 1
Copy link
Author

Choose a reason for hiding this comment

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

Function ObjectiveFunction.__call__ refactored with the following changes:

Comment on lines +76 to +99
elif self.Accepter(diff, temperature):
self.AcceptMove()
self.PlotData.append(
EpochLine(
epoch=self.epoch,
temperature=temperature,
step=step,
pos=self.candidate.pos,
val=self.candidate.val,
accept=AcceptStates.MHACCEPT,
)
else:
self.RejectMove()
self.PlotData.append(
EpochLine(
epoch=self.epoch,
temperature=temperature,
step=step,
pos=self.candidate.pos,
val=self.candidate.val,
accept=AcceptStates.REJECT,
)
)
else:
self.RejectMove()
self.PlotData.append(
EpochLine(
epoch=self.epoch,
temperature=temperature,
step=step,
pos=self.candidate.pos,
val=self.candidate.val,
accept=AcceptStates.REJECT,
)
)
Copy link
Author

Choose a reason for hiding this comment

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

Function BoltzmannQuencher.__call__ refactored with the following changes:

Comment on lines -147 to +146
Temp = (self.c_param * self.Tinit) / (1 + np.log(epoch))
return Temp
return (self.c_param * self.Tinit) / (1 + np.log(epoch))
Copy link
Author

Choose a reason for hiding this comment

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

Function BoltzmannCooler.__call__ refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Feb 5, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.19 ⭐ 1.73 ⭐ -0.46 👍
Method Length 31.85 ⭐ 31.69 ⭐ -0.16 👍
Working memory 5.63 ⭐ 5.53 ⭐ -0.10 👍
Quality 82.96% 83.71% 0.75% 👍
Other metrics Before After Change
Lines 361 358 -3
Changed files Quality Before Quality After Quality Change
anneal/core/components.py 90.10% ⭐ 90.42% ⭐ 0.32% 👍
anneal/quenchers/boltzmann.py 75.56% ⭐ 76.66% ⭐ 1.10% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
anneal/quenchers/boltzmann.py BoltzmannQuencher.__call__ 12 🙂 242 ⛔ 11 😞 42.29% 😞 Try splitting into smaller methods. Extract out complex expressions
anneal/quenchers/boltzmann.py BoltzmannQuencher.__init__ 2 ⭐ 154 😞 10 😞 60.51% 🙂 Try splitting into smaller methods. 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!

Help us improve this quality report!

@HaoZeke HaoZeke closed this Feb 16, 2024
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.

1 participant