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

🗑️ [TEST-PR] Wip/projects against d2b297 (Sourcery refactored) #830

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Sep 18, 2021

Pull Request #829 refactored by Sourcery.

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

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

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 wip/projects_against_d2b297 branch, then run:

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

Help us improve this pull request!

model_dict = {}
model_dict["default-megacomplex"] = self.default_megacomplex

model_dict = {'default-megacomplex': self.default_megacomplex}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Model.as_dict refactored with the following changes:

@@ -55,7 +55,6 @@ def __post_init__(self):
self.folder = self.file.parent
if isinstance(self.folder, str):
self.folder = Path(self.folder)
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Project.__post_init__ refactored with the following changes:

Comment on lines -81 to +80
name = name if name else project_folder.name
name = name or project_folder.name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Project.create refactored with the following changes:

Comment on lines -300 to +305
if isinstance(parameters, dict) and len(parameters) != 0:
raise ModelError(
"The root parameter group cannot contain both groups and parameters."
)
elif isinstance(parameters, dict):
parameters = []
if isinstance(parameters, dict):
if len(parameters) != 0:
raise ModelError(
"The root parameter group cannot contain both groups and parameters."
)
else:
parameters = []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Project.generate_parameters refactored with the following changes:

new_scheme = replace(self.scheme, parameters=self.optimized_parameters)
return new_scheme
return replace(self.scheme, parameters=self.optimized_parameters)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function Result.get_scheme refactored with the following changes:

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch glotaran/pyglotaran/sourcery/wip/projects_against_d2b297

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Sep 18, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 5.41 ⭐ 5.42 ⭐ 0.01 👎
Method Length 44.80 ⭐ 44.63 ⭐ -0.17 👍
Working memory 7.39 🙂 7.39 🙂 0.00
Quality 74.95% 🙂 74.97% 🙂 0.02% 👍
Other metrics Before After Change
Lines 546 543 -3
Changed files Quality Before Quality After Quality Change
glotaran/model/model.py 74.57% 🙂 74.61% 🙂 0.04% 👍
glotaran/project/result.py 76.39% ⭐ 76.32% ⭐ -0.07% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/project/result.py Result.markdown 6 ⭐ 173 😞 13 😞 49.52% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/model/model.py Model.markdown 10 🙂 118 🙂 10 😞 56.92% 🙂 Extract out complex expressions
glotaran/model/model.py Model._add_dict_items 10 🙂 97 🙂 11 😞 57.81% 🙂 Extract out complex expressions
glotaran/model/model.py Model._add_list_items 9 🙂 76 🙂 10 😞 63.66% 🙂 Extract out complex expressions
glotaran/model/model.py Model.is_groupable 2 ⭐ 79 🙂 11 😞 68.11% 🙂 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!

@jsnel
Copy link
Member

jsnel commented Sep 18, 2021

Sourcery stop targeting draft PRs!

@jsnel jsnel closed this Sep 18, 2021
@sonarcloud
Copy link

sonarcloud bot commented Sep 18, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell C 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 18, 2021

This pull request fixes 1 alert when merging 2b73bc4 into 477e550 - view on LGTM.com

fixed alerts:

  • 1 for Unnecessary pass

@github-actions
Copy link
Contributor

github-actions bot commented Sep 18, 2021

Benchmark is done. Checkout the benchmark result page.
Benchmark differences below 5% might be due to CI noise.

Benchmark diff

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [dc00e6da]       [2b73bc47]
     <v0.4.0>                   
-      48.2±0.5ms       34.8±0.6ms     0.72  BenchmarkOptimize.time_optimize(False, False, False)
-         266±6ms         41.2±1ms     0.16  BenchmarkOptimize.time_optimize(False, False, True)
-      70.7±0.9ms         58.6±1ms     0.83  BenchmarkOptimize.time_optimize(False, True, False)
       71.9±0.3ms        62.9±20ms    ~0.87  BenchmarkOptimize.time_optimize(False, True, True)
       48.6±0.7ms         47.3±1ms     0.97  BenchmarkOptimize.time_optimize(True, False, False)
-         267±4ms         151±60ms     0.57  BenchmarkOptimize.time_optimize(True, False, True)
       69.5±0.7ms         72.2±2ms     1.04  BenchmarkOptimize.time_optimize(True, True, False)
       71.8±0.7ms        76.8±40ms     1.07  BenchmarkOptimize.time_optimize(True, True, True)
             181M             178M     0.99  IntegrationTwoDatasets.peakmem_create_result
             200M             196M     0.98  IntegrationTwoDatasets.peakmem_optimize
-         224±3ms          178±2ms     0.80  IntegrationTwoDatasets.time_create_result
       4.71±0.04s       1.36±0.04s    ~0.29  IntegrationTwoDatasets.time_optimize

@s-weigand s-weigand deleted the sourcery/wip/projects_against_d2b297 branch April 3, 2022 20:15
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