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/821 refactor model spec #836

Merged
merged 3 commits into from
Sep 26, 2021

Conversation

jsnel
Copy link
Member

@jsnel jsnel commented Sep 25, 2021

♻️ Refactor model specification

Change summary

  • ♻️ In model spec changed relation to clp_relations
  • ♻️ In model spec changed constraints to clp_constaints

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 👌 Closes issue (mandatory for ✨ feature and 🩹 bug fix PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)

Closes issues

closes #821

🩹 Fixes glotaran/builtin/io/yml/test/test_model_parser.py::test_relations
🩹 Fixes glotaran/builtin/io/yml/test/test_model_parser.py::test_constraints
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 25, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.64 ⭐ 3.66 ⭐ 0.02 👎
Method Length 72.05 🙂 72.90 🙂 0.85 👎
Working memory 6.93 🙂 6.94 🙂 0.01 👎
Quality 71.47% 🙂 71.31% 🙂 -0.16% 👎
Other metrics Before After Change
Lines 1449 1495 46
Changed files Quality Before Quality After Quality Change
glotaran/analysis/util.py 66.64% 🙂 66.64% 🙂 0.00%
glotaran/analysis/test/test_constraints.py 57.15% 🙂 57.15% 🙂 0.00%
glotaran/analysis/test/test_relations.py 57.85% 🙂 57.85% 🙂 0.00%
glotaran/builtin/io/yml/test/test_model_parser.py 82.35% ⭐ 82.35% ⭐ 0.00%
glotaran/deprecation/modules/builtin_io_yml.py 51.78% 🙂 49.53% 😞 -2.25% 👎
glotaran/deprecation/modules/test/test_builtin_io_yml.py 64.77% 🙂 62.09% 🙂 -2.68% 👎
glotaran/model/model.py 73.24% 🙂 73.24% 🙂 0.00%
glotaran/model/test/test_model.py 71.05% 🙂 71.05% 🙂 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/deprecation/modules/builtin_io_yml.py model_spec_deprecations 11 🙂 243 ⛔ 9 🙂 47.09% 😞 Try splitting into smaller methods
glotaran/model/model.py Model.markdown 10 🙂 118 🙂 10 😞 56.92% 🙂 Extract out complex expressions
glotaran/analysis/test/test_constraints.py test_constraint 6 ⭐ 169 😞 9 🙂 57.15% 🙂 Try splitting into smaller methods
glotaran/model/model.py Model._add_dict_items 10 🙂 97 🙂 11 😞 57.81% 🙂 Extract out complex expressions
glotaran/analysis/test/test_relations.py test_relations 6 ⭐ 186 😞 8 🙂 57.85% 🙂 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!

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch jsnel/pyglotaran/refactor/821_refactor_model_spec

@sonarcloud
Copy link

sonarcloud bot commented Sep 25, 2021

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jsnel jsnel added this to the v0.5.0 milestone Sep 25, 2021
@codecov
Copy link

codecov bot commented Sep 25, 2021

Codecov Report

Merging #836 (dbfc200) into main (ace90c5) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #836   +/-   ##
=====================================
  Coverage   84.8%   84.8%           
=====================================
  Files         77      77           
  Lines       4364    4366    +2     
  Branches     787     787           
=====================================
+ Hits        3703    3705    +2     
  Misses       521     521           
  Partials     140     140           
Impacted Files Coverage Δ
glotaran/analysis/util.py 91.3% <100.0%> (ø)
glotaran/deprecation/modules/builtin_io_yml.py 100.0% <100.0%> (ø)
glotaran/model/model.py 86.3% <100.0%> (ø)

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 ace90c5...dbfc200. Read the comment docs.

@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.4.1 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [21ba272a]       [dbfc2009]
     <v0.4.1>                   
-        63.6±1ms         38.3±1ms     0.60  BenchmarkOptimize.time_optimize(False, False, False)
-         396±6ms        54.6±30ms     0.14  BenchmarkOptimize.time_optimize(False, False, True)
-        84.2±6ms         68.9±3ms     0.82  BenchmarkOptimize.time_optimize(False, True, False)
         86.5±2ms        80.0±40ms     0.92  BenchmarkOptimize.time_optimize(False, True, True)
-        63.8±2ms         53.2±2ms     0.83  BenchmarkOptimize.time_optimize(True, False, False)
-         393±7ms        78.3±30ms     0.20  BenchmarkOptimize.time_optimize(True, False, True)
         81.8±3ms         80.6±3ms     0.99  BenchmarkOptimize.time_optimize(True, True, False)
         83.1±7ms        88.0±30ms     1.06  BenchmarkOptimize.time_optimize(True, True, True)
             182M             181M     1.00  IntegrationTwoDatasets.peakmem_create_result
             198M             197M     1.00  IntegrationTwoDatasets.peakmem_optimize
-         250±3ms          198±8ms     0.79  IntegrationTwoDatasets.time_create_result
        5.38±0.2s        1.87±0.1s    ~0.35  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [ace90c59]       [dbfc2009]
       40.5±0.9ms         38.3±1ms     0.94  BenchmarkOptimize.time_optimize(False, False, False)
         51.0±3ms        54.6±30ms     1.07  BenchmarkOptimize.time_optimize(False, False, True)
         66.6±4ms         68.9±3ms     1.03  BenchmarkOptimize.time_optimize(False, True, False)
        82.2±10ms        80.0±40ms     0.97  BenchmarkOptimize.time_optimize(False, True, True)
         53.0±2ms         53.2±2ms     1.00  BenchmarkOptimize.time_optimize(True, False, False)
        85.5±20ms        78.3±30ms     0.92  BenchmarkOptimize.time_optimize(True, False, True)
         82.1±2ms         80.6±3ms     0.98  BenchmarkOptimize.time_optimize(True, True, False)
         108±50ms        88.0±30ms    ~0.82  BenchmarkOptimize.time_optimize(True, True, True)
             181M             181M     1.00  IntegrationTwoDatasets.peakmem_create_result
             197M             197M     1.00  IntegrationTwoDatasets.peakmem_optimize
          203±5ms          198±8ms     0.98  IntegrationTwoDatasets.time_create_result
        1.87±0.1s        1.87±0.1s     1.00  IntegrationTwoDatasets.time_optimize

Copy link
Member

@s-weigand s-weigand left a comment

Choose a reason for hiding this comment

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

LGTM

@jsnel
Copy link
Member Author

jsnel commented Sep 26, 2021

@joernweissenborn this PR makes the changes you requested changing relations to clp_relations and constraints to clp_constraints.

@jsnel jsnel merged commit d4677d2 into glotaran:main Sep 26, 2021
@jsnel jsnel deleted the refactor/821_refactor_model_spec branch September 26, 2021 14:59
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.

♻️ Rename relation to clp_relations and constraints to clp_constraints
3 participants