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

Upgrade Code for numpy 1.20 compatibility #555

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

joernweissenborn
Copy link
Member

@joernweissenborn joernweissenborn commented Feb 12, 2021

Refactored code for numpy 1.20 compatibility.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 12, 2021

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 2.33 ⭐ 2.33 ⭐ 0.00
Method Length 31.32 ⭐ 31.32 ⭐ 0.00
Working memory 8.12 🙂 8.12 🙂 0.00
Quality 77.99% 77.99% 0.00%
Other metrics Before After Change
Lines 672 672 0
Changed files Quality Before Quality After Quality Change
setup.py 54.18% 🙂 54.18% 🙂 0.00%
glotaran/analysis/test/models.py 60.14% 🙂 60.14% 🙂 0.00%
glotaran/builtin/file_formats/sdt/test/test_file_readers.py 64.16% 🙂 64.30% 🙂 0.14% 👍
glotaran/parameter/parameter.py 87.44% ⭐ 87.44% ⭐ 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/test/models.py additional_penalty_typecheck 10 🙂 190 😞 12 😞 45.85% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/test/models.py retrieve_clp_typecheck 6 ⭐ 198 😞 12 😞 48.99% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/file_formats/sdt/test/test_file_readers.py test_read_sdt 0 ⭐ 108 🙂 12 😞 64.30% 🙂 Extract out complex expressions
glotaran/parameter/parameter.py Parameter.from_list_or_value 4 ⭐ 79 🙂 12 😞 64.39% 🙂 Extract out complex expressions
glotaran/analysis/test/models.py calculate_spectral_gauss 1 ⭐ 102 🙂 11 😞 65.83% 🙂 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@sonarcloud
Copy link

sonarcloud bot commented Feb 12, 2021

Kudos, SonarCloud 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
No Duplication information No Duplication information

@codecov
Copy link

codecov bot commented Feb 12, 2021

Codecov Report

Merging #555 (30bab38) into main (ba7fea6) will not change coverage.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #555   +/-   ##
=====================================
  Coverage   74.0%   74.0%           
=====================================
  Files         58      58           
  Lines       3378    3378           
  Branches     639     639           
=====================================
  Hits        2500    2500           
  Misses       736     736           
  Partials     142     142           
Impacted Files Coverage Δ
glotaran/parameter/parameter.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 ba7fea6...1bf2ad2. Read the comment docs.

@jsnel jsnel added dependencies Pull requests that update a dependency file Priority: Medium Business as usual Status: In Progress Issues being worked on Type: Refactor Refactoring code labels Feb 12, 2021
@@ -61,7 +61,7 @@ class SimpleTestModel(Model):


def calculate_kinetic(dataset_descriptor=None, axis=None, index=None, extra_stuff=None):
kinpar = -1 * np.array(dataset_descriptor.kinetic)
kinpar = -1 * np.asarray(dataset_descriptor.kinetic)
Copy link
Member

Choose a reason for hiding this comment

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

Either version of the code works for me (to pass all tests).

Copy link
Member

@jsnel jsnel 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 jsnel added this to the v0.4.0 milestone Feb 12, 2021
@jsnel jsnel merged commit 33ff828 into glotaran:main Feb 12, 2021
s-weigand pushed a commit that referenced this pull request Feb 23, 2021
* Fixed Parameter.__array__

* bumped versions of dependencies:
- numpy
- asteval
- xarray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Priority: Medium Business as usual Status: In Progress Issues being worked on Type: Refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants