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

Refactor/save result (Sourcery refactored) #875

Closed
wants to merge 22 commits into from
Closed

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Oct 19, 2021

Pull Request #874 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/glotaran/pyglotaran pull/874/head
    git merge --ff-only FETCH_HEAD
    git push

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:

Help us improve this pull request!

joernweissenborn and others added 22 commits October 13, 2021 18:26
This is mainly a reminder that we need to properly deprecate the missing attributes.
This bug led to result creation crashing, because of missing labels.

Co-authored-by: Jörn Weißenborn <[email protected]>
It was nice to see how much time and memory the result creation needed compared to the whole optimization, but loading a pickeled OptimizeResult wasn't nice from the start.
Whith the changes in this PR and the overhead to keep benchamarks working across versions, IMHO the extra information about result creation details isn't worth it.
@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch glotaran/pyglotaran/sourcery/pull-874

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Oct 19, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.05 ⭐ 2.98 ⭐ -0.07 👍
Method Length 57.62 ⭐ 55.56 ⭐ -2.06 👍
Working memory 8.32 🙂 8.13 🙂 -0.19 👍
Quality 69.57% 🙂 70.32% 🙂 0.75% 👍
Other metrics Before After Change
Lines 6276 6053 -223
Changed files Quality Before Quality After Quality Change
benchmark/benchmarks/integration/ex_two_datasets/benchmark.py 89.66% ⭐ 89.66% ⭐ 0.00%
glotaran/analysis/optimization_group_calculator.py 99.90% ⭐ 99.90% ⭐ 0.00%
glotaran/analysis/optimize.py 39.79% 😞 40.69% 😞 0.90% 👍
glotaran/analysis/test/test_constraints.py 57.48% 🙂 57.48% 🙂 0.00%
glotaran/analysis/test/test_grouping.py 49.67% 😞 49.67% 😞 0.00%
glotaran/analysis/test/test_multiple_goups.py 56.70% 🙂 56.70% 🙂 0.00%
glotaran/analysis/test/test_optimization.py 34.53% 😞 34.53% 😞 0.00%
glotaran/analysis/test/test_penalties.py 67.27% 🙂 67.55% 🙂 0.28% 👍
glotaran/analysis/test/test_relations.py 58.25% 🙂 58.25% 🙂 0.00%
glotaran/builtin/io/ascii/wavelength_time_explicit_file.py 78.10% ⭐ 78.01% ⭐ -0.09% 👎
glotaran/builtin/io/folder/folder_plugin.py 55.31% 🙂 51.37% 🙂 -3.94% 👎
glotaran/builtin/io/folder/test/test_folder_plugin.py 85.18% ⭐ 88.86% ⭐ 3.68% 👍
glotaran/builtin/io/yml/yml.py 78.34% ⭐ 78.42% ⭐ 0.08% 👍
glotaran/builtin/io/yml/test/test_save_model.py 94.31% ⭐ 94.31% ⭐ 0.00%
glotaran/builtin/io/yml/test/test_save_result.py 88.79% ⭐ 96.72% ⭐ 7.93% 👍
glotaran/builtin/io/yml/test/test_save_scheme.py 78.73% ⭐ 78.73% ⭐ 0.00%
glotaran/builtin/megacomplexes/decay/init.py % % %
glotaran/builtin/megacomplexes/decay/decay_megacomplex.py 70.00% 🙂 86.65% ⭐ 16.65% 👍
glotaran/builtin/megacomplexes/decay/initial_concentration.py 83.93% ⭐ 88.17% ⭐ 4.24% 👍
glotaran/builtin/megacomplexes/decay/k_matrix.py 78.25% ⭐ 79.00% ⭐ 0.75% 👍
glotaran/builtin/megacomplexes/decay/util.py 53.83% 🙂 53.97% 🙂 0.14% 👍
glotaran/builtin/megacomplexes/decay/test/test_decay_megacomplex.py 59.54% 🙂 59.54% 🙂 0.00%
glotaran/builtin/megacomplexes/decay/test/test_k_matrix.py 65.74% 🙂 71.77% 🙂 6.03% 👍
glotaran/deprecation/modules/test/init.py 75.41% ⭐ 75.41% ⭐ 0.00%
glotaran/deprecation/modules/test/test_project_result.py 94.31% ⭐ 95.29% ⭐ 0.98% 👍
glotaran/deprecation/modules/test/test_project_scheme.py 75.33% ⭐ 71.69% 🙂 -3.64% 👎
glotaran/examples/init.py % % %
glotaran/examples/test/test_example.py 100.00% ⭐ 99.17% ⭐ -0.83% 👎
glotaran/io/init.py 87.99% ⭐ 87.99% ⭐ 0.00%
glotaran/io/interface.py 97.71% ⭐ 92.06% ⭐ -5.65% 👎
glotaran/model/init.py % % %
glotaran/model/dataset_group.py 93.03% ⭐ 93.03% ⭐ 0.00%
glotaran/model/model.py 72.40% 🙂 72.40% 🙂 0.00%
glotaran/model/test/test_model.py 72.38% 🙂 72.38% 🙂 0.00%
glotaran/plugin_system/data_io_registration.py 92.43% ⭐ 92.40% ⭐ -0.03% 👎
glotaran/plugin_system/project_io_registration.py 87.08% ⭐ 88.67% ⭐ 1.59% 👍
glotaran/plugin_system/test/test_data_io_registration.py 92.24% ⭐ 92.11% ⭐ -0.13% 👎
glotaran/plugin_system/test/test_project_io_registration.py 91.22% ⭐ 91.16% ⭐ -0.06% 👎
glotaran/project/result.py 76.37% ⭐ 76.25% ⭐ -0.12% 👎
glotaran/project/scheme.py 72.83% 🙂 81.10% ⭐ 8.27% 👍
glotaran/project/test/test_result.py 80.28% ⭐ 82.52% ⭐ 2.24% 👍
glotaran/project/test/test_scheme.py 80.83% ⭐ 78.28% ⭐ -2.55% 👎
glotaran/test/test_spectral_decay.py 53.88% 🙂 53.88% 🙂 0.00%
glotaran/test/test_spectral_decay_full_model.py 55.92% 🙂 55.92% 🙂 0.00%
glotaran/test/test_spectral_penalties.py 45.01% 😞 45.01% 😞 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/analysis/optimize.py _create_result 16 🙂 280 ⛔ 26 ⛔ 24.30% ⛔ Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/test/test_optimization.py test_optimization 19 😞 514 ⛔ 15 😞 25.11% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/test/test_spectral_penalties.py test_equal_area_penalties 5 ⭐ 783 ⛔ 17 ⛔ 34.81% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/decay/util.py calculate_decay_matrix_gaussian_irf 11 🙂 183 😞 18 ⛔ 38.30% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/decay/util.py retrieve_decay_associated_data 1 ⭐ 255 ⛔ 17 ⛔ 44.04% 😞 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!

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
5.9% 5.9% Duplication

