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

Feature: Generators (Sourcery refactored) #962

Closed
wants to merge 32 commits into from
Closed

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Jan 21, 2022

Pull Request #866 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/866/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 30 commits January 20, 2022 14:58
API change between main and this PR should be addressed!

e.g. Properly deprecating removal of examples folder
Adapt to new examples->testing API
Co-authored-by: Sebastian Weigand <[email protected]>
Co-authored-by: Sebastian Weigand <[email protected]>
glotaran.testing.sequential_spectral_decay -> glotaran.testing.simulated_data.sequential_spectral_decay
This allow showinging the correct new usage while importing the functionality from somewhere else.
@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Jan 21, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.05%.

Quality metrics Before After Change
Complexity 1.15 ⭐ 1.06 ⭐ -0.09 👍
Method Length 51.65 ⭐ 51.94 ⭐ 0.29 👎
Working memory 6.29 🙂 6.29 🙂 0.00
Quality 78.79% 78.74% -0.05% 👎
Other metrics Before After Change
Lines 3059 2544 -515
Changed files Quality Before Quality After Quality Change
glotaran/init.py 91.44% ⭐ 88.07% ⭐ -3.37% 👎
glotaran/builtin/io/folder/test/test_folder_plugin.py 85.18% ⭐ 87.00% ⭐ 1.82% 👍
glotaran/builtin/io/yml/yml.py 78.43% ⭐ 77.86% ⭐ -0.57% 👎
glotaran/builtin/io/yml/test/test_save_model.py 94.31% ⭐ 94.31% ⭐ 0.00%
glotaran/builtin/io/yml/test/test_save_result.py 83.82% ⭐ 87.74% ⭐ 3.92% 👍
glotaran/builtin/io/yml/test/test_save_scheme.py 86.35% ⭐ 86.35% ⭐ 0.00%
glotaran/deprecation/deprecation_utils.py 72.44% 🙂 70.38% 🙂 -2.06% 👎
glotaran/deprecation/modules/test/test_model_model.py 93.30% ⭐ 95.01% ⭐ 1.71% 👍
glotaran/deprecation/modules/test/test_parameter_parameter_group.py 90.24% ⭐ 90.24% ⭐ 0.00%
glotaran/deprecation/modules/test/test_project_result.py 94.31% ⭐ 95.02% ⭐ 0.71% 👍
glotaran/deprecation/modules/test/test_project_scheme.py 75.33% ⭐ 74.59% 🙂 -0.74% 👎
glotaran/deprecation/test/test_deprecation_utils.py 87.71% ⭐ 87.86% ⭐ 0.15% 👍
glotaran/deprecation/test/dummy_package/init.py 94.05% ⭐ 89.49% ⭐ -4.56% 👎
glotaran/deprecation/test/dummy_package/deprecated_module_attribute.py 87.99% ⭐ 82.07% ⭐ -5.92% 👎
glotaran/model/test/test_model.py 72.61% 🙂 72.68% 🙂 0.07% 👍
glotaran/project/test/test_result.py 80.10% ⭐ 93.62% ⭐ 13.52% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/deprecation/deprecation_utils.py check_qualnames_in_tests.deprecate_dict_entry 11 🙂 135 😞 14 😞 47.35% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/io/yml/yml.py YmlProjectIo.save_model 15 🙂 106 🙂 13 😞 48.93% 😞 Extract out complex expressions
glotaran/model/test/test_model.py test_fill 0 ⭐ 243 ⛔ 7 🙂 62.26% 🙂 Try splitting into smaller methods
glotaran/model/test/test_model.py test_items 0 ⭐ 214 ⛔ 7 🙂 64.02% 🙂 Try splitting into smaller methods
glotaran/deprecation/deprecation_utils.py check_qualnames_in_tests.module_attribute.deprecate_submodule 6 ⭐ 123 😞 8 🙂 64.34% 🙂 Try splitting into smaller methods

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

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

Benchmark diff v0.5.1 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [96b42630]       [6c8cf2ce]
     <v0.5.1>                   
         74.8±4ms         66.7±2ms    ~0.89  BenchmarkOptimize.time_optimize(False, False, False)
         153±20ms         146±20ms     0.95  BenchmarkOptimize.time_optimize(False, False, True)
         74.3±4ms         69.4±4ms     0.93  BenchmarkOptimize.time_optimize(False, True, False)
         157±30ms         141±20ms    ~0.90  BenchmarkOptimize.time_optimize(False, True, True)
         87.9±4ms         82.9±5ms     0.94  BenchmarkOptimize.time_optimize(True, False, False)
        94.5±30ms         88.3±8ms     0.93  BenchmarkOptimize.time_optimize(True, False, True)
         89.1±2ms         89.3±4ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
        92.5±40ms        99.6±30ms     1.08  BenchmarkOptimize.time_optimize(True, True, True)
             200M             205M     1.03  IntegrationTwoDatasets.peakmem_optimize
-      2.35±0.05s       2.06±0.04s     0.87  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [bde9b19c]       [6c8cf2ce]
         64.5±4ms         66.7±2ms     1.03  BenchmarkOptimize.time_optimize(False, False, False)
         166±10ms         146±20ms    ~0.88  BenchmarkOptimize.time_optimize(False, False, True)
         68.9±4ms         69.4±4ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
          158±7ms         141±20ms    ~0.89  BenchmarkOptimize.time_optimize(False, True, True)
         85.3±3ms         82.9±5ms     0.97  BenchmarkOptimize.time_optimize(True, False, False)
        92.9±20ms         88.3±8ms     0.95  BenchmarkOptimize.time_optimize(True, False, True)
         86.5±4ms         89.3±4ms     1.03  BenchmarkOptimize.time_optimize(True, True, False)
         153±40ms        99.6±30ms    ~0.65  BenchmarkOptimize.time_optimize(True, True, True)
             204M             205M     1.01  IntegrationTwoDatasets.peakmem_optimize
       1.97±0.05s       2.06±0.04s     1.04  IntegrationTwoDatasets.time_optimize

@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #962 (6c8cf2c) into main (bde9b19) will decrease coverage by 0.2%.
The diff coverage is 87.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #962     +/-   ##
=======================================
- Coverage   85.4%   85.1%   -0.3%     
=======================================
  Files         87      90      +3     
  Lines       4872    4857     -15     
  Branches     920     912      -8     
=======================================
- Hits        4163    4138     -25     
- Misses       558     571     +13     
+ Partials     151     148      -3     
Impacted Files Coverage Δ
...lotaran/deprecation/modules/examples/sequential.py 0.0% <0.0%> (ø)
glotaran/project/generators/generator.py 90.4% <90.4%> (ø)
glotaran/__init__.py 100.0% <100.0%> (ø)
glotaran/builtin/io/yml/yml.py 88.6% <100.0%> (-2.0%) ⬇️
glotaran/deprecation/deprecation_utils.py 100.0% <100.0%> (ø)
glotaran/project/generators/__init__.py 100.0% <100.0%> (ø)
.../testing/simulated_data/parallel_spectral_decay.py 100.0% <100.0%> (ø)
...esting/simulated_data/sequential_spectral_decay.py 100.0% <100.0%> (ø)
glotaran/testing/simulated_data/shared_decay.py 100.0% <100.0%> (ø)
glotaran/project/result.py 81.3% <0.0%> (-4.0%) ⬇️
... and 1 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 bde9b19...6c8cf2c. Read the comment docs.

@sourcery-ai sourcery-ai bot closed this Jan 21, 2022
@sourcery-ai sourcery-ai bot deleted the sourcery/pull-866 branch January 21, 2022 01:09
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.

3 participants