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

Sourcery Starbot ⭐ refactored jason-neal/eniric #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/eniric master
git merge --ff-only FETCH_HEAD
git reset HEAD^

conftest.py Show resolved Hide resolved
eniric/_config.py Show resolved Hide resolved
eniric/_config.py Show resolved Hide resolved
eniric/_config.py Show resolved Hide resolved
eniric/atmosphere.py Show resolved Hide resolved
eniric/snr_normalization.py Show resolved Hide resolved
eniric/snr_normalization.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
eniric/utilities.py Show resolved Hide resolved
Comment on lines -530 to +519
if (num_cpu is None) or (num_cpu == 1):
num_cpu_minus_1 = 1
else:
num_cpu_minus_1 = num_cpu - 1
return num_cpu_minus_1
return 1 if (num_cpu is None) or (num_cpu == 1) else num_cpu - 1
Copy link
Author

Choose a reason for hiding this comment

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

Function cpu_minus_one refactored with the following changes:

  • Replace if statement with if expression
  • Inline variable that is only used once

tests/test_precision.py Show resolved Hide resolved
if test_spec[2] is not None:
if mask is not None:
Copy link
Author

Choose a reason for hiding this comment

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

Function test_relation_of_rv_to_sqrtsumwis refactored with the following changes:

  • Use previously assigned local variable

Comment on lines -80 to +85
data1 = range(5)
data2 = range(5, 10)
bad_data = range(6) # Different length

# test uneven data lengths
with pytest.raises(ValueError):
data1 = range(5)
data2 = range(5, 10)
bad_data = range(6) # Different length

Copy link
Author

Choose a reason for hiding this comment

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

Function test_write_col_errors_different_length refactored with the following changes:

  • Move assignments closer to their usage

Comment on lines -93 to +98
data1 = range(5)
data2 = range(5, 10)
bad_data = range(6) # Different length

# test bad header
with pytest.raises(ValueError):
data1 = range(5)
data2 = range(5, 10)
bad_data = range(6) # Different length

Copy link
Author

Choose a reason for hiding this comment

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

Function test_write_col_errors refactored with the following changes:

  • Move assignments closer to their usage

Comment on lines -108 to 110
data1 = range(5)

with pytest.raises(TypeError):
Copy link
Author

Choose a reason for hiding this comment

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

Function test_write_col_errors_bad_keyword refactored with the following changes:

  • Move assignments closer to their usage

wave = request.param
return wave
return request.param
Copy link
Author

Choose a reason for hiding this comment

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

Function wavelength refactored with the following changes:

  • Inline variable that is only used once

@jason-neal
Copy link
Owner

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- eniric/atmosphere.py  1
         

Complexity decreasing per file
==============================
+ scripts/precision_four_panel.py  -3
+ eniric/snr_normalization.py  -1
         

See the complete overview on Codacy

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 92.148% when pulling d0f9056 on sourcery-ai-bot:master into 8494339 on jason-neal:master.

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