@codecov
Copy link

codecov bot commented Oct 19, 2021

Codecov Report

Merging #875 (94cd6ca) into main (d1e36a9) will increase coverage by 0.4%.
The diff coverage is 93.2%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #875     +/-   ##
=======================================
+ Coverage   84.5%   85.0%   +0.4%     
=======================================
  Files         79      86      +7     
  Lines       4522    4686    +164     
  Branches     826     853     +27     
=======================================
+ Hits        3824    3985    +161     
+ Misses       556     554      -2     
- Partials     142     147      +5     
Impacted Files Coverage Δ
.../builtin/io/ascii/wavelength_time_explicit_file.py 58.6% <ø> (ø)
glotaran/plugin_system/data_io_registration.py 100.0% <ø> (ø)
...n/builtin/megacomplexes/decay/decay_megacomplex.py 79.3% <69.2%> (-3.3%) ⬇️
glotaran/analysis/optimization_group.py 87.6% <78.2%> (ø)
glotaran/project/scheme.py 88.0% <79.1%> (-2.8%) ⬇️
glotaran/project/generators/generator.py 88.8% <88.8%> (ø)
...ltin/megacomplexes/decay/decay_megacomplex_base.py 92.0% <92.0%> (ø)
glotaran/model/model.py 84.9% <92.3%> (+1.7%) ⬆️
glotaran/analysis/optimize.py 86.3% <92.5%> (+1.2%) ⬆️
...analysis/optimization_group_calculator_unlinked.py 94.3% <96.5%> (ø)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1e36a9...94cd6ca. Read the comment docs.

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.

2 participants